jaroslavtyc/drd-plus-codes

View on GitHub

Showing 591 of 591 total issues

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\HelmCode' in method 'I_can_ask_it_if_is_helm_or_body_armor'.
Open

        $helmCode = HelmCode::getIt(HelmCode::BARREL_HELM);

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_ask_code_if_is_specific_weapon_type'.
Open

            $code = RangedWeaponCode::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

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

                    } else {
                        self::assertTrue($code->$question());
                    }

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_not_convert_anything_to_melee_weapon_code'.
Open

        $wantItRange = MeleeWeaponCode::getIt(MeleeWeaponCode::CUDGEL);

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_get_from_melee_code_negative_answer_to_most_range_question'.
Open

            $meleeWeaponCode = MeleeWeaponCode::getIt($meleeWeaponCode);

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_easily_composer_method_to_get_weapons_of_same_category'.
Open

            $getMeleeWeaponOfCategory = StringTools::assembleGetterForName($meleeWeaponCategoryValue . 'Values');

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_ask_code_if_is_specific_weapon_type() has 110 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public function I_can_ask_code_if_is_specific_weapon_type()
    {
        $questions = [
            'isAxe', 'isKnifeOrDagger', 'isMaceOrClub', 'isMorningstarOrMorgenstern', 'isSaberOrBowieKnife',
            'isStaffOrSpear', 'isSword', 'isVoulgeOrTrident', 'isUnarmed',

Avoid using static access to class '\DrdPlus\Codes\Armaments\RangedWeaponCode' in method 'I_can_ask_code_if_is_specific_weapon_type'.
Open

            $code = RangedWeaponCode::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

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

                } else {
                    self::assertNotSame(
                        $oneInEnglish,
                        $oneInCzech,
                        "Expected translation of '{$value}' to be different in czech than in english in code {$codeClass}, got '{$oneInCzech}'"

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

        self::assertSame(RangedWeaponCode::getIt(RangedWeaponCode::SPEAR), $rangeSpear);

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_easily_find_out_if_weapon_is_unarmed_in_fact'.
Open

            $meleeWeaponCode = MeleeWeaponCode::getIt($meleeWeaponCodeValue);

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_easily_find_out_if_weapon_is_unarmed_in_fact'.
Open

                \in_array($meleeWeaponCodeValue, MeleeWeaponCode::getUnarmedValues(), true),

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\RaceCode' in method 'I_can_get_races_to_sub_races_codes'.
Open

        self::assertEquals(RaceCode::getPossibleValues(), array_keys(SubRaceCode::getRaceToSubRaceValues()));
Severity: Minor
Found in tests/Codes/SubRaceCodeTest.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\SubRaceCode' in method 'I_can_get_sub_race_default_to_a_race'.
Open

        $defaultOrcSubRace = SubRaceCode::getDefaultSubRaceFor(RaceCode::getIt(RaceCode::ORC));
Severity: Minor
Found in tests/Codes/SubRaceCodeTest.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\WeaponCategoryCode' in method 'guardSameCategory'.
Open

            foreach (WeaponCategoryCode::getPossibleValues() as $anotherCategory) {
Severity: Minor
Found in Codes/Armaments/RangedWeaponCode.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\MeleeWeaponCode' in method 'I_can_get_unarmed_codes'.
Open

            MeleeWeaponCode::getUnarmedValues()

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::getAxesValues() 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_not_extended_it_by_same_code_but_different_category'.
Open

        self::assertNotContains('corge', MeleeWeaponCode::getPossibleValues());

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