GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( 10351e...ea3c3c )
by Michael
03:35
created

DataStructureConstants   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 16
ccs 7
cts 7
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A apply() 0 10 3
1
<?php
2
3
namespace MS\PHPMD\Rule\CleanCode;
4
5
use PDepend\Source\AST\ASTClass;
6
use PHPMD\AbstractNode;
7
use PHPMD\Node\ClassNode;
8
9
/**
10
 * Don't contain constants in your data structure. Important information are distribute throughout the project.
11
 * You reduce the reusability.
12
 */
13
class DataStructureConstants extends AbstractDataStructure
14
{
15
    /**
16
     * @param AbstractNode|ClassNode|ASTClass $node
17
     */
18 6
    public function apply(AbstractNode $node)
19
    {
20 6
        if (false === $this->isDataStructure($node)) {
0 ignored issues
show
Compatibility introduced by
$node of type object<PHPMD\AbstractNode> is not a sub-type of object<PHPMD\Node\ClassNode>. It seems like you assume a child class of the class PHPMD\AbstractNode to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
21 3
            return;
22
        }
23
24 3
        if (0 !== count($node->getConstants())) {
25 2
            $this->addViolation($node);
26 2
        }
27 3
    }
28
}
29