Missing class import via use statement (line '184', column '23'). Open
throw new \Exception(sprintf(
- 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
Missing class import via use statement (line '157', column '23'). Open
throw new \Exception(sprintf(
- 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
Missing class import via use statement (line '136', column '23'). Open
throw new \LogicException(self::ERROR_INACCESSIBLE_MEMBER);
- 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
Missing class import via use statement (line '139', column '19'). Open
throw new \Exception(sprintf(self::ERROR_UNCALLABLE_GETTER, $getter));
- 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
Missing class import via use statement (line '176', column '23'). Open
throw new \Exception(sprintf(
- 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 '\GoIntegro\Hateoas\Util\Inflector' in method 'callGetter'. Open
$camelized = Inflector::camelize($field, TRUE);
- 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 $linkOnlyRelationships. Keep variable name length under 20. Open
public static $linkOnlyRelationships = [];
- 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 $relationshipBlacklist. Keep variable name length under 20. Open
public static $relationshipBlacklist = [];
- 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 variables with short names like $id. Configured minimum length is 3. Open
public $id;
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
TRUE, FALSE and NULL must be lowercase; expected "null" but found "NULL" Open
public static function getStringId(ResourceEntityInterface $entity = NULL)
- Exclude checks
TRUE, FALSE and NULL must be lowercase; expected "true" but found "TRUE" Open
$camelized = Inflector::camelize($field, TRUE);
- Exclude checks
The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line Open
{
- Exclude checks
TRUE, FALSE and NULL must be lowercase; expected "null" but found "NULL" Open
? NULL
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
self::ERROR_TO_MANY_RELATION_NULL, $relationship
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
self::ERROR_NOT_RESOURCE_ENTITY, $relationship, $type
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
self::ERROR_NOT_ENTITY_COLLECTION, $relationship, $type
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
self::ERROR_NOT_RESOURCE_ENTITY, $relationship, $type
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
self::ERROR_NOT_ENTITY_COLLECTION, $relationship, $type
- Exclude checks
Line exceeds 120 characters; contains 180 characters Open
ERROR_NOT_ENTITY_COLLECTION = "The relationship \"%s\" contains a \"%s\", a collection of entities that implements Doctrine\\Common\\Collections\\Collection was expected.",
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
ERROR_INACCESSIBLE_MEMBER = "For some reason the field is known or is a relationship, but its value can't be accessed.",
- Exclude checks
Line exceeds 120 characters; contains 173 characters Open
const ERROR_NOT_RESOURCE_ENTITY = "The relationship \"%s\" contains a \"%s\", an entity implementing GoIntegro\\Hateoas\\JsonApi\\ResourceEntityInterface was expected.",
- Exclude checks
Line exceeds 120 characters; contains 217 characters Open
ERROR_TO_MANY_RELATION_NULL = "The to-many relationship \"%s\" returns neither an array nor a collection. The corresponding property needs to be initialized with either during the construction of the entity.",
- Exclude checks
Expected 0 spaces after opening bracket; newline found Open
if (
- Exclude checks
Expected 0 spaces after opening bracket; newline found Open
} elseif (
- Exclude checks