Showing 3,272 of 4,939 total issues

Function astFlagDescription has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function astFlagDescription(int $flags, int $kind): string
    {
        [$exclusive, $combinable] = self::getFlagInfo();
        $flag_names = [];
        if (isset($exclusive[$kind])) {
Severity: Minor
Found in src/Phan/Debug.php - About 55 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 extractArrayArgs has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private static function extractArrayArgs($arg_array_node)
    {
        if (($arg_array_node instanceof Node) && $arg_array_node->kind === \ast\AST_ARRAY) {
            $arguments = [];
            foreach ($arg_array_node->children as $child) {
Severity: Minor
Found in src/Phan/Plugin/Internal/ClosureReturnTypeOverridePlugin.php - About 55 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 sanityCheckErrorList has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private static function sanityCheckErrorList(array $error_list): void
    {
        $error_map = [];
        $unique_type_id_set = [];
        foreach ($error_list as $error) {
Severity: Minor
Found in src/Phan/Issue.php - About 55 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 guessUnionType has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private static function guessUnionType(FunctionInterface $function): UnionType
    {
        if ($function instanceof Method) {
            // convert __set to void, __sleep to string[], etc.
            $union_type = $function->getUnionTypeOfMagicIfKnown();
Severity: Minor
Found in src/Phan/Plugin/Internal/MethodSearcherPlugin.php - About 55 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 visitFor has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function visitFor(Node $node): void
    {
        $cond_list = $node->children['cond'];
        if (!$cond_list instanceof Node) {
            return;
Severity: Minor
Found in src/Phan/Plugin/Internal/RedundantConditionVisitor.php - About 55 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 findVariableReuse has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function findVariableReuse(array $variables): void
    {
        if (!$variables) {
            return;
        }
Severity: Minor
Found in src/Phan/Plugin/Internal/LoopVariableReuseVisitor.php - About 55 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 visitFor has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function visitFor(Node $node): VariableTrackingScope
    {
        $this->checkIsSideEffectFreeLoopNode($node);

        $top_level_statement = $this->top_level_statement;
Severity: Minor
Found in src/Phan/Plugin/Internal/VariableTracker/VariableTrackerVisitor.php - About 55 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 visitExprList has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function visitExprList(Node $node): Context
    {
        $children = $node->children;
        $count = \count($children);
        if ($count > 1) {
Severity: Minor
Found in src/Phan/Analysis/ConditionVisitor.php - About 55 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 getPregMatchUnionType has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getPregMatchUnionType(
        CodeBase $code_base,
        Context $context,
        array $argument_list
    ): UnionType {
Severity: Minor
Found in src/Phan/Analysis/RegexAnalyzer.php - About 55 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 maybeWarnWriteOnlyProperty has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private static function maybeWarnWriteOnlyProperty(CodeBase $code_base, Property $property): void
    {
        if ($property->isWriteOnly()) {
            // Handle annotations such as property-write and phan-write-only
            return;
Severity: Minor
Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php - About 55 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 maybeWarnReadOnlyProperty has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private static function maybeWarnReadOnlyProperty(CodeBase $code_base, Property $property): void
    {
        if ($property->isReadOnly()) {
            // Handle annotations such as property-read and phan-read-only.
            return;
Severity: Minor
Found in src/Phan/Analysis/ReferenceCountsAnalyzer.php - About 55 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 visitExprList has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function visitExprList(Node $node): Context
    {
        $children = $node->children;
        $count = \count($children);
        if ($count > 1) {
Severity: Minor
Found in src/Phan/Analysis/NegatedConditionVisitor.php - About 55 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 handleThisPropertyAssignmentInLocalScopeByName has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function handleThisPropertyAssignmentInLocalScopeByName(Node $node, string $prop_name): void
    {
        if ($this->dim_depth === 0) {
            $new_type = $this->right_type;
        } else {
Severity: Minor
Found in src/Phan/Analysis/AssignmentVisitor.php - About 55 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 maybeWarnProvidingUnusedParameter has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

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

    public function visitCall(Node $node): Context
    {
        $raw_function_name = self::getFunctionName($node);
        if (!\is_string($raw_function_name)) {
            return $this->context;
Severity: Minor
Found in src/Phan/Analysis/NegatedConditionVisitor.php - About 55 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 visitConditional has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function visitConditional(Node $node): ?bool
    {
        $cond = $node->children['cond'];
        if ($cond instanceof Node) {
            $result = $this->__invoke($cond);
Severity: Minor
Found in src/Phan/Analysis/ReachabilityChecker.php - About 55 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 shouldSkipNestedAssignDim has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private static function shouldSkipNestedAssignDim(array $parent_node_list): bool
    {
        $cur_parent_node = \end($parent_node_list);
        for (;; $cur_parent_node = $prev_parent_node) {
            $prev_parent_node = \prev($parent_node_list);
Severity: Minor
Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 55 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 visitContinue has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function visitContinue(Node $node): Context
    {
        $nodes = $this->parent_node_list;
        $depth = $node->children['depth'] ?? 1;
        if (!\is_int($depth)) {
Severity: Minor
Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 55 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 computeStatusOfBlock has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function computeStatusOfBlock(array $block): int
    {
        $maybe_status = 0;
        foreach ($block as $child) {
            if ($child === null) {
Severity: Minor
Found in src/Phan/Analysis/BlockExitStatusChecker.php - About 55 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 visitClassConstDecl has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function visitClassConstDecl(Node $node): Context
    {
        $class = $this->context->getClassInScope($this->code_base);

        foreach ($node->children as $child_node) {
Severity: Minor
Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 55 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