* [misc] fix zin hook query()->first/last() not work.

This commit is contained in:
sunhao
2025-03-27 16:15:45 +08:00
committed by 刘刚
parent 2ef2a3ce48
commit 40db9c6ada
2 changed files with 6 additions and 4 deletions
+2 -2
View File
@@ -176,13 +176,13 @@ class node implements \JsonSerializable
public function findFirst(string|array|object $selectors): ?node
{
$results = $this->find($selectors, true);
return empty($results) ? null : $results[0];
return empty($results) ? null : reset($results);
}
public function findLast(string|array|object $selectors): ?node
{
$results = $this->find($selectors, true, true);
return empty($results) ? null : $results[0];
return empty($results) ? null : reset($results);
}
public function prop(array|string $name, mixed $defaultValue = null): mixed