JsonApi/Request/ActionParser.php
Avoid using undefined variables such as '$methodToAction' which will lead to PHP notices. Open
Open
$action->name = JsonApiSpec::$methodToAction[$request->getMethod()];
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using static access to class '\GoIntegro\Hateoas\Util\ArrayHelper' in method 'isPrimaryResourceAList'. Open
Open
return !Util\ArrayHelper::isAssociative(
$data[$params->primaryType]
);
- 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 variables with short names like $mm. Configured minimum length is 3. Open
Open
private $mm;
- 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
Avoid variables with short names like $mm. Configured minimum length is 3. Open
Open
MetadataMinerInterface $mm
- 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
Multi-line function declarations must define one parameter per line Open
Open
Params $params, RequestAction $action
- Exclude checks
There must be one USE keyword per declaration Open
Open
use GoIntegro\Hateoas\JsonApi\DocumentPagination,
- Exclude checks
Multi-line function declarations must define one parameter per line Open
Open
Request $request, Params $params, RequestAction $action)
- Exclude checks
The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line Open
Open
{
- Exclude checks
There must be one USE keyword per declaration Open
Open
use Symfony\Component\HttpFoundation\Request,
- Exclude checks
Multi-line function declarations must define one parameter per line Open
Open
Request $request, Params $params, RequestAction $action)
- Exclude checks
TRUE, FALSE and NULL must be lowercase; expected "false" but found "FALSE" Open
Open
return FALSE;
- Exclude checks
Multi-line function declarations must define one parameter per line Open
Open
Request $request, Params $params, RequestAction $action
- Exclude checks
The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line Open
Open
{
- Exclude checks
The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line Open
Open
{
- Exclude checks
Multi-line function declarations must define one parameter per line Open
Open
Request $request, Params $params, RequestAction $action
- Exclude checks
The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line Open
Open
{
- Exclude checks
The closing parenthesis of a multi-line function declaration must be on a new line Open
Open
Request $request, Params $params, RequestAction $action)
- Exclude checks
TRUE, FALSE and NULL must be lowercase; expected "false" but found "FALSE" Open
Open
return FALSE;
- Exclude checks
Multi-line function call not indented correctly; expected 12 spaces but found 16 Open
Open
$action->name,
- Exclude checks
Expected 0 spaces after opening bracket; newline found Open
Open
if (
- Exclude checks
Multi-line function call not indented correctly; expected 8 spaces but found 12 Open
Open
)
- Exclude checks
Multi-line function call not indented correctly; expected 12 spaces but found 16 Open
Open
[
- Exclude checks