Showing 3,225 of 4,939 total issues

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 GenericArrayType.php has 582 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/GenericArrayType.php - About 1 day to fix

        Function analyzeOverrideSignatureForOverriddenMethod has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
        Open

            private static function analyzeOverrideSignatureForOverriddenMethod(
                CodeBase $code_base,
                Method $method,
                Clazz $class,
                Method $o_method
        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 ArrayReturnTypeOverridePlugin.php has 573 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/ArrayReturnTypeOverridePlugin.php - About 1 day to fix

          File IssueFixSuggester.php has 571 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

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

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

              Method getAnalyzeFunctionCallClosuresStatic has 242 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private static function getAnalyzeFunctionCallClosuresStatic(): array
                  {
                      /**
                       * @param Closure(UnionType):int $checker returns _IS_IMPOSSIBLE/_IS_REDUNDANT/_IS_REASONABLE_CONDITION
                       * @param string $expected_type
              Severity: Major
              Found in src/Phan/Plugin/Internal/RedundantConditionCallPlugin.php - About 1 day to fix

                File Context.php has 569 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

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

                  Function analyzeParameter has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function analyzeParameter(CodeBase $code_base, Context $context, FunctionInterface $method, UnionType $argument_type, int $lineno, int $i, $argument_node, ?Node $node): void
                      {
                          // Expand it to include all parent types up the chain
                          try {
                              $argument_type_expanded_resolved =
                  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 Parameter.php has 555 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/Parameter.php - About 1 day to fix

                    Function getReturnTypeOverridesStatic has a Cognitive Complexity of 57 (exceeds 5 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: Minor
                    Found in src/Phan/Plugin/Internal/DependentReturnTypeOverridePlugin.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 shouldWarnAboutImpossibleArrayKeyExists has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static function shouldWarnAboutImpossibleArrayKeyExists(CodeBase $code_base, Context $context, array $args, ?UnionType $key_type = null, ?UnionType $array_type = null): bool
                        {
                            $array_type = $array_type ?? UnionTypeVisitor::unionTypeFromNode($code_base, $context, $args[1]);
                            if (!$array_type->hasRealTypeSet()) {
                                return false;
                    Severity: Minor
                    Found in src/Phan/Plugin/Internal/MiscParamPlugin.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

                    CLI has 61 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class CLI
                    {
                        /**
                         * This should be updated to x.y.z-dev after every release, and x.y.z before a release.
                         */
                    Severity: Major
                    Found in src/Phan/CLI.php - About 1 day to fix

                      Method fromStringInContext has 218 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function fromStringInContext(
                              string $string,
                              Context $context,
                              int $source,
                              CodeBase $code_base = null
                      Severity: Major
                      Found in src/Phan/Language/Type.php - About 1 day to fix

                        File Phan.php has 528 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

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

                          Function analyzeClassConstantTypes has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function analyzeClassConstantTypes(CodeBase $code_base, Clazz $clazz): void
                              {
                                  foreach ($clazz->getConstantMap($code_base) as $constant) {
                                      // 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/ClassConstantTypesAnalyzer.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 RedundantConditionVisitor.php has 524 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/RedundantConditionVisitor.php - About 1 day to fix

                            File PropertyDocumentationMap.php has 522 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            <?php // phpcs:ignoreFile
                            namespace Phan\Language\Internal;
                            
                            /**
                             * This contains descriptions used by Phan for hover text of internal properties in the language server mode.
                            Severity: Major
                            Found in src/Phan/Language/Internal/PropertyDocumentationMap.php - About 1 day to fix
                              Severity
                              Category
                              Status
                              Source
                              Language