Showing 3,272 of 4,939 total issues

Function adaptInheritedMethodFromTrait has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function adaptInheritedMethodFromTrait(Method $method): Method
    {
        $method_flags = $method->getFlags();
        if (Flags::bitVectorHasState($method_flags, \ast\flags\MODIFIER_PRIVATE)) {
            $method = $method->createUseAlias($this, $method->getName(), \ast\flags\MODIFIER_PRIVATE);
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 makeIfLoaded has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public static function makeIfLoaded(string $namespace, string $name)
    {
        $name_parts = \explode('\\', $name);
        $name = (string)\array_pop($name_parts);
        if ($name === '') {
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 canCastToAnyTypeInSet has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function canCastToAnyTypeInSet(array $target_type_set): bool
    {
        $element_union_types = null;
        foreach ($target_type_set as $target_type) {
            if ($target_type instanceof GenericArrayType) {
Severity: Minor
Found in src/Phan/Language/Type/ArrayShapeType.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 iterableValueUnionType has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function iterableValueUnionType(CodeBase $code_base): UnionType
    {
        // This is frequently called, and has been optimized
        // TODO: Support real types if the type set is exclusively real iterable types
        $builder = new UnionTypeBuilder();
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 asScalarValues has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function asScalarValues(bool $strict = false): ?array
    {
        $result = [];
        $has_null = false;
        $has_false = false;
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 canCastToNonNullableTypeWithoutConfig has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    protected function canCastToNonNullableTypeWithoutConfig(Type $type): bool
    {
        // can't cast native types (includes iterable or array) to object. ObjectType overrides this function.
        if ($type instanceof ObjectType
            && !$this->isNativeType()
Severity: Minor
Found in src/Phan/Language/Type.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 canCastToType has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function canCastToType(Type $type): bool
    {
        // Check to see if we have an exact object match
        if ($this === $type) {
            return true;
Severity: Minor
Found in src/Phan/Language/Type.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 canCastToNonNullableType has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    protected function canCastToNonNullableType(Type $type): bool
    {
        // can't cast native types (includes iterable or array) to object. ObjectType overrides this function.
        if ($type instanceof ObjectType
            && !$this->isNativeType()
Severity: Minor
Found in src/Phan/Language/Type.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 typeStringComponentsInner has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private static function typeStringComponentsInner(
        string $type_string
    ): Tuple5 {
        // Check to see if we have template parameter types
        $template_parameter_type_name_list = [];
Severity: Minor
Found in src/Phan/Language/Type.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 findNonUnaryParentNode has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function findNonUnaryParentNode(Node $node): array
    {
        $parent = \end($this->parent_node_list);
        if (!$parent) {
            return [null, true];

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 dumpFileDot has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function dumpFileDot(string $title, array $graph = null): void
    {
        if (!$graph) {
            $graph = $this->fgraph;
        }
Severity: Minor
Found in src/Phan/Plugin/Internal/DependencyGraphPlugin.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 addMissingNamespaces has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public static function addMissingNamespaces(CodeBase $code_base, UnionType $union_type): UnionType
    {
        foreach ($union_type->getTypeSet() as $type) {
            if ($type->isObjectWithKnownFQSEN()) {
                $replacements = self::getReplacementTypesForFullyQualifiedClassName($code_base, $type);
Severity: Minor
Found in src/Phan/Plugin/Internal/MethodSearcherPlugin.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 mergeBranchScopeList has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function mergeBranchScopeList(
        array $branch_scopes,
        bool $merge_parent_scope,
        array $inner_exiting_scope_list
    ): VariableTrackingScope {
Severity: Minor
Found in src/Phan/Plugin/Internal/VariableTracker/VariableTrackingScope.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 visitPropGroup has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function visitPropGroup(Node $node): Context
    {
        // Bomb out if we're not in a class context
        ['props' => $props_node, 'type' => $type_node] = $node->children;
        if (!$props_node instanceof Node) {
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 addTypesToPropertyStandalone has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public static function addTypesToPropertyStandalone(
        CodeBase $code_base,
        Context $context,
        Property $property,
        UnionType $new_types
Severity: Minor
Found in src/Phan/Analysis/AssignmentVisitor.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 visitArrowFunc has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function visitArrowFunc(Node $node): Context
    {
        $code_base = $this->code_base;
        $context = $this->context->withoutLoops();
        $closure_fqsen = FullyQualifiedFunctionName::fromClosureInContext(
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 checkNonAncestorConstructCall has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function checkNonAncestorConstructCall(
        Node $node,
        string $static_class,
        string $method_name
    ): void {
Severity: Minor
Found in src/Phan/Analysis/PostOrderAnalysisVisitor.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 checkErrorProneTruthyCast has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function checkErrorProneTruthyCast(Node $node, Context $context, UnionType $union_type): void
    {
        // Here, we only perform the redundant condition checks on whichever ran first, to avoid warning about both impossible and redundant conditions
        if (isset($node->did_check_error_prone_truthy)) {
            return;
Severity: Minor
Found in src/Phan/Analysis/ConditionVisitorUtil.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 analyzeUnsetDim has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function analyzeUnsetDim(Node $node): void
    {
        $expr_node = $node->children['expr'];
        if (!($expr_node instanceof Node)) {
            // php -l would warn
Severity: Minor
Found in src/Phan/Analysis/PostOrderAnalysisVisitor.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 phpParserExprListToExprList has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private static function phpParserExprListToExprList(PhpParser\Node\DelimitedList\ExpressionList $expressions_list, int $lineno): ast\Node
    {
        $children = [];
        $expressions_children = $expressions_list->children;
        foreach ($expressions_children as $expr) {
Severity: Minor
Found in src/Phan/AST/TolerantASTConverter/TolerantASTConverter.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