Showing 3,272 of 4,939 total issues

IncompatibleSignatureDetectorBase has 50 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class IncompatibleSignatureDetectorBase
{
    use Memoize;

    const FUNCTIONLIKE_BLACKLIST = '@' .
Severity: Minor
Found in internal/lib/IncompatibleSignatureDetectorBase.php - About 7 hrs to fix

    Method visitDim has 173 lines of code (exceeds 25 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: Major
    Found in src/Phan/AST/UnionTypeVisitor.php - About 6 hrs to fix

      Function merge has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function merge(array $union_types, bool $normalize_array_shapes = true): UnionType
          {
              $n = \count($union_types);
              if ($n < 2) {
                  return \reset($union_types) ?: UnionType::$empty_instance;
      Severity: Minor
      Found in src/Phan/Language/UnionType.php - About 6 hrs 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 analyzePropertyTypes has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function analyzePropertyTypes(CodeBase $code_base, Clazz $clazz): void
          {
              foreach ($clazz->getPropertyMap($code_base) as $property) {
                  // This phase is done before the analysis phase, so there aren't any dynamic properties to filter out.
      
      
      Severity: Minor
      Found in src/Phan/Analysis/PropertyTypesAnalyzer.php - About 6 hrs 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 Initializer.php has 453 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      declare(strict_types=1);
      
      namespace Phan\Config;
      Severity: Minor
      Found in src/Phan/Config/Initializer.php - About 6 hrs to fix

        ConfigPluginSet has 49 functions (exceeds 20 allowed). Consider refactoring.
        Open

        final class ConfigPluginSet extends PluginV3 implements
            AfterAnalyzeFileCapability,
            AnalyzeClassCapability,
            AnalyzeFunctionCapability,
            AnalyzeFunctionCallCapability,
        Severity: Minor
        Found in src/Phan/Plugin/ConfigPluginSet.php - About 6 hrs to fix

          Function analyzeComposition has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function analyzeComposition(
                  CodeBase $code_base,
                  Clazz $class
              ): void {
                  // Get the list of all inherited classes.
          Severity: Minor
          Found in src/Phan/Analysis/CompositionAnalyzer.php - About 6 hrs 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 Parser.php has 444 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          declare(strict_types=1);
          
          namespace Phan\AST;
          Severity: Minor
          Found in src/Phan/AST/Parser.php - About 6 hrs to fix

            Method addProperty has 165 lines of code (exceeds 25 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: Major
            Found in src/Phan/Parse/ParseVisitor.php - About 6 hrs to fix

              File IncompatibleSignatureDetectorBase.php has 441 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              declare(strict_types=1);
              
              use Phan\CodeBase;
              Severity: Minor
              Found in internal/lib/IncompatibleSignatureDetectorBase.php - About 6 hrs to fix

                Function combineArrayTypeListsOverriding has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
                Open

                    private static function combineArrayTypeListsOverriding(array $left_types, array $right_types, bool $is_assignment, bool $is_real): array
                    {
                        if ($is_real && !$right_types) {
                            return [];
                        }
                Severity: Minor
                Found in src/Phan/Language/Type/ArrayType.php - About 6 hrs 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 visitArray has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function visitArray(Node $node): UnionType
                    {
                        $children = $node->children;
                        if (\count($children) > 0) {
                            $key_set = $this->getEquivalentArraySet($node);
                Severity: Minor
                Found in src/Phan/AST/UnionTypeVisitor.php - About 6 hrs 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 check_fields has 164 lines of code (exceeds 25 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: Major
                Found in internal/sanitycheck.php - About 6 hrs to fix

                  Method analyzeOverrideRealSignature has 163 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private static function analyzeOverrideRealSignature(
                          CodeBase $code_base,
                          Method $method,
                          Clazz $class,
                          Method $o_method,
                  Severity: Major
                  Found in src/Phan/Analysis/ParameterTypesAnalyzer.php - About 6 hrs to fix

                    ContextNode has 47 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class ContextNode
                    {
                    
                        /** @var CodeBase The code base within which we're operating */
                        private $code_base;
                    Severity: Minor
                    Found in src/Phan/AST/ContextNode.php - About 6 hrs to fix

                      File KindVisitorImplementation.php has 437 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      
                      declare(strict_types=1);
                      
                      namespace Phan\AST\Visitor;
                      Severity: Minor
                      Found in src/Phan/AST/Visitor/KindVisitorImplementation.php - About 6 hrs to fix

                        Method fromReflectionClass has 162 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public static function fromReflectionClass(
                                CodeBase $code_base,
                                ReflectionClass $class
                            ): Clazz {
                                // Build a set of flags based on the constitution
                        Severity: Major
                        Found in src/Phan/Language/Element/Clazz.php - About 6 hrs to fix

                          Function getMethod has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function getMethod(
                                  $method_name,
                                  bool $is_static,
                                  bool $is_direct = false,
                                  bool $is_new_expression = false
                          Severity: Minor
                          Found in src/Phan/AST/ContextNode.php - About 6 hrs 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 addParamToScopeOfFunctionOrMethod has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function addParamToScopeOfFunctionOrMethod(
                                  Context $context,
                                  CodeBase $code_base,
                                  FunctionInterface $function,
                                  Comment $comment,
                          Severity: Minor
                          Found in src/Phan/Language/Element/FunctionTrait.php - About 6 hrs 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 analyzeShapedArrayAssignment has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function analyzeShapedArrayAssignment(Node $node): void
                              {
                                  // Figure out the type of elements in the list
                                  $fallback_element_type = null;
                                  /** @suppress PhanAccessMethodInternal */
                          Severity: Minor
                          Found in src/Phan/Analysis/AssignmentVisitor.php - About 6 hrs 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