RulesetCallNode::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the ILess
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace ILess\Node;
11
12
use ILess\Context;
13
use ILess\Node;
14
15
/**
16
 * Ruleset call.
17
 */
18
class RulesetCallNode extends Node
19
{
20
    /**
21
     * Node type.
22
     *
23
     * @var string
24
     */
25
    protected $type = 'RulesetCall';
26
27
    /**
28
     * @var Node
29
     */
30
    public $variable;
31
32
    /**
33
     * Constructor.
34
     *
35
     * @param string $variable
36
     */
37
    public function __construct($variable)
38
    {
39
        $this->variable = $variable;
0 ignored issues
show
Documentation Bug introduced by
It seems like $variable of type string is incompatible with the declared type object<ILess\Node> of property $variable.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
40
    }
41
42
    /**
43
     * Compiles the node.
44
     *
45
     * @param Context $context The context
46
     * @param array|null $arguments Array of arguments
47
     * @param bool|null $important Important flag
48
     *
49
     * @return Node
50
     */
51
    public function compile(Context $context, $arguments = null, $important = null)
52
    {
53
        $variable = new VariableNode($this->variable);
54
        $detachedRuleset = $variable->compile($context);
55
56
        return $detachedRuleset->callCompile($context);
0 ignored issues
show
Bug introduced by
The method callCompile() does not exist on ILess\Node. Did you maybe mean compile()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
57
    }
58
}
59