Showing 3,272 of 4,939 total issues

CodeBase has 110 functions (exceeds 20 allowed). Consider refactoring.
Open

class CodeBase
{
    /**
     * @var Map<FullyQualifiedClassName,Clazz>
     * A map from FQSEN to an internal or user defined class
Severity: Major
Found in src/Phan/CodeBase.php - About 2 days to fix

    FunctionLikeDeclarationType has 110 functions (exceeds 20 allowed). Consider refactoring.
    Open

    abstract class FunctionLikeDeclarationType extends Type implements FunctionInterface
    {
        // Subclasses will override this
        public const NAME = '';
    
    
    Severity: Major
    Found in src/Phan/Language/Type/FunctionLikeDeclarationType.php - About 2 days to fix

      File EmptyUnionType.php has 865 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

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

        KindVisitorImplementation has 107 functions (exceeds 20 allowed). Consider refactoring.
        Open

        abstract class KindVisitorImplementation implements KindVisitor
        {
        
            /**
             * The fallback implementation for node kinds where the subclass visitor
        Severity: Major
        Found in src/Phan/AST/Visitor/KindVisitorImplementation.php - About 2 days to fix

          File UseReturnValuePlugin.php has 823 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

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

            Function processGraph has a Cognitive Complexity of 97 (exceeds 5 allowed). Consider refactoring.
            Open

                public function processGraph(array $cached_graph = null): void
                {
                    $cmd  = $_ENV['PDEP_CMD'];
                    $mode = $_ENV['PDEP_MODE'];
                    $this->depth = (int)$_ENV['PDEP_DEPTH'];
            Severity: Minor
            Found in src/Phan/Plugin/Internal/DependencyGraphPlugin.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 ConditionVisitor.php has 801 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

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

              Method init has 378 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function init(): void
                  {
                      self::$noop = static function (Node $_): string {
                          return '(unknown)';
                      };
              Severity: Major
              Found in src/Phan/AST/ASTReverter.php - About 1 day to fix

                File VariableTrackerVisitor.php has 761 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

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

                  Function analyzeParameterList has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private static function analyzeParameterList(
                          CodeBase $code_base,
                          FunctionInterface $method,
                          Node $node,
                          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

                  File ArrayShapeType.php has 741 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/ArrayShapeType.php - About 1 day to fix

                    UnionTypeVisitor has 90 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class UnionTypeVisitor extends AnalysisVisitor
                    {
                        /**
                         * If an dynamic unpacked array has more elements than this, then give up on building up the union type
                         */
                    Severity: Major
                    Found in src/Phan/AST/UnionTypeVisitor.php - About 1 day to fix

                      Function visitSwitchList has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function visitSwitchList(Node $node): Context
                          {
                              // Make a copy of the internal context so that we don't
                              // leak any changes within the closed context to the
                              // outer scope
                      Severity: Minor
                      Found in src/Phan/BlockAnalysisVisitor.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 usage has 338 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function usage(string $msg = '', ?int $exit_code = EXIT_SUCCESS, int $usage_type = UsageException::PRINT_NORMAL, bool $forbid_color = true): void
                          {
                              global $argv;
                      
                              if ($msg !== '') {
                      Severity: Major
                      Found in src/Phan/CLI.php - About 1 day to fix

                        Function analyzePrintfPattern has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function analyzePrintfPattern(CodeBase $code_base, Context $context, FunctionInterface $function, $pattern_node, $arg_nodes): void
                            {
                                // Given a node, extract the printf directive and whether or not it could be translated
                                $primitive_for_fmtstr = $this->astNodeToPrimitive($code_base, $context, $pattern_node);
                                /**
                        Severity: Minor
                        Found in .phan/plugins/PrintfCheckerPlugin.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

                        TolerantASTConverter has 86 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class TolerantASTConverter
                        {
                            // The latest stable version of php-ast.
                            // For something != 70, update the library's release.
                            public const AST_VERSION = 70;
                        Severity: Major
                        Found in src/Phan/AST/TolerantASTConverter/TolerantASTConverter.php - About 1 day to fix

                          Function check_fields has a Cognitive Complexity of 81 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function check_fields(string $function_name, array $fields, array $signatures): void
                          {
                              $return_type = $fields[0];  // TODO: Check type
                              if (!is_string($return_type)) {
                                  throw new InvalidArgumentException("Invalid return type: " . json_encode($return_type));
                          Severity: Minor
                          Found in internal/sanitycheck.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 NegatedConditionVisitor.php has 702 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

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

                            File BinaryOperatorFlagVisitor.php has 697 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

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

                              Function getElementsFromElementListForDeferredAnalysis has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private static function getElementsFromElementListForDeferredAnalysis(
                                      CodeBase $code_base,
                                      iterable $element_list,
                                      int $total_count,
                                      int &$i
                              Severity: Minor
                              Found in src/Phan/Analysis/ReferenceCountsAnalyzer.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

                              Severity
                              Category
                              Status
                              Source
                              Language