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.

ReturnStatement   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 3
dl 0
loc 30
ccs 17
cts 17
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A apply() 0 24 5
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 23
    public function apply(AbstractNode $node)
21
    {
22 23
        $forbiddenChildTypes = explode(
23 23
            $this->getStringProperty('delimiter'),
24 23
            $this->getStringProperty('forbiddenChildren')
25 23
        );
26
27
        /** @var AbstractNode|ASTReturnStatement $returnStatement */
28 23
        foreach ($node->findChildrenOfType('ReturnStatement') as $returnStatement) {
29 13
            foreach ($forbiddenChildTypes as $forbiddenChildType) {
30 13
                $child = $returnStatement->getFirstChildOfType($forbiddenChildType);
31
32 13
                if (null === $child) {
33 13
                    continue;
34
                }
35
36 2
                $reflectChild = new \ReflectionClass($child->getNode());
37
38 2
                if ('AST' . $forbiddenChildType === $reflectChild->getShortName()) {
39 1
                    $this->addViolation($returnStatement, [$forbiddenChildType]);
40 1
                }
41 13
            }
42 23
        }
43 23
    }
44
}
45
46