octolab/Cleaner

View on GitHub

Showing 27 of 27 total issues

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

                } else {
                    $this->io->write('<comment>--- nothing found</comment>');
                }
Severity: Minor
Found in src/Util/FakeCleaner.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 private methods such as 'optimized'.
Open

    private function optimized(array $patterns)
    {
        $files = array();
        $before = getcwd();
        chdir($cwd = $this->current);
Severity: Minor
Found in src/Util/GlobFinder.php by phpmd

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

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

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

        } else {
            $packages = $repo->getPackages();
        }
Severity: Minor
Found in src/Command/ClearCommand.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 clear uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $this->io->write('<comment>- there is nothing to clear</comment>', true);
        }
Severity: Minor
Found in src/Util/FakeCleaner.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 handlePackageEvent uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            return;
        }
Severity: Minor
Found in src/Plugin.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

Line exceeds 120 characters; contains 151 characters
Open

            //->addOption('debug', null, InputOption::VALUE_OPTIONAL, 'Debug mode - only display files which would be deleted, but do not delete them')
Severity: Minor
Found in src/Command/ClearCommand.php by phpcodesniffer

Expected 1 space after IF keyword; 0 found
Open

            if(!$matched) {
Severity: Minor
Found in src/Plugin.php by phpcodesniffer
Severity
Category
Status
Source
Language