@@ -20,7 +20,7 @@ class Seeker implements SeekerInterface
2020 * @var InnerNode[] $nodes
2121 * @throws ChildNotFoundException
2222 */
23- public function seek (array $ nodes , RuleDTO $ rule , array $ options, bool $ depthFirst ): array
23+ public function seek (array $ nodes , RuleDTO $ rule , array $ options ): array
2424 {
2525 // XPath index
2626 if ($ rule ->getTag () !== null && \is_numeric ($ rule ->getKey ())) {
@@ -80,19 +80,14 @@ public function seek(array $nodes, RuleDTO $rule, array $options, bool $depthFir
8080 // this child failed to be matched
8181 if ($ child instanceof InnerNode && $ child ->hasChildren ()
8282 ) {
83- if ($ depthFirst ) {
84- if (!isset ($ options ['checkGrandChildren ' ])
85- || $ options ['checkGrandChildren ' ]
86- ) {
87- // we have a child that failed but are not leaves.
88- $ matches = $ this ->seek ([$ child ], $ rule , $ options , $ depthFirst );
89- foreach ($ matches as $ match ) {
90- $ return [] = $ match ;
91- }
83+ if (!isset ($ options ['checkGrandChildren ' ])
84+ || $ options ['checkGrandChildren ' ]
85+ ) {
86+ // we have a child that failed but are not leaves.
87+ $ matches = $ this ->seek ([$ child ], $ rule , $ options );
88+ foreach ($ matches as $ match ) {
89+ $ return [] = $ match ;
9290 }
93- } else {
94- // we still want to check its children
95- $ children [] = $ child ;
9691 }
9792 }
9893
@@ -104,7 +99,7 @@ public function seek(array $nodes, RuleDTO $rule, array $options, bool $depthFir
10499 && \count ($ children ) > 0
105100 ) {
106101 // we have children that failed but are not leaves.
107- $ matches = $ this ->seek ($ children , $ rule , $ options, $ depthFirst );
102+ $ matches = $ this ->seek ($ children , $ rule , $ options );
108103 foreach ($ matches as $ match ) {
109104 $ return [] = $ match ;
110105 }
0 commit comments