jaroslavtyc/drd-plus-codes

View on GitHub

Showing 591 of 591 total issues

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

        $seriousWoundOriginCode = SeriousWoundOriginCode::getIt($origin);

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\CombatActions\RangedCombatActionCode' in method 'I_can_get_ranged_only_codes'.
Open

        self::assertSame($expectedMeleeOnly, RangedCombatActionCode::getRangedOnlyCombatActionValues());

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\GenderCode' in method 'I_can_ask_it_if_is_male_or_female'.
Open

        $male = GenderCode::getIt(GenderCode::MALE);
Severity: Minor
Found in tests/Codes/GenderCodeTest.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\CombatActions\RangedCombatActionCode' in method 'Ranged_only_codes_are_marked_so'.
Open

            $rangedCombatActionCode = RangedCombatActionCode::getIt($value);

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 translateTo() has an NPath complexity of 800. The configured NPath complexity threshold is 200.
Open

    public function translateTo(string $languageCode, $amount = 1): string
    {
        $code = $this->getValue();
        $translations = $this->getTranslations($languageCode);
        /** @noinspection ExceptionsAnnotatingAndHandlingInspection */
Severity: Minor
Found in Codes/Partials/TranslatableCode.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

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

            RangedWeaponCode::addNewRangedWeaponCode('corge', $someCategory = $this->getRandomWeaponCategoryCode(), [])

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

        RangedWeaponCode::addNewRangedWeaponCode('corge', $differentCategory, []);

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

        $seriousWoundOrigin = SeriousWoundOriginCode::$getWoundOrigin();

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

        $rangeSpear = RangedWeaponCode::getIt(RangedWeaponCode::SPEAR);

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

            SeriousWoundOriginCode::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

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

        return SubRaceCode::getDefaultSubRaceFor($this);
Severity: Minor
Found in Codes/RaceCode.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 'I_can_get_ranged_weapon_category_codes'.
Open

            WeaponCategoryCode::getRangedWeaponCategoryValues()

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\PhysicalWoundTypeCode' in method 'I_can_ask_it_for_type'.
Open

        $woundTypeCode = PhysicalWoundTypeCode::getIt($value);

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

        $isWoundOrigin = StringTools::assembleGetterForName($seriousWoundOriginName, 'is') . '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\CombatActions\CombatActionCode' in method 'I_can_get_melee_only_codes'.
Open

            CombatActionCode::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

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

            } else {
                foreach ($this->fetchTranslations() as $currentLanguageCode => $languageTranslations) {
                    /** @var array $languageTranslations */
                    foreach ($languageTranslations as $codeValue => $codeTranslations) {
                        // child translations can overwrite custom translations

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\WeaponCategoryCode' in method 'getWeaponCategoryValues'.
Open

        return WeaponCategoryCode::getRangedWeaponCategoryValues();

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

    protected function isSameCodeAllowedFor(string $weaponlikeCode, string $interferingCodeClass): bool

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\Codes\CombatActions\MeleeCombatActionCode' in method 'Melee_only_codes_are_marked'.
Open

            $meleeCombatActionCode = MeleeCombatActionCode::getIt($value);

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

            WeaponCategoryCode::getMeleeWeaponCategoryValues()

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