jaroslavtyc/drd-plus-codes

View on GitHub

Showing 591 of 591 total issues

Avoid using static access to class '\DrdPlus\Codes\SubRaceCode' in method 'I_can_get_default_sub_race'.
Open

        self::assertSame(SubRaceCode::getDefaultSubRaceFor($raceCode), $raceCode->getDefaultSubRaceCode());
Severity: Minor
Found in tests/Codes/RaceCodeTest.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\Armaments\RangedWeaponCode' in method 'convertToRangedWeaponCodeEquivalent'.
Open

        return RangedWeaponCode::getIt($this->getValue());
Severity: Minor
Found in Codes/Armaments/MeleeWeaponCode.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 Every_code_has_own_optimized_get_possible_values_method uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                self::assertSame(
                    $codeClass,
                    $getPossibleValuesReflection->getDeclaringClass()->getName(),
                    "$codeClass should have own getPossibleValues() method with direct list of its constants for readability"
Severity: Minor
Found in tests/Codes/AllCodesTest.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\Codes\Armaments\MeleeWeaponCode' in method 'I_can_get_knife_and_dagger_codes'.
Open

            MeleeWeaponCode::getKnivesAndDaggersValues()

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\Theurgist\ProfileCode' in method 'I_can_ask_it_for_gender_and_get_opposite'.
Open

        self::assertSame(ProfileCode::getIt(ProfileCode::LOOK_VENUS), $lookVenus);

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\Armaments\MeleeWeaponCode' in method 'I_can_get_staff_and_spear_codes'.
Open

            MeleeWeaponCode::getStaffsAndSpearsValues()

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\Armaments\MeleeWeaponCode' in method 'I_can_ask_code_if_is_specific_weapon_type'.
Open

            $code = MeleeWeaponCode::getIt($codeValue);

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\Armaments\MeleeWeaponCode' in method 'I_can_ask_code_if_is_specific_weapon_type'.
Open

        foreach (MeleeWeaponCode::getVoulgesAndTridentsValues() as $codeValue) {

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\Armaments\RangedWeaponCode' in method 'I_can_get_all_codes_at_once_or_by_same_named_constant'.
Open

            count($missingOrDifferent = array_diff_assoc($expectedValues, RangedWeaponCode::getPossibleValues())) > 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\Armaments\MeleeWeaponCode' in method 'I_can_get_mace_and_club_codes'.
Open

            MeleeWeaponCode::getMacesAndClubsValues()

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\Armaments\MeleeWeaponCode' in method 'I_can_get_morningstar_and_morgenstern_codes'.
Open

            MeleeWeaponCode::getMorningstarsAndMorgensternsValues()

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\Armaments\MeleeWeaponCode' in method 'I_can_ask_code_if_is_specific_weapon_type'.
Open

        foreach (MeleeWeaponCode::getKnivesAndDaggersValues() as $codeValue) {

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\Armaments\MeleeWeaponCode' in method 'I_can_ask_code_if_is_specific_weapon_type'.
Open

            $code = MeleeWeaponCode::getIt($codeValue);

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\Armaments\MeleeWeaponCode' in method 'I_can_ask_code_if_is_specific_weapon_type'.
Open

            $code = MeleeWeaponCode::getIt($codeValue);

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\Armaments\MeleeWeaponCode' in method 'I_can_not_add_new_melee_weapon_code_with_not_melee_category'.
Open

        MeleeWeaponCode::addNewMeleeWeaponCode('foo', $throwingCategory, []);

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\Armaments\RangedWeaponCode' in method 'I_can_get_crossbow_codes'.
Open

            RangedWeaponCode::getCrossbowsValues()

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

        self::assertSame($ordinaryWoundOrigin, OrdinaryWoundOriginCode::getEnum('ordinary'));

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\String\StringTools' in method 'I_can_get_every_type_of_serious_wound_origin'.
Open

        $getWoundOrigin = StringTools::assembleGetterForName($seriousWoundOriginName) . 'WoundOrigin';

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\Armaments\RangedWeaponCode' in method 'I_can_not_add_new_ranged_weapon_code_with_not_melee_category'.
Open

        RangedWeaponCode::addNewRangedWeaponCode('foo', $meleeCategory, []);

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\Armaments\ShieldCode' in method 'I_can_easily_find_out_if_is_protective_armament'.
Open

        $shieldCode = ShieldCode::getIt(ShieldCode::MEDIUM_SHIELD);

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