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.
Test Failed
Push — master ( adbc2a...6af8e5 )
by Michael
02:42
created

ReturnStatement::getAllowedClasses()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 6
cts 6
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 1
crap 2
1
<?php
2
3
namespace MS\PHPMD\Rule\CleanCode;
4
5
use PDepend\Source\AST\ASTReturnStatement;
6
use PHPMD\AbstractNode;
7
use PHPMD\AbstractRule;
8
use PHPMD\Node\MethodNode;
9
use PHPMD\Rule\MethodAware;
10
11
/**
12
 * To easy understand a return statement line, it should only have simple allocations.
13
 * Don't write your logical code in the return line.
14
 */
15
class ReturnStatement extends AbstractRule implements MethodAware
16
{
17
    /**
18
     * @param AbstractNode|MethodNode $node
19
     */
20 19
    public function apply(AbstractNode $node)
21
    {
22 19
        $forbiddenChildTypes = explode(
23 19
            $this->getStringProperty('delimiter'),
24 19
            $this->getStringProperty('forbiddenChildren')
25
        );
26
27 19
        /** @var AbstractNode|ASTReturnStatement $returnStatement */
28 9
        foreach ($node->findChildrenOfType('ReturnStatement') as $returnStatement) {
29 9
            foreach ($forbiddenChildTypes as $forbiddenChildType) {
30
                $child = $returnStatement->getFirstChildOfType($forbiddenChildType);
31 9
32 3
                if (null === $child) {
33 3
                    continue;
34 9
                }
35 19
36 19
                $reflectChild = new \ReflectionClass($child->getNode());
37
38
                if ('AST' . $forbiddenChildType === $reflectChild->getShortName()) {
39
                    $this->addViolation($returnStatement, [$forbiddenChildType]);
40
                }
41
            }
42
        }
43 19
    }
44
}
45
46