Skip to content

Commit

Permalink
Fixed "Call to method on non-object"
Browse files Browse the repository at this point in the history
- Updated UXML::remove() method (was giving static analysis error on PHP 8.1)
  • Loading branch information
josemmo committed Aug 7, 2021
1 parent 6dc0038 commit be11039
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/UXML.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@ public function get(string $xpath): ?self {
* Calling it on a root element will have no effect.
*/
public function remove(): void {
$this->element->parentNode->removeChild($this->element);
$parent = $this->element->parentNode;
if ($parent !== null) {
$parent->removeChild($this->element);
}
}


Expand Down

0 comments on commit be11039

Please sign in to comment.