Showing 288 of 288 total issues

Missing class import via use statement (line '195', column '23').
Open

            throw new \Error('Too many method arguments');
Severity: Minor
Found in src/Factory.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '36', column '35').
Open

                $methodRefl = new \ReflectionMethod($class, $name);
Severity: Minor
Found in src/DynamicMethodTrait.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '46', column '40').
Open

        $traceReflectionProperty = new \ReflectionProperty(parent::class, 'trace');
Severity: Minor
Found in src/Exception.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '185', column '31').
Open

                    throw new \TypeError('New $this must be an object');
Severity: Minor
Found in src/HookTrait.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '171', column '37').
Open

            $getFxThisFxThis = (new \ReflectionFunction($getFxThisFx))->getClosureThis();
Severity: Minor
Found in src/HookTrait.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

The method removeHook has a boolean flag argument $priorityIsIndex, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function removeHook(string $spot, ?int $priority = null, bool $priorityIsIndex = false)
Severity: Minor
Found in src/HookTrait.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

Missing class import via use statement (line '72', column '38').
Open

            $providerClassRefl = new \ReflectionClass(self::isPhpunit9x() ? $metadataDataProvider[0] : $metadataDataProvider->className());
Severity: Minor
Found in src/Phpunit/TestCase.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '21', column '27').
Open

                throw new \Error('Cannot access protected property ' . $class . '::$' . $name);
Severity: Minor
Found in src/WarnDynamicPropertyTrait.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Avoid too many return statements within this method.
Open

        return $out;
Severity: Major
Found in src/ExceptionRenderer/RendererAbstract.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

        return isset($this->hooks[$spot][$priority]);
Severity: Major
Found in src/HookTrait.php - About 30 mins to fix

Missing class import via use statement (line '47', column '21').
Open

        return (new \ReflectionClass(self::class))->hasMethod('getStatus');
Severity: Minor
Found in src/Phpunit/TestCase.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

The method addTo has a boolean flag argument $skipAdd, which is a certain sign of a Single Responsibility Principle violation.
Open

    public static function addTo(object $parent, array $defaults = [], array $addArgs = [], bool $skipAdd = false)// :static supported by PHP8+
Severity: Minor
Found in src/StaticAddToTrait.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

Missing class import via use statement (line '238', column '37').
Open

        $loaderFile = realpath((new \ReflectionClass(ClassLoader::class))->getFileName());

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '173', column '27').
Open

                throw new \TypeError('New $this getter must be static');
Severity: Minor
Found in src/HookTrait.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

The method hookHasCallbacks has a boolean flag argument $priorityIsIndex, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function hookHasCallbacks(string $spot, ?int $priority = null, bool $priorityIsIndex = false): bool
Severity: Minor
Found in src/HookTrait.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

Missing class import via use statement (line '157', column '40').
Open

        $traceReflectionProperty = new \ReflectionProperty($e instanceof \Exception ? \Exception::class : \Error::class, 'trace');
Severity: Minor
Found in src/Phpunit/TestCase.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

The method processStackTraceInternal uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                if ($escapeFrame) {
                    $tokens['{FUNCTION_ARGS}'] = "\e[0;31m(" . \PHP_EOL . str_repeat(' ', 40) . implode(',' . \PHP_EOL . str_repeat(' ', 40), array_map(static function ($arg) {
                        return static::toSafeString($arg);
                    }, $call['args'])) . ')';
Severity: Minor
Found in src/ExceptionRenderer/Console.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method processStackTraceInternal uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                if ($escapeFrame) {
                    $tokens['{FUNCTION_ARGS}'] = '(<br>' . implode(',<br>', array_map(function ($arg) {
                        return $this->encodeHtml(static::toSafeString($arg, false, 1));
                    }, $call['args'])) . ')';
Severity: Minor
Found in src/ExceptionRenderer/Html.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

Avoid unused local variables such as '$index'.
Open

        foreach ($trace as $index => $call) {
Severity: Minor
Found in src/ExceptionRenderer/Json.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid using static access to class 'Atk4\Core\TraitUtil' in method '_mergeSeeds'.
Open

            if (!TraitUtil::hasDiContainerTrait($obj)) {
Severity: Minor
Found in src/Factory.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Severity
Category
Status
Source
Language