1 | <?php |
||
7 | abstract class AbstractToken implements Token |
||
8 | { |
||
9 | /** @var int */ |
||
10 | private $depth; |
||
11 | |||
12 | /** @var int */ |
||
13 | protected $isValid; |
||
14 | |||
15 | /** @var null|Token */ |
||
16 | private $parent; |
||
17 | |||
18 | /** @var string */ |
||
19 | private $type; |
||
20 | |||
21 | /** |
||
22 | * Constructor |
||
23 | */ |
||
24 | 11 | public function __construct($type, Token $parent = null) |
|
34 | |||
35 | public function getDepth() |
||
39 | |||
40 | /** |
||
41 | * Getter for 'isValid'. |
||
42 | */ |
||
43 | public function getIsValid() |
||
47 | |||
48 | /** |
||
49 | * Getter for 'parent'. |
||
50 | */ |
||
51 | 2 | public function getParent() |
|
55 | |||
56 | /** |
||
57 | * Chainable setter for 'parent'. |
||
58 | */ |
||
59 | 11 | public function setParent(Token $parent = null) |
|
70 | |||
71 | public function getType() |
||
75 | |||
76 | 10 | public function validate(Configuration $configuration) |
|
80 | |||
81 | 11 | protected function isValidType($type) |
|
89 | } |
||
90 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.