Showing 264 of 264 total issues

The closing brace for the class must go on the next line after the body
Open

}

Missing class import via use statement (line '137', column '22').
Open

        $class = new \ReflectionClass(\get_class($flow));
Severity: Minor
Found in tests/Flow/Directives/MinifyTest.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

Remove error control operator '@' on line 57.
Open

    protected function path($code)
    {
        $this->lastView = $view = 'flow__' . Str::random();
        $tmp = \sys_get_temp_dir() . '/' . $this->lastView . $this->flow->ext();
        File::put($tmp, $code);
Severity: Minor
Found in tests/Unit.php by phpmd

ErrorControlOperator

Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

Example

function foo($filePath) {
    $file = @fopen($filPath); // hides exceptions
    $key = @$array[$notExistingKey]; // assigns null to $key
}

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

Remove error control operator '@' on line 58.
Open

    protected function path($code)
    {
        $this->lastView = $view = 'flow__' . Str::random();
        $tmp = \sys_get_temp_dir() . '/' . $this->lastView . $this->flow->ext();
        File::put($tmp, $code);
Severity: Minor
Found in tests/Unit.php by phpmd

ErrorControlOperator

Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

Example

function foo($filePath) {
    $file = @fopen($filPath); // hides exceptions
    $key = @$array[$notExistingKey]; // assigns null to $key
}

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

Remove error control operator '@' on line 59.
Open

    protected function path($code)
    {
        $this->lastView = $view = 'flow__' . Str::random();
        $tmp = \sys_get_temp_dir() . '/' . $this->lastView . $this->flow->ext();
        File::put($tmp, $code);
Severity: Minor
Found in tests/Unit.php by phpmd

ErrorControlOperator

Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

Example

function foo($filePath) {
    $file = @fopen($filPath); // hides exceptions
    $key = @$array[$notExistingKey]; // assigns null to $key
}

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

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

        $class = new \ReflectionClass(\get_class($flow));
Severity: Minor
Found in tests/Flow/Directives/MinifyTest.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 '51', column '22').
Open

        $class = new \ReflectionClass(\get_class($flow));
Severity: Minor
Found in tests/Flow/Directives/MinifyTest.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 printers has a boolean flag argument $escape, which is a certain sign of a Single Responsibility Principle violation.
Open

    protected function printers(array $rows, $escape = true)
Severity: Minor
Found in src/Flow/Flow.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 '87', column '22').
Open

        $class = new \ReflectionClass(\get_class($flow));
Severity: Minor
Found in tests/Flow/Directives/MinifyTest.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

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

    protected function loader($file)
    {
        foreach ($this->folders as $folder)
        {
            foreach (FileLoader::extensions() as $ext)
Severity: Minor
Found in src/Flow/Lexeme.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

Avoid using static access to class '\Bavix\Helpers\File' in method 'has'.
Open

        if (empty($this->paths[$view]) && ($this->flow->debugMode() || !File::exists($path)))
Severity: Minor
Found in src/Flow/FileSystem.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

Avoid using static access to class 'Bavix\Flow\Property' in method '__construct'.
Open

        $this->constructs = Property::get('constructs');
Severity: Minor
Found in src/Flow/Flow.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

Avoid using static access to class '\Bavix\Helpers\Arr' in method 'endDirective'.
Open

        if (Arr::pop(static::$for) === static::T_ELSE)
Severity: Minor
Found in src/Flow/Directives/ForDirective.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

Avoid using static access to class '\Bavix\Helpers\Str' in method 'randVariable'.
Open

        return '$_' . Str::random(16);
Severity: Minor
Found in src/Flow/Directive.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

Avoid using static access to class 'Bavix\Flow\Directives\ForDirective' in method 'render'.
Open

        ForDirective::else();

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

Avoid using static access to class '\Bavix\Helpers\Arr' in method 'pop'.
Open

            Arr::pop(static::$storage);
Severity: Minor
Found in src/Flow/Directives/WithDirective.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

Avoid using static access to class '\Bavix\Helpers\Arr' in method 'fragment'.
Open

        $data = Arr::map($tokens['tokens'] ?? $tokens, function (Token $token) {
            return $token->token;
        });
Severity: Minor
Found in src/Flow/Flow.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

Avoid using static access to class '\Bavix\Helpers\Arr' in method 'render'.
Open

        Arr::push(static::$for, static::T_END);
Severity: Minor
Found in src/Flow/Directives/ForDirective.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

Avoid using static access to class 'Bavix\Flow\Cache' in method '__construct'.
Open

        Cache::setPool($options['cache'] ?? null);
Severity: Minor
Found in src/Flow/Flow.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

Avoid using static access to class '\Bavix\Helpers\Dir' in method 'has'.
Open

            Dir::make($directory);
Severity: Minor
Found in src/Flow/FileSystem.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