Skip to content

Commit 45cdfb4

Browse files
committed
Fixed issue with return type in Dom and Selector
1 parent 268bdcb commit 45cdfb4

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/PHPHtmlParser/Dom.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,9 +419,9 @@ public function hasChildren(): bool
419419
* id.
420420
*
421421
* @param string $id
422-
* @return \PHPHtmlParser\Dom\AbstractNode
422+
* @return \PHPHtmlParser\Dom\AbstractNode|null
423423
*/
424-
public function getElementById($id): \PHPHtmlParser\Dom\AbstractNode
424+
public function getElementById($id)
425425
{
426426
$this->isLoaded();
427427

src/PHPHtmlParser/Selector.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,15 +326,15 @@ protected function match(string $operator, string $pattern, string $value): bool
326326
case '!=':
327327
return $value !== $pattern;
328328
case '^=':
329-
return preg_match('/^'.preg_quote($pattern, '/').'/', $value);
329+
return preg_match('/^'.preg_quote($pattern, '/').'/', $value) == 1;
330330
case '$=':
331-
return preg_match('/'.preg_quote($pattern, '/').'$/', $value);
331+
return preg_match('/'.preg_quote($pattern, '/').'$/', $value) == 1;
332332
case '*=':
333333
if ($pattern[0] == '/') {
334-
return preg_match($pattern, $value);
334+
return preg_match($pattern, $value) == 1;
335335
}
336336

337-
return preg_match("/".$pattern."/i", $value);
337+
return preg_match("/".$pattern."/i", $value) == 1;
338338
}
339339

340340
return false;

0 commit comments

Comments
 (0)