Skip to content

Commit b9616dc

Browse files
committed
@ countable fix for PHP 7.2
1 parent 9663472 commit b9616dc

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/PHPHtmlParser/Selector.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,8 @@ protected function parseSelectorString($selector)
168168
protected function seek(array $nodes, array $rule, array $options)
169169
{
170170
// XPath index
171-
if (count($rule['tag']) > 0 &&
172-
count($rule['key']) > 0 &&
173-
is_numeric($rule['key'])
171+
if (strlen($rule['tag']) > 0 &&
172+
(int) $rule['key'] > 0
174173
) {
175174
$count = 0;
176175
/** @var AbstractNode $node */
@@ -219,7 +218,7 @@ protected function seek(array $nodes, array $rule, array $options)
219218
$pass = true;
220219
// check tag
221220
if ( ! empty($rule['tag']) && $rule['tag'] != $child->getTag()->name() &&
222-
$rule['tag'] != '*'
221+
$rule['tag'] != '*'
223222
) {
224223
// child failed tag check
225224
$pass = false;
@@ -295,7 +294,7 @@ protected function seek(array $nodes, array $rule, array $options)
295294
}
296295

297296
if (( ! isset($options['checkGrandChildren']) ||
298-
$options['checkGrandChildren'])
297+
$options['checkGrandChildren'])
299298
&& count($children) > 0
300299
) {
301300
// we have children that failed but are not leaves.

0 commit comments

Comments
 (0)