Showing 3,272 of 4,939 total issues

Function getEquivalentPHPValueForNode has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    public function getEquivalentPHPValueForNode($node, int $flags)
    {
        if (!($node instanceof Node)) {
            return $node;
        }
Severity: Minor
Found in src/Phan/AST/ContextNode.php - About 4 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 ensurePluginsExist has 110 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function ensurePluginsExist(): void
    {
        if (!is_null($this->plugin_set)) {
            return;
        }
Severity: Major
Found in src/Phan/Plugin/ConfigPluginSet.php - About 4 hrs to fix

    Method visitVar has 110 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function visitVar(Node $node): Context
        {
            try {
                $variable_name = (new ContextNode(
                    $this->code_base,
    Severity: Major
    Found in src/Phan/Analysis/AssignmentVisitor.php - About 4 hrs to fix

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

          private static function getReturnTypeOverridesStatic(): array
          {
              /**
               * @param list<Node|int|string|float> $args
               */
      Severity: Major
      Found in src/Phan/Plugin/Internal/ClosureReturnTypeOverridePlugin.php - About 4 hrs to fix

        Method getEquivalentPHPValueForNode has 109 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getEquivalentPHPValueForNode($node, int $flags)
            {
                if (!($node instanceof Node)) {
                    return $node;
                }
        Severity: Major
        Found in src/Phan/AST/ContextNode.php - About 4 hrs to fix

          File DefinitionResolver.php has 348 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

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

            Property has 34 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Property extends ClassElement
            {
                use ElementFutureUnionType;
                use ClosedScopeElement;
            
            
            Severity: Minor
            Found in src/Phan/Language/Element/Property.php - About 4 hrs to fix

              Config has 34 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Config
              {
                  /**
                   * The version of the AST (defined in php-ast) that we're using.
                   * @see https://github.com/nikic/php-ast#ast-versioning
              Severity: Minor
              Found in src/Phan/Config.php - About 4 hrs to fix

                File MarkupDescription.php has 347 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                declare(strict_types=1);
                
                namespace Phan\Language\Element;
                Severity: Minor
                Found in src/Phan/Language/Element/MarkupDescription.php - About 4 hrs to fix

                  File IncompatibleStubsSignatureDetector.php has 344 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

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

                    Function checkAllArgsUsed has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static function checkAllArgsUsed(array $opts, array &$argv): void
                        {
                            $pruneargv = [];
                            foreach ($opts as $opt => $value) {
                                foreach ($argv as $key => $chunk) {
                    Severity: Minor
                    Found in src/Phan/CLI.php - About 4 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 readMessages has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function readMessages(): int
                        {
                            $emitted_messages = 0;
                            while (($c = \fgetc($this->input)) !== false && $c !== '') {
                                $this->buffer .= $c;
                    Severity: Minor
                    Found in src/Phan/LanguageServer/ProtocolStreamReader.php - About 4 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 getShortRepresentationForIssue has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getShortRepresentationForIssue(bool $is_internal = false): string
                        {
                            $string = '';
                    
                            $union_type_string = $this->getUnionTypeRepresentationForIssue();
                    Severity: Minor
                    Found in src/Phan/Language/Element/Parameter.php - About 4 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 iterableKeyUnionType has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function iterableKeyUnionType(CodeBase $code_base): UnionType
                        {
                            // This is frequently called, and has been optimized
                            $new_type_builder = new UnionTypeBuilder();
                            foreach ($this->type_set as $type) {
                    Severity: Minor
                    Found in src/Phan/Language/UnionType.php - About 4 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 withFlattenedTopLevelArrayShapeTypeInstancesForSet has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static function withFlattenedTopLevelArrayShapeTypeInstancesForSet(array $type_set): array
                        {
                            $result = [];
                            $has_other_array_type = false;
                            $empty_array_shape_type = null;
                    Severity: Minor
                    Found in src/Phan/Language/UnionType.php - About 4 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 applyNumericOperationToList has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static function applyNumericOperationToList(array $type_set, Closure $operation): array
                        {
                            $added_fallbacks = false;
                            $result = [];
                            foreach ($type_set as $type) {
                    Severity: Minor
                    Found in src/Phan/Language/UnionType.php - About 4 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 iterableKeyUnionType has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function iterableKeyUnionType(CodeBase $code_base): ?UnionType
                        {
                            if ($this->namespace === '\\') {
                                $name = strtolower($this->name);
                                if ($name === 'traversable' || $name === 'iterator') {
                    Severity: Minor
                    Found in src/Phan/Language/Type.php - About 4 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 iterableValueUnionType has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function iterableValueUnionType(CodeBase $code_base): ?UnionType
                        {
                            if ($this->namespace === '\\') {
                                $name = strtolower($this->name);
                                if ($name === 'traversable' || $name === 'iterator') {
                    Severity: Minor
                    Found in src/Phan/Language/Type.php - About 4 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 visitMatchArmList has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function visitMatchArmList(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 4 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 withoutCaughtUnionTypes has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function withoutCaughtUnionTypes(UnionType $union_type, bool $is_raw_throw): UnionType
                        {
                            if ($union_type->isEmpty()) {
                                if (!$is_raw_throw) {
                                    return $union_type;
                    Severity: Minor
                    Found in src/Phan/Plugin/Internal/ThrowAnalyzerPlugin.php - About 4 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