Showing 4,939 of 4,939 total issues

Function withTemplateParameterTypeMap has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function withTemplateParameterTypeMap(
        array $template_parameter_type_map
    ): UnionType {
        $has_template = false;
        $concrete_type_list = [];
Severity: Minor
Found in src/Phan/Language/UnionType.php - About 35 mins 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 toNonTruthyTypeSet has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function toNonTruthyTypeSet(array $type_set): array
    {
        $result = [];
        foreach ($type_set as $type) {
            if (!$type->isPossiblyTruthy()) {
Severity: Minor
Found in src/Phan/Language/UnionType.php - About 35 mins 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 nonTrueClone has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function nonTrueClone(): UnionType
    {
        $builder = new UnionTypeBuilder();
        $did_change = false;
        foreach ($this->type_set as $type) {
Severity: Minor
Found in src/Phan/Language/UnionType.php - About 35 mins 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 computeRealTypeSetForArrayShapeTypeWithField has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function computeRealTypeSetForArrayShapeTypeWithField(UnionType $left, $field_dim_value, UnionType $field_type): array
    {
        $has_non_array_shape = false;
        foreach ($left->getRealTypeSet() as $type) {
            if (!$type instanceof ArrayType || $type->isNullable()) {
Severity: Minor
Found in src/Phan/Language/Type/ArrayType.php - About 35 mins 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 replaceWithTemplateTypes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function replaceWithTemplateTypes(UnionType $template_union_type): UnionType
    {
        if ($template_union_type->isEmpty()) {
            return $this;
        }
Severity: Minor
Found in src/Phan/Language/UnionType.php - About 35 mins 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 isSubtypeOfNonNullableType has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function isSubtypeOfNonNullableType(Type $type): bool
    {
        if ($type instanceof ScalarType) {
            if ($type instanceof StringType) {
                if ($type instanceof LiteralStringType) {
Severity: Minor
Found in src/Phan/Language/Type/LiteralStringType.php - About 35 mins 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 getDifferingVariables has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getDifferingVariables(array $scope_list): array
    {
        if (count($scope_list) < 2) {
            return [];
        }
Severity: Minor
Found in src/Phan/Language/Scope.php - About 35 mins 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 isExclusivelyNarrowedFormOrEquivalentTo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function isExclusivelyNarrowedFormOrEquivalentTo(
        UnionType $union_type,
        Context $context,
        CodeBase $code_base
    ): bool {
Severity: Minor
Found in src/Phan/Language/Type.php - About 35 mins 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 getKnownClasses has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function getKnownClasses(): array
    {
        static $known_classes = null;
        if (!is_array($known_classes)) {
            $known_classes = MarkupDescription::loadClassDescriptionMap();
Severity: Minor
Found in src/Phan/IssueFixSuggester.php - About 35 mins 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 preAnalyzeIfElemCondition has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function preAnalyzeIfElemCondition(Node $if_elem_node, Context $fallthrough_context): array
    {
        $condition_node = $if_elem_node->children['cond'];
        if ($condition_node instanceof Node) {
            if ($condition_node->kind === ast\AST_BINARY_OP) {
Severity: Minor
Found in src/Phan/BlockAnalysisVisitor.php - About 35 mins 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 suggestSimilarClassConstant has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function suggestSimilarClassConstant(CodeBase $code_base, Context $context, FullyQualifiedClassConstantName $class_constant_fqsen): ?Suggestion
    {
        if (Config::getValue('disable_suggestions')) {
            return null;
        }
Severity: Minor
Found in src/Phan/IssueFixSuggester.php - About 35 mins 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 handleScalarStmt has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function handleScalarStmt(Node $node, Context $context, $child_node): void
    {
        if (\is_string($child_node)) {
            $consumed = false;
            if (\strpos($child_node, '@phan-') !== false) {
Severity: Minor
Found in src/Phan/BlockAnalysisVisitor.php - About 35 mins 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 visitTry has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function visitTry(Node $node): Context
    {
        $context = $this->context->withLineNumberStart(
            $node->lineno
        );
Severity: Minor
Found in src/Phan/BlockAnalysisVisitor.php - About 35 mins 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 getNextTypeId has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function getNextTypeId(array $issue_list, int $invalid_type_id): int
    {
        for ($id = $invalid_type_id + 1; true; $id++) {
            foreach ($issue_list as $error) {
                if ($error->getTypeId() === $id) {
Severity: Minor
Found in src/Phan/Issue.php - About 35 mins 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 generateClosureForFunctionInterface has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function generateClosureForFunctionInterface(FunctionInterface $function): ?Closure
    {
        $callable_params = [];
        $class_params = [];
        foreach ($function->getParameterList() as $i => $param) {
Severity: Minor
Found in src/Phan/Plugin/Internal/CallableParamPlugin.php - About 35 mins 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 isVoidFunction has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function isVoidFunction(FunctionInterface $function): bool
    {
        if ($function->getUnionType()->isNull()) {
            return true;
        }
Severity: Minor
Found in src/Phan/Plugin/Internal/UseReturnValuePlugin/PureMethodGraph.php - About 35 mins 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 getAbsolutePath has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function getAbsolutePath(Node $node, string $relative_path): string
    {
        if (Paths::isAbsolutePath($relative_path)) {
            return $relative_path;
        }
Severity: Minor
Found in src/Phan/Plugin/Internal/RequireExistsPlugin.php - About 35 mins 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 computeClosestTargetPHPVersionId has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function computeClosestTargetPHPVersionId(string $version): int
    {
        if (\version_compare($version, '6.0') < 0) {
            return 50600;
        } elseif (\version_compare($version, '7.1') < 0) {
Severity: Minor
Found in src/Phan/Config.php - About 35 mins 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 isCastableButNotSubtype has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function isCastableButNotSubtype(UnionType $actual_type, Type $inner_type): bool
    {
        if ($inner_type instanceof ObjectType) {
            foreach ($actual_type->getTypeSet() as $type) {
                if ($type->isPossiblyObject() && !$type->isObjectWithKnownFQSEN()) {
Severity: Minor
Found in src/Phan/Plugin/Internal/MethodSearcherPlugin.php - About 35 mins 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 analyzeArrayAssignmentTarget has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function analyzeArrayAssignmentTarget(Node $node, $const_expr): VariableTrackingScope
    {
        foreach ($node->children as $elem_node) {
            if (!($elem_node instanceof Node)) {
                continue;
Severity: Minor
Found in src/Phan/Plugin/Internal/VariableTracker/VariableTrackerVisitor.php - About 35 mins 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