jaroslavtyc/drd-plus-equipment

View on GitHub

Showing 26 of 26 total issues

Avoid excessively long variable names like $weaponOrShieldInMainHand. Keep variable name length under 20.
Open

    private $weaponOrShieldInMainHand;
Severity: Minor
Found in Equipment/Equipment.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $weaponOrShieldInOffhand. Keep variable name length under 20.
Open

    private $weaponOrShieldInOffhand;
Severity: Minor
Found in Equipment/Equipment.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $weaponOrShieldInOffhand. Keep variable name length under 20.
Open

    public function setWeaponOrShieldInOffhand(WeaponlikeCode $weaponOrShieldInOffhand)
Severity: Minor
Found in Equipment/Equipment.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $weaponOrShieldInMainHand. Keep variable name length under 20.
Open

    public function setWeaponOrShieldInMainHand(WeaponlikeCode $weaponOrShieldInMainHand)
Severity: Minor
Found in Equipment/Equipment.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Method I_can_use_it has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function I_can_use_it()
    {
        $equipment = new Equipment(
            $belongings = $this->createBelongings($weight = $this->createWeight(123.789)),
            $bodyArmorCode = BodyArmorCode::getIt(BodyArmorCode::HOBNAILED_ARMOR),
Severity: Minor
Found in tests/Equipment/EquipmentTest.php - About 1 hr to fix

    Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            Belongings $belongings,
            BodyArmorCode $wornBodyArmor,
            HelmCode $wornHelm,
            WeaponlikeCode $weaponlikeInMainHand,
            WeaponlikeCode $weaponlikeInOffhand
    Severity: Minor
    Found in Equipment/Equipment.php - About 35 mins to fix

      Missing class import via use statement (line '27', column '20').
      Open

              return new \ArrayIterator($this->items);
      Severity: Minor
      Found in Equipment/Belongings.php by phpmd

      MissingImport

      Since: 2.7.0

      Importing all external classes in a file through use statements makes them clearly visible.

      Example

      function make() {
          return new \stdClass();
      }

      Source http://phpmd.org/rules/cleancode.html#MissingImport

      Avoid using static access to class '\DrdPlus\Codes\Armaments\BodyArmorCode' in method 'I_can_use_it'.
      Open

              $anotherBodyArmorCode = BodyArmorCode::getIt(BodyArmorCode::WITHOUT_ARMOR);
      Severity: Minor
      Found in tests/Equipment/EquipmentTest.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 'I_can_use_it'.
      Open

                  $mainHand = RangedWeaponCode::getIt(RangedWeaponCode::LIGHT_CROSSBOW),
      Severity: Minor
      Found in tests/Equipment/EquipmentTest.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\HelmCode' in method 'I_can_use_it'.
      Open

              $anotherHelmCode = HelmCode::getIt(HelmCode::LEATHER_CAP);
      Severity: Minor
      Found in tests/Equipment/EquipmentTest.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\ShieldCode' in method 'I_can_use_it'.
      Open

              $anotherMainHand = ShieldCode::getIt(ShieldCode::MEDIUM_SHIELD);
      Severity: Minor
      Found in tests/Equipment/EquipmentTest.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 '\Granam\Scalar\Tools\ToString' in method '__construct'.
      Open

              $name = trim(ToString::toString($name));
      Severity: Minor
      Found in Equipment/Item.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 unused local variables such as '$weight'.
      Open

                  $belongings = $this->createBelongings($weight = $this->createWeight(123.789)),
      Severity: Minor
      Found in tests/Equipment/EquipmentTest.php by phpmd

      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

      Avoid using static access to class '\DrdPlus\Codes\Armaments\BodyArmorCode' in method 'I_can_use_it'.
      Open

                  $bodyArmorCode = BodyArmorCode::getIt(BodyArmorCode::HOBNAILED_ARMOR),
      Severity: Minor
      Found in tests/Equipment/EquipmentTest.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\HelmCode' in method 'I_can_use_it'.
      Open

                  $helmCode = HelmCode::getIt(HelmCode::CONICAL_HELM),
      Severity: Minor
      Found in tests/Equipment/EquipmentTest.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\ShieldCode' in method 'I_can_use_it'.
      Open

                  $offhand = ShieldCode::getIt(ShieldCode::PAVISE)
      Severity: Minor
      Found in tests/Equipment/EquipmentTest.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\ShieldCode' in method 'I_can_use_it'.
      Open

              $anotherOffhand = ShieldCode::getIt(ShieldCode::WITHOUT_SHIELD);
      Severity: Minor
      Found in tests/Equipment/EquipmentTest.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 '\Mockery' in method 'createBelongings'.
      Open

                  ->with(\Mockery::type(Item::class));
      Severity: Minor
      Found in tests/Equipment/ItemTest.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_not_create_it_with_empty_name is not named in camelCase.
      Open

          public function I_can_not_create_it_with_empty_name()
          {
              $this->expectException(\DrdPlus\Equipment\Exceptions\ItemNameCanNotBeEmpty::class);
              new Item('', $this->createWeight());
          }
      Severity: Minor
      Found in tests/Equipment/ItemTest.php by phpmd

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

          public function I_can_create_it_without_any_container()
          {
              $item = new Item('foo', $weight = $this->createWeight());
              self::assertSame('foo', $item->getName());
              self::assertSame('foo', (string)$item);
      Severity: Minor
      Found in tests/Equipment/ItemTest.php by phpmd

      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