Showing 3,272 of 4,939 total issues

Method visitClass has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function visitClass(Node $node): void
    {
        if (!Config::get_track_references()) {
            return;
        }
Severity: Minor
Found in .phan/plugins/PHPUnitNotDeadCodePlugin.php - About 1 hr to fix

    Function getMethodsMapGroupedByDefiningFQSEN has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getMethodsMapGroupedByDefiningFQSEN(): Map
        {
            $methods_by_defining_fqsen = new Map();
            '@phan-var Map<FullyQualifiedMethodName,ArrayObject<Method>> $methods_by_defining_fqsen';
            foreach ($this->method_set as $method) {
    Severity: Minor
    Found in src/Phan/CodeBase.php - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function addPHPBinariesForSyntaxCheck has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        private static function addPHPBinariesForSyntaxCheck(array $binaries): void
        {
            $resolved_binaries = [];
            foreach ($binaries as $binary) {
                if ($binary === '') {
    Severity: Minor
    Found in src/Phan/CLI.php - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function locateClassConstantCompletion has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        private static function locateClassConstantCompletion(
            CompletionRequest $request,
            CodeBase $code_base,
            Context $context,
            Node $node,
    Severity: Minor
    Found in src/Phan/LanguageServer/CompletionResolver.php - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function build has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public function build(): Comment
        {
            foreach ($this->lines as $i => $line) {
                if (\strpos($line, '@') === false) {
                    continue;
    Severity: Minor
    Found in src/Phan/Language/Element/Comment/Builder.php - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function setMagicMethodMap has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public function setMagicMethodMap(
            array $magic_method_map,
            CodeBase $code_base
        ): bool {
            if (count($magic_method_map) === 0) {
    Severity: Minor
    Found in src/Phan/Language/Element/Clazz.php - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function checkConstantCompatibility has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        private static function checkConstantCompatibility(
            CodeBase $code_base,
            ClassConstant $inherited_constant,
            ClassConstant $overriding_constant
        ): void {
    Severity: Minor
    Found in src/Phan/Language/Element/Clazz.php - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function getAncestorElement has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function getAncestorElement(CodeBase $code_base, FullyQualifiedClassName $ancestor_fqsen, ClassElement $element): ?ClassElement
        {
            if (!$code_base->hasClassWithFQSEN($ancestor_fqsen)) {
                return null;
            }
    Severity: Minor
    Found in src/Phan/Language/Element/Clazz.php - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function getUnionTypeRepresentationForIssue has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        private function getUnionTypeRepresentationForIssue(): string
        {
            $union_type = $this->getNonVariadicUnionType()->asNormalizedTypes();
            if ($union_type->isEmpty()) {
                return '';
    Severity: Minor
    Found in src/Phan/Language/Element/Parameter.php - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function magicParamFromMagicMethodParamString has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        private function magicParamFromMagicMethodParamString(
            string $param_string,
            int $param_index,
            int $comment_line_offset
        ): ?Parameter {
    Severity: Minor
    Found in src/Phan/Language/Element/Comment/Builder.php - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function methodListFromReflectionClassAndMethod has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function methodListFromReflectionClassAndMethod(
            Context $context,
            \ReflectionClass $class,
            \ReflectionMethod $reflection_method
        ): array {
    Severity: Minor
    Found in src/Phan/Language/Element/FunctionFactory.php - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function applyOverride has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        private function applyOverride(string $key, $value): void
        {
            switch ($key) {
                case 'param':
                    foreach ($value as $parameter) {
    Severity: Minor
    Found in src/Phan/Language/Element/Comment.php - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function toFunctionSignatureArray has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public function toFunctionSignatureArray(): array
        {
            $return_type = $this->getUnionType();
            $stub = [$return_type->__toString()];
            '@phan-var array<mixed,string> $stub';  // TODO: Should not warn about PhanTypeMismatchDimFetch in isset below
    Severity: Minor
    Found in src/Phan/Language/Element/FunctionTrait.php - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function extractTagSummary has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function extractTagSummary(array $lines, int $i): array
        {
            $summary = [];
            $summary[] = self::trimLine($lines[$i]);
            for ($j = $i + 1; $j < count($lines); $j++) {
    Severity: Minor
    Found in src/Phan/Language/Element/MarkupDescription.php - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function getMarkupDescription has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getMarkupDescription(): string
        {
            $string = '';
            // It's an error to have visibility or abstract in an interface's stub (e.g. JsonSerializable)
            if ($this->isPrivate()) {
    Severity: Minor
    Found in src/Phan/Language/Element/Method.php - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function getReferencedClasses has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getReferencedClasses(): Generator
        {
            // Whether union types or types have been seen already for this ArrayShapeType
            $seen = [];
            foreach ($this->field_types as $type) {
    Severity: Minor
    Found in src/Phan/Language/Type/ArrayShapeType.php - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function canCastToNonNullableFunctionLikeDeclarationType has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public function canCastToNonNullableFunctionLikeDeclarationType(FunctionLikeDeclarationType $type): bool
        {
            if ($this->required_param_count > $type->required_param_count) {
                return false;
            }
    Severity: Minor
    Found in src/Phan/Language/Type/FunctionLikeDeclarationType.php - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function applyUnaryNotOperatorToList has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        private static function applyUnaryNotOperatorToList(array $type_set): array
        {
            $contains_falsey = false;
            $contains_truthy = false;
            foreach ($type_set as $type) {
    Severity: Minor
    Found in src/Phan/Language/UnionType.php - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function canCastToTypeHandlingTemplates has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public function canCastToTypeHandlingTemplates(Type $type, CodeBase $code_base): bool
        {
            // Check to see if we have an exact object match
            if ($this === $type) {
                return true;
    Severity: Minor
    Found in src/Phan/Language/Type/VoidType.php - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function applyBoolCastToList has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        private static function applyBoolCastToList(array $type_set): array
        {
            $contains_falsey = false;
            $contains_truthy = false;
            foreach ($type_set as $type) {
    Severity: Minor
    Found in src/Phan/Language/UnionType.php - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Severity
    Category
    Status
    Source
    Language