| Conditions | 7 |
| Paths | 7 |
| Total Lines | 29 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 7 | public static function isEqual(\PhpParser\Node $nodeA, \PhpParser\Node $nodeB) |
||
| 8 | { |
||
| 9 | if ($nodeA->getType() !== $nodeB->getType()) { |
||
| 10 | return false; |
||
| 11 | } |
||
| 12 | |||
| 13 | $subNodesA = $nodeA->getSubNodeNames(); |
||
| 14 | $subNodesB = $nodeB->getSubNodeNames(); |
||
| 15 | if ($subNodesA !== $subNodesB) { |
||
| 16 | return false; |
||
| 17 | } |
||
| 18 | |||
| 19 | foreach ($subNodesA as $key) { |
||
| 20 | $valueA = $nodeA->$key; |
||
| 21 | $valueB = $nodeB->$key; |
||
| 22 | $result = true; |
||
|
|
|||
| 23 | if ($valueA instanceof \PhpParser\Node && $valueB instanceof \PhpParser\Node) { |
||
| 24 | $result = self::isEqual($valueA, $valueB); |
||
| 25 | } else { |
||
| 26 | $result = $valueA === $valueB; |
||
| 27 | } |
||
| 28 | |||
| 29 | if ( ! $result) { |
||
| 30 | return false; |
||
| 31 | } |
||
| 32 | } |
||
| 33 | |||
| 34 | return true; |
||
| 35 | } |
||
| 36 | } |
||
| 37 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.