Showing 3,272 of 4,939 total issues

File Config.php has 683 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

namespace Phan;
Severity: Major
Found in src/Phan/Config.php - About 1 day to fix

    Function analyzeRealSignatureCompatibility has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring.
    Open

        private static function analyzeRealSignatureCompatibility(CodeBase $code_base, FunctionInterface $method, int $minimum_target_php_version): void
        {
            $php70_checks = $minimum_target_php_version < 70100;
    
            foreach ($method->getRealParameterList() as $real_parameter) {
    Severity: Minor
    Found in src/Phan/Analysis/ParameterTypesAnalyzer.php - About 1 day 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 visitDim has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring.
    Open

        public function visitDim(Node $node, bool $treat_undef_as_nullable = false): UnionType
        {
            $union_type = self::unionTypeFromNode(
                $this->code_base,
                $this->context,
    Severity: Minor
    Found in src/Phan/AST/UnionTypeVisitor.php - About 1 day 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

    File FunctionLikeDeclarationType.php has 667 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    declare(strict_types=1);
    
    namespace Phan\Language\Type;
    Severity: Major
    Found in src/Phan/Language/Type/FunctionLikeDeclarationType.php - About 1 day to fix

      Function getProperty has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getProperty(
              bool $is_static,
              bool $is_known_assignment = false
          ): Property {
              $node = $this->node;
      Severity: Minor
      Found in src/Phan/AST/ContextNode.php - About 1 day 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

      Method getReturnTypeOverridesStatic has 297 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function getReturnTypeOverridesStatic(CodeBase $code_base): array
          {
              $string_union_type = StringType::instance(false)->asPHPDocUnionType();
              $string_union_type_real = StringType::instance(false)->asRealUnionType();
              $string_union_type_with_false_in_real = UnionType::fromFullyQualifiedPHPDocAndRealString('string', 'string|false');
      Severity: Major
      Found in src/Phan/Plugin/Internal/DependentReturnTypeOverridePlugin.php - About 1 day to fix

        Function analyzeReturnTypesInner has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
        Open

            private function analyzeReturnTypesInner(CodeBase $code_base): void
            {
                if ($this->isPHPInternal()) {
                    // nothing to do, no known Node
                    return;
        Severity: Minor
        Found in src/Phan/Language/Element/FunctionTrait.php - About 1 day 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 analyzeParameterTypesInner has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
        Open

            private static function analyzeParameterTypesInner(
                CodeBase $code_base,
                FunctionInterface $method
            ): void {
                if (Config::getValue('check_docblock_signature_param_type_match')) {
        Severity: Minor
        Found in src/Phan/Analysis/ParameterTypesAnalyzer.php - About 1 day 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

        File Method.php has 648 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        declare(strict_types=1);
        
        namespace Phan\Language\Element;
        Severity: Major
        Found in src/Phan/Language/Element/Method.php - About 1 day to fix

          Function addProperty has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
          Open

              private function addProperty(Clazz $class, string $property_name, $default_node, UnionType $real_union_type, ?Comment\Parameter $variable, int $lineno, int $flags, ?string $doc_comment, Comment $property_comment): ?Property
              {
                  $variable_has_literals = $variable && $variable->getUnionType()->hasLiterals();
          
                  // If something goes wrong will getting the type of
          Severity: Minor
          Found in src/Phan/Parse/ParseVisitor.php - About 1 day 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

          FlagVisitorImplementation has 74 functions (exceeds 20 allowed). Consider refactoring.
          Open

          abstract class FlagVisitorImplementation implements FlagVisitor
          {
          
              /**
               * This is called to analyze nodes in FlagVisitorImplementation subclasses
          Severity: Major
          Found in src/Phan/AST/Visitor/FlagVisitorImplementation.php - About 1 day to fix

            Function warnAboutVariableGraph has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
            Open

                private function warnAboutVariableGraph(
                    Node $method_node,
                    VariableGraph $graph,
                    array $issue_overrides_for_definition_ids
                ): void {
            Severity: Minor
            Found in src/Phan/Plugin/Internal/VariableTrackerPlugin.php - About 1 day 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 loadMethodPlugins has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function loadMethodPlugins(CodeBase $code_base): void
                {
                    $plugin_set = ConfigPluginSet::instance();
                    $return_type_overrides = $plugin_set->getReturnTypeOverrides($code_base);
                    $return_type_override_fqsen_strings = [];
            Severity: Minor
            Found in src/Phan/Analysis.php - About 1 day 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 analyzeParameterListForCallback has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
            Open

                private static function analyzeParameterListForCallback(
                    CodeBase $code_base,
                    FunctionInterface $method,
                    array $arg_nodes,
                    Context $context,
            Severity: Minor
            Found in src/Phan/Analysis/ArgumentType.php - About 1 day 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 resolveDocCommentForClosure has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
            Open

                private static function resolveDocCommentForClosure(PhpParser\Node\Expression $node): ?string
                {
                    $doc_comment = $node->getDocCommentText();
                    if (\Phan\Library\StringUtil::isNonZeroLengthString($doc_comment)) {
                        return $doc_comment;
            Severity: Minor
            Found in src/Phan/AST/TolerantASTConverter/TolerantASTConverter.php - About 1 day 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

            File LanguageServer.php has 595 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            declare(strict_types=1);
            
            namespace Phan\LanguageServer;
            Severity: Major
            Found in src/Phan/LanguageServer/LanguageServer.php - About 1 day to fix

              Function fromStringInContext has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function fromStringInContext(
                      string $string,
                      Context $context,
                      int $source,
                      CodeBase $code_base = null
              Severity: Minor
              Found in src/Phan/Language/Type.php - About 1 day 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

              InferPureVisitor has 69 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class InferPureVisitor extends AnalysisVisitor
              {
                  /** @var string the function fqsen being visited */
                  protected $function_fqsen_label;
              
              
              Severity: Major
              Found in src/Phan/AST/InferPureVisitor.php - About 1 day to fix

                File AssignOperatorAnalysisVisitor.php has 583 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                declare(strict_types=1);
                
                namespace Phan\Analysis;
                Severity: Major
                Found in src/Phan/Analysis/AssignOperatorAnalysisVisitor.php - About 1 day to fix

                  File ASTSimplifier.php has 583 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  
                  declare(strict_types=1);
                  
                  namespace Phan\AST;
                  Severity: Major
                  Found in src/Phan/AST/ASTSimplifier.php - About 1 day to fix
                    Severity
                    Category
                    Status
                    Source
                    Language