Showing 3,272 of 4,939 total issues

Method removeLiteralScalarFromVariable has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    final protected function removeLiteralScalarFromVariable(
        Node $var_node,
        Context $context,
        $value,
        bool $strict_equality
Severity: Major
Found in src/Phan/Analysis/ConditionVisitorUtil.php - About 2 hrs to fix

    Method typeCheckDimAssignment has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function typeCheckDimAssignment(UnionType $assign_type, Node $node): UnionType
        {
            static $int_or_string_type = null;
            static $string_array_type = null;
            static $simple_xml_element_type = null;
    Severity: Major
    Found in src/Phan/Analysis/AssignmentVisitor.php - About 2 hrs to fix

      Method normalizeIfStatement has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private static function normalizeIfStatement(Node $original_node): array
          {
              $nodes = [$original_node];
              // Repeatedly apply these rules
              do {
      Severity: Major
      Found in src/Phan/AST/ASTSimplifier.php - About 2 hrs to fix

        Method getAnalyzeFunctionCallClosures has 62 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getAnalyzeFunctionCallClosures(CodeBase $code_base): array
            {
                $warn_remove_debug_call = static function (CodeBase $code_base, Context $context, FunctionInterface $function): void {
                    self::emitIssue(
                        $code_base,
        Severity: Major
        Found in .phan/plugins/RemoveDebugStatementPlugin.php - About 2 hrs to fix

          Method extractGroup has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function extractGroup(): void
              {
                  $pattern = $this->pattern;
                  if ($pattern[$this->offset] === '?') {
                      switch ($pattern[++$this->offset] ?? ':') {
          Severity: Major
          Found in src/Phan/Library/RegexKeyExtractor.php - About 2 hrs to fix

            Method analyzeParameterStrict has 61 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private static function analyzeParameterStrict(CodeBase $code_base, Context $context, FunctionInterface $method, $argument_node, UnionType $argument_type, Variable $alternate_parameter, UnionType $parameter_type, int $lineno, int $i): void
                {
                    if ($alternate_parameter instanceof Parameter && $alternate_parameter->isPassByReference() && $alternate_parameter->getReferenceType() === Parameter::REFERENCE_WRITE_ONLY) {
                        return;
                    }
            Severity: Major
            Found in src/Phan/Analysis/ArgumentType.php - About 2 hrs to fix

              Method analyzeFunctions has 61 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function analyzeFunctions(CodeBase $code_base, array $file_filter = null): void
                  {
                      $plugin_set = ConfigPluginSet::instance();
                      $has_function_or_method_plugins = $plugin_set->hasAnalyzeFunctionPlugins() || $plugin_set->hasAnalyzeMethodPlugins();
                      $show_progress = CLI::shouldShowProgress();
              Severity: Major
              Found in src/Phan/Analysis.php - About 2 hrs to fix

                Function createRestorePoint has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function createRestorePoint(): array
                    {
                        // Create a deep copy of this CodeBase
                        $clone = clone($this);
                        // make a deep copy of the NamespaceMapEntry objects within parsed_namespace_maps
                Severity: Minor
                Found in src/Phan/CodeBase.php - About 2 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 locateMiscellaneousTokenCompletion has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    private static function locateMiscellaneousTokenCompletion(
                        CompletionRequest $request,
                        CodeBase $code_base,
                        Context $context,
                        Node $node,
                Severity: Minor
                Found in src/Phan/LanguageServer/CompletionResolver.php - About 2 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 maybeParsePhanCustomAnnotation has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function maybeParsePhanCustomAnnotation(int $i, string $line, string $type, string $case_sensitive_type): void
                    {
                        switch ($type) {
                            case 'phan-forbid-undeclared-magic-properties':
                                if ($this->checkCompatible('@phan-forbid-undeclared-magic-properties', [Comment::ON_CLASS], $i)) {
                Severity: Minor
                Found in src/Phan/Language/Element/Comment/Builder.php - About 2 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 run has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function run(CodeBase $code_base, Closure $file_path_lister, array $options): ?Request
                    {
                        if (!$code_base->isUndoTrackingEnabled()) {
                            throw new AssertionError("Expected undo tracking to be enabled");
                        }
                Severity: Minor
                Found in src/Phan/LanguageServer/LanguageServer.php - About 2 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 mergeMethodParts has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    private static function mergeMethodParts(array $parts): array
                    {
                        $prev_parts = [];
                        $delta = 0;
                        $results = [];
                Severity: Minor
                Found in src/Phan/Language/Element/Comment/Builder.php - About 2 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 canCastToNonNullableType has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function canCastToNonNullableType(Type $type): bool
                    {
                        if ($type instanceof ArrayType) {
                            if ($type instanceof GenericArrayType) {
                                if (!$this->element_type->canCastToType($type->element_type)) {
                Severity: Minor
                Found in src/Phan/Language/Type/GenericArrayType.php - About 2 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 computeRealElementTypesForDestructuringAccess has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function computeRealElementTypesForDestructuringAccess(array $real_type_set): array
                    {
                        $result = [];
                        foreach ($real_type_set as $type) {
                            if ($type instanceof StringType) {
                Severity: Minor
                Found in src/Phan/Language/UnionType.php - About 2 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 computeRealElementTypesForDimAccess has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function computeRealElementTypesForDimAccess(array $real_type_set): array
                    {
                        $result = [];
                        foreach ($real_type_set as $type) {
                            if ($type instanceof StringType) {
                Severity: Minor
                Found in src/Phan/Language/UnionType.php - About 2 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 applyUnaryBitwiseNotOperatorToList has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    private static function applyUnaryBitwiseNotOperatorToList(array $type_set, bool $is_real): array
                    {
                        if (!$type_set) {
                            // Can be int|string
                            return UnionType::typeSetFromString($is_real ? 'int|string' : 'int');
                Severity: Minor
                Found in src/Phan/Language/UnionType.php - About 2 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 mergeTypeParts has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    private static function mergeTypeParts(array $parts): array
                    {
                        $prev_parts = [];
                        $delta = 0;
                        $results = [];
                Severity: Minor
                Found in src/Phan/Language/UnionType.php - About 2 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 extractNameList has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    private static function extractNameList(string $list_string): array
                    {
                        $results = [];
                        $prev_parts = [];
                        $delta = 0;
                Severity: Minor
                Found in src/Phan/Language/Type.php - About 2 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 getSuggestionsForStringSet has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function getSuggestionsForStringSet(string $target, array $potential_candidates): array
                    {
                        if (count($potential_candidates) === 0) {
                            return [];
                        }
                Severity: Minor
                Found in src/Phan/IssueFixSuggester.php - About 2 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 recursivelyMarkNodesAsPure has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function recursivelyMarkNodesAsPure(): void
                    {
                        // Go through the graph. Any nodes that are impure would either never be added to $this->functions,
                        // or be removed in handleImpureFunction.
                        $reverse_edges = [];
                Severity: Minor
                Found in src/Phan/Plugin/Internal/UseReturnValuePlugin/PureMethodGraph.php - About 2 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