Method __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Profession $profession,
LevelRank $levelRank,
Strength $strengthIncrement,
Agility $agilityIncrement,
Knack $knackIncrement,
Method checkPropertySumIncrement
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
LevelRank $levelRank,
Strength $strength,
Agility $agility,
Knack $knack,
Will $will,
Method sumProperties
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Strength $strengthIncrement,
Agility $agilityIncrement,
Knack $knackIncrement,
Will $willIncrement,
Intelligence $intelligenceIncrement,
Avoid too many return
statements within this method. Open
return $this->getIntelligenceIncrement();
Avoid too many return
statements within this method. Open
return $this->getCharismaIncrement();
The class ProfessionLevel has a coupling between objects value of 14. Consider to reduce the number of dependencies under 13. Open
abstract class ProfessionLevel extends StrictObject
{
private \DrdPlus\Professions\Profession $profession;
private \DrdPlus\Person\ProfessionLevels\LevelRank $levelRank;
- 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
Missing class import via use statement (line '87', column '46'). Open
$this->levelUpAt = $levelUpAt ?: new \DateTimeImmutable();
- Read upRead up
- Exclude checks
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 '\Granam\Tools\ValueDescriber' in method 'getBasePropertyIncrement'. Open
'Unknown property ' . ValueDescriber::describe($propertyCode)
- 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
Avoid excessively long variable names like $intelligenceIncrement. Keep variable name length under 20. Open
Intelligence $intelligenceIncrement,
- 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
Avoid excessively long variable names like $intelligenceIncrement. Keep variable name length under 20. Open
Intelligence $intelligenceIncrement,
- 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
Avoid excessively long variable names like $intelligenceIncrement. Keep variable name length under 20. Open
private \DrdPlus\BaseProperties\Intelligence $intelligenceIncrement;
- 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++ ) {
}
}
}