jaroslavtyc/drd-plus-person

View on GitHub

Showing 5 of 5 total issues

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

    private $bodyWeightInKgAdjustment;
Severity: Minor
Found in DrdPlus/Person/Person.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 __construct has 13 arguments (exceeds 4 allowed). Consider refactoring.
Open

        Name $name,
        Race $race,
        GenderCode $genderCode,
        PropertiesByFate $propertiesByFate,
        Memories $memories,
Severity: Major
Found in DrdPlus/Person/Person.php - About 1 hr to fix

    The class Person has a coupling between objects value of 23. Consider to reduce the number of dependencies under 13.
    Open

    class Person extends StrictObject
    {
        /**
         * @var Name
         */
    Severity: Minor
    Found in DrdPlus/Person/Person.php by phpmd

    CouplingBetweenObjects

    Since: 1.1.0

    A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

    Example

    class Foo {
        /**
         * @var \foo\bar\X
         */
        private $x = null;
    
        /**
         * @var \foo\bar\Y
         */
        private $y = null;
    
        /**
         * @var \foo\bar\Z
         */
        private $z = null;
    
        public function setFoo(\Foo $foo) {}
        public function setBar(\Bar $bar) {}
        public function setBaz(\Baz $baz) {}
    
        /**
         * @return \SplObjectStorage
         * @throws \OutOfRangeException
         * @throws \InvalidArgumentException
         * @throws \ErrorException
         */
        public function process(\Iterator $it) {}
    
        // ...
    }

    Source https://phpmd.org/rules/design.html#couplingbetweenobjects

    Avoid using static access to class '\Granam\Scalar\Tools\ToString' in method '__construct'.
    Open

            parent::__construct(\trim(ToString::toString($value)));
    Severity: Minor
    Found in DrdPlus/Person/Attributes/Name.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 __construct has 13 parameters. Consider reducing the number of parameters to less than 10.
    Open

        public function __construct(
            Name $name,
            Race $race,
            GenderCode $genderCode,
            PropertiesByFate $propertiesByFate,
    Severity: Minor
    Found in DrdPlus/Person/Person.php by phpmd
    Severity
    Category
    Status
    Source
    Language