Showing 3,272 of 4,939 total issues

Method createPassByReferenceArgumentInCall has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function createPassByReferenceArgumentInCall(FunctionInterface $method, Node $argument, Parameter $parameter, ?Parameter $real_parameter): void
    {
        if ($argument->kind === ast\AST_VAR) {
            // We don't do anything with the new variable; just create it
            // if it doesn't exist
Severity: Minor
Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

    Method visitStaticCall has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function visitStaticCall(Node $node): void
        {
            $method = $node->children['method'];
            if (!\is_string($method)) {
                throw new NodeException($node);
    Severity: Minor
    Found in src/Phan/AST/InferPureVisitor.php - About 1 hr to fix

      Method lookupClassOfCallableByName has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function lookupClassOfCallableByName(string $class_name): ?FullyQualifiedClassName
          {
              switch (\strtolower($class_name)) {
                  case 'self':
                  case 'static':
      Severity: Minor
      Found in src/Phan/AST/UnionTypeVisitor.php - About 1 hr to fix

        Method validateTranslations has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected static function validateTranslations(CodeBase $code_base, Context $context, string $fmt_str, array $types_of_arg): void
            {
                $translations = static::gettextForAllLocales($fmt_str);
                foreach ($translations as $locale => $translated_fmt_str) {
                    // Skip untranslated or equal strings.
        Severity: Minor
        Found in .phan/plugins/PrintfCheckerPlugin.php - About 1 hr to fix

          Method checkIsRedundantReturn has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private static function checkIsRedundantReturn(CodeBase $code_base, FunctionInterface $method, string $doc_comment): void
              {
                  if (strpos($doc_comment, '@return') === false) {
                      return;
                  }
          Severity: Minor
          Found in .phan/plugins/PHPDocRedundantPlugin.php - About 1 hr to fix

            Function importAncestorClasses has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                public function importAncestorClasses(CodeBase $code_base): void
                {
                    if (!$this->isFirstExecution(__METHOD__)) {
                        return;
                    }
            Severity: Minor
            Found in src/Phan/Language/Element/Clazz.php - About 1 hr 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 trimLeadingWhitespace has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                private static function trimLeadingWhitespace(array $lines): array
                {
                    if (count($lines) === 0) {
                        return [];
                    }
            Severity: Minor
            Found in src/Phan/Language/Element/MarkupDescription.php - About 1 hr 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 isAccessibleFromClass has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                public function isAccessibleFromClass(CodeBase $code_base, ?FullyQualifiedClassName $accessing_class_fqsen): bool
                {
                    if ($this->isPublic()) {
                        return true;
                    }
            Severity: Minor
            Found in src/Phan/Language/Element/ClassElement.php - About 1 hr 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 make has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function make(
                    string $namespace,
                    string $name,
                    int $alternate_id = 0
                ) {
            Severity: Minor
            Found in src/Phan/Language/FQSEN/FullyQualifiedGlobalStructuralElement.php - About 1 hr 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 combineArrayShapeTypes has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                private static function combineArrayShapeTypes(array $types, bool $add_mixed): ArrayShapeType
                {
                    $is_nullable = false;
                    $field_types_list = [];
                    $common_field_types = [];
            Severity: Minor
            Found in src/Phan/Language/UnionType.php - About 1 hr 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 canCastToDeclaredType has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                public function canCastToDeclaredType(CodeBase $code_base, Context $context, Type $type): bool
                {
                    if ($type instanceof ScalarType) {
                        switch ($type::NAME) {
                            case 'string':
            Severity: Minor
            Found in src/Phan/Language/Type/LiteralStringType.php - About 1 hr 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 checkUnreachableCatch has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                private function checkUnreachableCatch(array $catch_nodes, Context $context): void
                {
                    if (count($catch_nodes) <= 1) {
                        return;
                    }
            Severity: Minor
            Found in src/Phan/BlockAnalysisVisitor.php - About 1 hr 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 normalizeScalarImplicitPartial has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                private static function normalizeScalarImplicitPartial($value): array
                {
                    if (!is_array($value)) {
                        return [];
                    }
            Severity: Minor
            Found in src/Phan/Config.php - About 1 hr 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 warnAboutCouldBeConstant has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                private function warnAboutCouldBeConstant(VariableGraph $graph, string $variable_name, int $definition_id, $value_node): void
                {
                    $issue_type = Issue::VariableDefinitionCouldBeConstant;
                    if ($value_node instanceof Node) {
                        if ($value_node->kind === ast\AST_ARRAY) {
            Severity: Minor
            Found in src/Phan/Plugin/Internal/VariableTrackerPlugin.php - About 1 hr 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 visitFuncDecl has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                public function visitFuncDecl(Node $node): Context
                {
                    $function_name = (string)$node->children['name'];
                    $code_base = $this->code_base;
                    $original_context = $this->context;
            Severity: Minor
            Found in src/Phan/Analysis/PreOrderAnalysisVisitor.php - About 1 hr 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 addDefaultPropertiesOfThisToContext has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                private function addDefaultPropertiesOfThisToContext(Clazz $class, Context $context): void
                {
                    $property_types = [];
                    foreach ($class->getPropertyMap($this->code_base) as $property) {
                        if ($property->isDynamicOrFromPHPDoc()) {
            Severity: Minor
            Found in src/Phan/Analysis/PreOrderAnalysisVisitor.php - About 1 hr 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 visitMethod has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                public function visitMethod(Node $node): Context
                {
                    $method_name = (string)$node->children['name'];
                    $code_base = $this->code_base;
                    $context = $this->context;
            Severity: Minor
            Found in src/Phan/Analysis/PreOrderAnalysisVisitor.php - About 1 hr 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 analyzeRemainingParametersForVariadic has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                private static function analyzeRemainingParametersForVariadic(
                    CodeBase $code_base,
                    Context $context,
                    FunctionInterface $method,
                    int $start_index,
            Severity: Minor
            Found in src/Phan/Analysis/ArgumentType.php - About 1 hr 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 addConstant has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function addConstant(
                    CodeBase $code_base,
                    Context $context,
                    int $lineno,
                    string $name,
            Severity: Minor
            Found in src/Phan/Parse/ParseVisitor.php - About 1 hr 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 tryToAssignPHPDocTypeToParameter has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                private static function tryToAssignPHPDocTypeToParameter(
                    CodeBase $code_base,
                    FunctionInterface $method,
                    int $i,
                    Parameter $parameter,
            Severity: Minor
            Found in src/Phan/Analysis/ParameterTypesAnalyzer.php - About 1 hr 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