Showing 5 of 5 total issues
Avoid excessively long variable names like $bodyWeightInKgAdjustment. Keep variable name length under 20. Open
Open
private $bodyWeightInKgAdjustment;
- Read upRead up
- Exclude checks
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
Open
Name $name,
Race $race,
GenderCode $genderCode,
PropertiesByFate $propertiesByFate,
Memories $memories,
The class Person has a coupling between objects value of 23. Consider to reduce the number of dependencies under 13. Open
Open
class Person extends StrictObject
{
/**
* @var Name
*/
- Read upRead up
- Exclude checks
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
Open
parent::__construct(\trim(ToString::toString($value)));
- Read upRead up
- Exclude checks
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
Open
public function __construct(
Name $name,
Race $race,
GenderCode $genderCode,
PropertiesByFate $propertiesByFate,
- Exclude checks