Skip to content

Commit be11039

Browse files
committed
Fixed "Call to method on non-object"
- Updated UXML::remove() method (was giving static analysis error on PHP 8.1)
1 parent 6dc0038 commit be11039

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/UXML.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,10 @@ public function get(string $xpath): ?self {
185185
* Calling it on a root element will have no effect.
186186
*/
187187
public function remove(): void {
188-
$this->element->parentNode->removeChild($this->element);
188+
$parent = $this->element->parentNode;
189+
if ($parent !== null) {
190+
$parent->removeChild($this->element);
191+
}
189192
}
190193

191194

0 commit comments

Comments
 (0)