jaroslavtyc/drd-plus-rolls-on

View on GitHub

Showing 105 of 105 total issues

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

    private function createRoller2d6DrdPlus($rollValue = false)
Severity: Minor
Found in tests/RollsOn/RollsOnFactoryTest.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 '52', column '39').
Open

        $basePropertyNamespace = (new \ReflectionClass(BaseProperty::class))->getNamespaceName();

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 createRoll has a boolean flag argument $rollValue, which is a certain sign of a Single Responsibility Principle violation.
Open

    private function createRoll($rollValue = false)
Severity: Minor
Found in tests/RollsOn/RollsOnFactoryTest.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 '52', column '39').
Open

        $basePropertyNamespace = (new \ReflectionClass(BaseProperty::class))->getNamespaceName();

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 createBasicRollOnSuccess has a boolean flag argument $isSuccess, which is a certain sign of a Single Responsibility Principle violation.
Open

    private function createBasicRollOnSuccess($difficulty, RollOnQuality $rollOnQuality, $isSuccess = false, $resultValue = 'foo')

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 '24', column '48').
Open

        $extendedRollOnSuccessReflection = new \ReflectionClass(ExtendedRollOnSuccess::class);

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 '57', column '42').
Open

        $derivedPropertyNamespace = (new \ReflectionClass(DerivedProperty::class))->getNamespaceName();

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 createSimpleRollOnSuccess has a boolean flag argument $isSuccess, which is a certain sign of a Single Responsibility Principle violation.
Open

    private function createSimpleRollOnSuccess($difficulty, RollOnQuality $rollOnQuality, $isSuccess = false, $resultValue = 'foo')

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

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

            $roller = $this->createRoller($roll = $this->createRoll($rollValue = 456))
Severity: Minor
Found in tests/RollsOn/RollsOnFactoryTest.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 '\Granam\Integer\Tools\ToInteger' in method '__construct'.
Open

        $this->fightNumber = ToInteger::toInteger($fightNumber);
Severity: Minor
Found in src/Situations/RollOnFight.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 '\DrdPlus\RollsOn\QualityAndSuccess\ComparisonOfRollsOnSuccess' in method 'I_can_use_it'.
Open

            ComparisonOfRollsOnSuccess::compare($compareThat, $withThat)

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 unused local variables such as '$rollOnQuality'.
Open

        self::assertInstanceOf(RollOnQuality::class, $rollOnQuality = $malusRollOnWill->getRollOnQuality());
Severity: Minor
Found in tests/RollsOn/RollsOnFactoryTest.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 '\Granam\Scalar\Tools\ToScalar' in method '__construct'.
Open

        $this->failureValue = ToScalar::toScalar($failureValue);

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

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

        } else {
            self::assertTrue($extendedRollOnSuccess->isFailure());
            self::assertFalse($extendedRollOnSuccess->isSuccess());
        }

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 '$roller'.
Open

        $rollsOn = new RollsOnFactory($roller = $this->createRoller2d6DrdPlus($rollValue = 123));
Severity: Minor
Found in tests/RollsOn/RollsOnFactoryTest.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 '\DrdPlus\BaseProperties\Will' in method 'I_can_make_malus_roll_on_will'.
Open

        $malusRollOnWill = $rollsOnFactory->makeMalusRollOnWill(Will::getIt($willValue));
Severity: Minor
Found in tests/RollsOn/RollsOnFactoryTest.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 unused parameters such as '$firstSimpleRollOnSuccess'.
Open

        SimpleRollOnSuccess $firstSimpleRollOnSuccess,

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

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

Avoid unused parameters such as '$thirdSimpleRollOnSuccess'.
Open

        SimpleRollOnSuccess $thirdSimpleRollOnSuccess = null

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

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

Avoid using static access to class '\DrdPlus\RollsOn\QualityAndSuccess\ComparisonOfRollsOnQuality' in method 'I_can_use_it'.
Open

        self::assertSame($firstIsLesser, ComparisonOfRollsOnQuality::isLesser($compareThat, $withThat));

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 '\DrdPlus\RollsOn\QualityAndSuccess\ComparisonOfRollsOnQuality' in method 'I_can_use_it'.
Open

            ComparisonOfRollsOnQuality::isEqual($compareThat, $withThat)

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