Completed
Push — master ( 0647fd...b9e92e )
by Théo
27:07 queued 08:01
created

EvalPrefixer::enterNode()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
nc 2
nop 1
dl 0
loc 8
ccs 4
cts 4
cp 1
crap 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the humbug/php-scoper package.
7
 *
8
 * Copyright (c) 2017 Théo FIDRY <[email protected]>,
9
 *                    Pádraic Brady <[email protected]>
10
 *
11
 * For the full copyright and license information, please view the LICENSE
12
 * file that was distributed with this source code.
13
 */
14
15
namespace Humbug\PhpScoper\PhpParser\NodeVisitor;
16
17
use Humbug\PhpScoper\PhpParser\StringScoperPrefixer;
18
use PhpParser\Node;
19
use PhpParser\Node\Expr\Eval_;
20
use PhpParser\Node\Scalar\String_;
21
use PhpParser\NodeVisitorAbstract;
22
23
final class EvalPrefixer extends NodeVisitorAbstract
24
{
25
    use StringScoperPrefixer;
26
27
    /**
28
     * @inheritdoc
29
     */
30 547
    public function enterNode(Node $node): Node
31
    {
32 547
        if ($node instanceof String_ && ParentNodeAppender::findParent($node) instanceof Eval_) {
33 6
            $this->scopeStringValue($node);
34
        }
35
36 547
        return $node;
37
    }
38
}
39