| Conditions | 8 |
| Paths | 9 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 45 | public function hasParent($parent = null, bool $recursive = false): bool |
||
| 46 | { |
||
| 47 | if ($parent === null) { |
||
| 48 | return $this->parent !== null; |
||
| 49 | } |
||
| 50 | |||
| 51 | $foundParent = false; |
||
| 52 | |||
| 53 | if ($parent instanceof Node) { |
||
| 54 | $foundParent = $this->parent === $parent; |
||
| 55 | } elseif (is_string($parent)) { |
||
| 56 | $foundParent = isset($this->parent) && get_class($this->parent) === $parent; |
||
| 57 | } |
||
| 58 | |||
| 59 | if ($recursive === true && isset($this->parent) && $foundParent === false) { |
||
| 60 | return $this->parent->hasParent($parent, true); |
||
|
1 ignored issue
–
show
|
|||
| 61 | } |
||
| 62 | |||
| 63 | return $foundParent; |
||
| 64 | } |
||
| 66 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.