Completed
Push — master ( f06ad0...9cb85d )
by Nico
06:26
created

NodeVariable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getNode() 0 13 2
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * @license     http://opensource.org/licenses/mit-license.php MIT
7
 * @link        https://github.com/nicoSWD
8
 * @author      Nicolas Oelgart <[email protected]>
9
 */
10
namespace nicoSWD\Rules\TokenStream\Nodes;
11
12
use nicoSWD\Rules\Tokens\BaseToken;
13
14
final class NodeVariable extends BaseNode
15
{
16 90
    public function getNode(): BaseToken
17
    {
18 90
        $current = $this->tokenStream->getVariable(
19 90
            $this->getCurrentNode()->getValue()
20
        );
21 86
        $current->setStack($this->tokenStream->getStack());
22
23 86
        while ($this->hasMethodCall()) {
24 32
            $current = $this->getMethod($current)->call(...$this->getArguments());
0 ignored issues
show
Documentation introduced by
$this->getArguments() is of type object<nicoSWD\Rules\TokenStream\TokenCollection>, but the function expects a object<nicoSWD\Rules\Tokens\BaseToken>|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
25
        }
26
27 86
        return $current;
28
    }
29
}
30