jaroslavtyc/drd-plus-profession-levels

View on GitHub
tests/Person/ProfessionLevels/LevelRankTest.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid using static access to class '\DrdPlus\Person\ProfessionLevels\LevelRank' in method 'I_can_get_its_value'.
Open

        $levelRank = LevelRank::getIt($value = 12345);

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\Person\ProfessionLevels\LevelRank' in method 'I_can_not_create_negative_level'.
Open

        LevelRank::getIt($prohibitedValue);

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\Person\ProfessionLevels\LevelRank' in method 'I_can_easily_find_out_if_is_first_or_next_level'.
Open

        $nextLevelRank = LevelRank::getIt(123);

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\Person\ProfessionLevels\LevelRank' in method 'I_can_easily_find_out_if_is_first_or_next_level'.
Open

        $zeroLevelRank = LevelRank::getIt(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\Person\ProfessionLevels\LevelRank' in method 'I_can_easily_find_out_if_is_first_or_next_level'.
Open

        $firstLevelRank = LevelRank::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\Person\ProfessionLevels\LevelRank' in method 'I_can_create_it_from_to_string_object'.
Open

        $levelRank = LevelRank::getIt($someToStringObject = new SomeToStringObject($value = 12));

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\Person\ProfessionLevels\LevelRank' in method 'I_can_create_it'.
Open

        $levelRank = LevelRank::getIt($value = 12345);

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 local variables such as '$value'.
Open

        $levelRank = LevelRank::getIt($value = 12345);

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

The method I_can_get_its_value is not named in camelCase.
Open

    public function I_can_get_its_value(): void
    {
        $levelRank = LevelRank::getIt($value = 12345);
        self::assertSame($value, $levelRank->getValue());
        self::assertSame((string)$value, (string)$levelRank);

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

    public function I_can_create_it_from_to_string_object(): void
    {
        /** @noinspection PhpParamsInspection */
        $levelRank = LevelRank::getIt($someToStringObject = new SomeToStringObject($value = 12));
        self::assertSame($value, $levelRank->getValue());

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

    public function I_can_create_it(): void
    {
        $levelRank = LevelRank::getIt($value = 12345);
        self::assertSame(12345, $levelRank->getValue());
        self::assertSame('12345', (string)$levelRank);

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

    public function I_can_not_create_negative_level(int $prohibitedValue): void
    {
        $this->expectException(\DrdPlus\Person\ProfessionLevels\Exceptions\InvalidLevelRank::class);
        LevelRank::getIt($prohibitedValue);
    }

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

    public function I_can_easily_find_out_if_is_first_or_next_level(): void
    {
        $zeroLevelRank = LevelRank::getIt(0);
        self::assertTrue($zeroLevelRank->isZeroLevel());
        self::assertFalse($zeroLevelRank->isFirstLevel());

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

There are no issues that match your filters.

Category
Status