jaroslavtyc/drd-plus-health

View on GitHub

Showing 669 of 669 total issues

Avoid using static access to class '\DrdPlus\Codes\Body\SeriousWoundOriginCode' in method 'I_can_ask_it_if_I_am_suffering_from_wounds'.
Open

            SeriousWoundOriginCode::getIt(SeriousWoundOriginCode::PSYCHICAL),
Severity: Minor
Found in tests/Health/HealthTest.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\Codes\Body\SeriousWoundOriginCode' in method 'I_can_ask_it_if_I_am_suffering_from_wounds'.
Open

            SeriousWoundOriginCode::getIt(SeriousWoundOriginCode::PSYCHICAL),
Severity: Minor
Found in tests/Health/HealthTest.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\Health\Inflictions\Glared' in method 'I_can_get_used_to_darkness_by_long_waiting'.
Open

        $glared = Glared::createFromGlare($this->createGlare(-21 /* malus */, false), new Health());

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\Health\MalusFromWounds' in method 'I_can_use_it'.
Open

        $malusFromWounds = MalusFromWounds::getIt(-2);
Severity: Minor
Found in tests/Health/MalusFromWoundsTest.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\Health\TreatmentBoundary' in method 'I_can_create_treatment_boundary'.
Open

        $treatmentBoundary = TreatmentBoundary::getIt($value = 0);

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\Codes\Body\SeriousWoundOriginCode' in method 'I_can_heal_it_both_partially_and_fully'.
Open

            $elementalWoundOrigin = SeriousWoundOriginCode::getElementalWoundOrigin()
Severity: Minor
Found in tests/Health/WoundTest.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 __construct has 11 parameters. Consider reducing the number of parameters to less than 10.
Open

    protected function __construct(
        Health $health,
        AfflictionProperty $property,
        AfflictionDangerousness $dangerousness,
        AfflictionDomain $domain,
Severity: Minor
Found in Health/Afflictions/Affliction.php by phpmd

The method __construct has 11 parameters. Consider reducing the number of parameters to less than 10.
Open

    protected function __construct(
        SeriousWound $seriousWound, // wound can be healed, but never disappears - just stays healed
        AfflictionProperty $property,
        AfflictionDangerousness $dangerousness,
        AfflictionDomain $domain,

Avoid using static access to class '\DrdPlus\Codes\Body\SeriousWoundOriginCode' in method 'I_can_ask_it_if_may_suffer_from_wounds'.
Open

            SeriousWoundOriginCode::getIt(SeriousWoundOriginCode::PSYCHICAL),
Severity: Minor
Found in tests/Health/HealthTest.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\Health\Inflictions\Glared' in method 'I_can_lower_malus_by_getting_used_to_shine'.
Open

        $glared = Glared::createFromGlare($this->createGlare(-15, true), new Health());

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\Health\WoundSize' in method 'I_can_use_it_as_an_integer'.
Open

        $woundSizeByFactory = WoundSize::createIt(123);
Severity: Minor
Found in tests/Health/WoundSizeTest.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\Codes\Body\SeriousWoundOriginCode' in method 'I_can_ask_it_if_may_suffer_from_wounds'.
Open

            SeriousWoundOriginCode::getIt(SeriousWoundOriginCode::PSYCHICAL),
Severity: Minor
Found in tests/Health/HealthTest.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\Health\MalusFromWounds' in method 'I_can_use_it'.
Open

        $malusFromWounds = MalusFromWounds::getIt(0);
Severity: Minor
Found in tests/Health/MalusFromWoundsTest.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_it uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            self::assertSame(OrdinaryWoundOriginCode::getIt(), $wound->getWoundOriginCode());
        }
Severity: Minor
Found in tests/Health/WoundTest.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 I_can_use_it is not named in camelCase.
Open

    public function I_can_use_it()
    {
        for ($dangerousness = -999; $dangerousness < 1000; $dangerousness += 123) {
            $afflictionDangerousness = AfflictionDangerousness::getIt($dangerousness);
            self::assertInstanceOf(AfflictionDangerousness::class, $afflictionDangerousness);

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_not_create_custom_source is not named in camelCase.
Open

    public function I_can_not_create_custom_source()
    {
        $this->expectException(\DrdPlus\Health\Afflictions\Exceptions\UnknownAfflictionSource::class);
        $this->expectExceptionMessageMatches('~heavy metal~');
        AfflictionSource::getEnum('heavy metal');

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_get_all_maluses_zero_or_lesser is not named in camelCase.
Open

    public function I_get_all_maluses_zero_or_lesser()
    {
        $affliction = $this->getSut();
        self::assertLessThanOrEqual(0, $affliction->getStrengthMalus());
        self::assertLessThanOrEqual(0, $affliction->getAgilityMalus());

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_find_out_if_apply_even_on_success_against_trap is not named in camelCase.
Open

    abstract public function I_can_find_out_if_apply_even_on_success_against_trap();

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()
    {
        $cold = Cold::createIt($wound = $this->createWound());

        self::assertSame($wound, $cold->getSeriousWound());

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_get_malus_to_activities is not named in camelCase.
Open

    public function I_can_get_malus_to_activities()
    {
        $hunger = Hunger::createIt(new Health(), $this->createAfflictionSize(987));
        self::assertSame(0, $hunger->getMalusToActivities());
    }

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