jaroslavtyc/drd-plus-stamina

View on GitHub

Showing 88 of 88 total issues

Avoid using static access to class '\DrdPlus\Stamina\Fatigue' in method 'I_can_not_use_negative_value'.
Open

        $fatigue = Fatigue::getIt(0);
Severity: Minor
Found in tests/Stamina/FatigueTest.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\Calculations\SumAndRound' in method 'calculateFilledHalfRowsFor'.
Open

            $halves = [SumAndRound::ceiledHalf($fatiguePerRowMaximum), SumAndRound::flooredHalf($fatiguePerRowMaximum)];
Severity: Minor
Found in Stamina/GridOfFatigue.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 '\Granam\Tools\ValueDescriber' in method 'convertToEnumFinalValue'.
Open

                'Malus can be between 0 and ' . self::MOST . ', got ' . ValueDescriber::describe($enumValue)
Severity: Minor
Found in Stamina/MalusFromFatigue.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\Stamina\MalusFromFatigue' in method 'resolveMalusAfterRest'.
Open

            $this->malusFromFatigue = MalusFromFatigue::getIt(0); // pain is gone and being feel it - lets remove the malus
Severity: Minor
Found in Stamina/Stamina.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\Calculations\SumAndRound' in method 'calculateFilledHalfRowsFor'.
Open

            $filledHalfRows = SumAndRound::floor($fatigueValue / ($fatiguePerRowMaximum / 2));
Severity: Minor
Found in Stamina/GridOfFatigue.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\Stamina\MalusFromFatigue' in method 'I_can_use_it'.
Open

        $malusFromFatigue = MalusFromFatigue::getIt(-2);

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\Stamina\ReasonToRollAgainstMalusFromFatigue' in method 'resolveMalusAfterFatigue'.
Open

            $this->reasonToRollAgainstMalusFromFatigue = ReasonToRollAgainstMalusFromFatigue::getFatigueReason();
Severity: Minor
Found in Stamina/Stamina.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\Stamina\Fatigue' in method 'I_can_use_it_as_an_integer'.
Open

        $fatigue = Fatigue::getIt(123);
Severity: Minor
Found in tests/Stamina/FatigueTest.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\Stamina\MalusFromFatigue' in method 'I_can_not_create_positive_malus'.
Open

        MalusFromFatigue::getIt(1);

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\Stamina\MalusFromFatigue' in method 'resolveMalusAfterFatigue'.
Open

            $this->malusFromFatigue = MalusFromFatigue::getIt(0);
Severity: Minor
Found in Stamina/Stamina.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\Stamina\ReasonToRollAgainstMalusFromFatigue' in method 'I_can_not_create_unknown_reason'.
Open

        ReasonToRollAgainstMalusFromFatigue::getEnum('bored');

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 calculateFilledHalfRowsFor uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            // first half round up, second down (for example 11 = 6 + 5)
            $halves = [SumAndRound::ceiledHalf($fatiguePerRowMaximum), SumAndRound::flooredHalf($fatiguePerRowMaximum)];
            $filledHalfRows = 0;
            while ($fatigueValue > 0) {
Severity: Minor
Found in Stamina/GridOfFatigue.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 using static access to class '\DrdPlus\Stamina\ReasonToRollAgainstMalusFromFatigue' in method 'I_can_use_rest_reason'.
Open

        $restReason = ReasonToRollAgainstMalusFromFatigue::getRestReason();

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\Stamina\ReasonToRollAgainstMalusFromFatigue' in method 'I_should_roll_against_malus_from_fatigue_because_of_rest'.
Open

        self::assertSame(ReasonToRollAgainstMalusFromFatigue::getRestReason(), $stamina->getReasonToRollAgainstMalusFromFatigue());
Severity: Minor
Found in tests/Stamina/StaminaTest.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\Stamina\Fatigue' in method 'rest'.
Open

        $this->fatigue = Fatigue::getIt($remainingFatigue);
Severity: Minor
Found in Stamina/Stamina.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 '\Granam\Tools\ValueDescriber' in method 'convertToEnumFinalValue'.
Open

                'Expected at least zero, got ' . ValueDescriber::describe($enumValue)
Severity: Minor
Found in Stamina/Fatigue.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\Stamina\Fatigue' in method 'addFatigue'.
Open

        $this->fatigue = Fatigue::getIt($this->fatigue->getValue() + $fatigue->getValue());
Severity: Minor
Found in Stamina/Stamina.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

The method I_can_use_fatigue_reason is not named in camelCase.
Open

    public function I_can_use_fatigue_reason(): void
    {
        $fatigueReason = ReasonToRollAgainstMalusFromFatigue::getFatigueReason();
        self::assertInstanceOf(ReasonToRollAgainstMalusFromFatigue::class, $fatigueReason);
        self::assertTrue($fatigueReason->becauseOfFatigue());

CamelCaseMethodName

Since: 0.2

It is considered best practice to use the camelCase notation to name methods.

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method I_can_use_rest_reason is not named in camelCase.
Open

    public function I_can_use_rest_reason(): void
    {
        $restReason = ReasonToRollAgainstMalusFromFatigue::getRestReason();
        self::assertInstanceOf(ReasonToRollAgainstMalusFromFatigue::class, $restReason);
        self::assertTrue($restReason->becauseOfRest());

CamelCaseMethodName

Since: 0.2

It is considered best practice to use the camelCase notation to name methods.

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method I_can_use_it is not named in camelCase.
Open

    public function I_can_use_it(): void
    {
        $restingPower = new RestPower(123);
        self::assertSame(123, $restingPower->getValue());
        self::assertSame('123', (string)$restingPower);
Severity: Minor
Found in tests/Stamina/RestPowerTest.php by phpmd

CamelCaseMethodName

Since: 0.2

It is considered best practice to use the camelCase notation to name methods.

Example

class ClassName {
    public function get_name() {
    }
}

Source

Severity
Category
Status
Source
Language