Completed
Push — master ( d8850a...9a8733 )
by Freek
02:13
created

leaveNode()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
1
<?php
2
3
namespace Spatie\Php7to5\NodeVisitors;
4
5
use PhpParser\Node;
6
use PhpParser\Node\Stmt\ClassConst;
7
use PhpParser\NodeVisitorAbstract;
8
9
/**
10
 * Removes the class constant visibility modifiers (PHP 7.1)
11
 */
12
class ClassConstantVisibilityModifiersRemover extends NodeVisitorAbstract
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17
    public function leaveNode(Node $node)
18
    {
19
        if (!($node instanceof ClassConst)) {
20
            return;
21
        }
22
23
        $node->flags = 0; // Remove constant modifier
24
    }
25
}
26