src/Phan/IssueInstance.php

Summary

Maintainability
A
1 hr
Test Coverage

The method IssueInstance::__construct() calls the typical debug function debug_print_backtrace() which is mostly only used during development.
Open

            \debug_print_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS);
Severity: Minor
Found in src/Phan/IssueInstance.php by phpmd

DevelopmentCodeFragment

Since: 2.3.0

Functions like vardump(), printr() etc. are normally only used during development and therefore such calls in production code are a good indicator that they were just forgotten.

Example

class SuspectCode {

    public function doSomething(array $items)
    {
        foreach ($items as $i => $item) {
            // …

            if ('qafoo' == $item) var_dump($i);

            // …
        }
    }
}

Source https://phpmd.org/rules/design.html#developmentcodefragment

Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        Issue $issue,
        string $file,
        int $line,
        array $template_parameters,
        Suggestion $suggestion = null,
Severity: Minor
Found in src/Phan/IssueInstance.php - About 45 mins to fix

    Function normalizeTemplateParameters has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        private static function normalizeTemplateParameters(array $template_parameters): array
        {
            foreach ($template_parameters as $i => $parameter) {
                if ($parameter instanceof UnionType) {
                    $parameter = $parameter->__toString();
    Severity: Minor
    Found in src/Phan/IssueInstance.php - About 25 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

    There are no issues that match your filters.

    Category
    Status