@@ -38,7 +38,7 @@ public function __construct(array $elements = [], ?WebDriver $webDriver = null,
3838 {
3939 $ this ->uri = $ uri ;
4040 $ this ->webDriver = $ webDriver ;
41- $ this ->elements = $ elements ?? [] ;
41+ $ this ->elements = $ elements ;
4242 }
4343
4444 public function clear (): void
@@ -86,7 +86,7 @@ public function addNode(\DOMNode $node): void
8686 throw $ this ->createNotSupportedException (__METHOD__ );
8787 }
8888
89- public function eq ($ position ): self
89+ public function eq ($ position ): static
9090 {
9191 if (isset ($ this ->elements [$ position ])) {
9292 return $ this ->createSubCrawler ([$ this ->elements [$ position ]]);
@@ -105,12 +105,12 @@ public function each(\Closure $closure): array
105105 return $ data ;
106106 }
107107
108- public function slice ($ offset = 0 , $ length = null ): self
108+ public function slice ($ offset = 0 , $ length = null ): static
109109 {
110110 return $ this ->createSubCrawler (\array_slice ($ this ->elements , $ offset , $ length ));
111111 }
112112
113- public function reduce (\Closure $ closure ): self
113+ public function reduce (\Closure $ closure ): static
114114 {
115115 $ elements = [];
116116 foreach ($ this ->elements as $ i => $ element ) {
@@ -122,22 +122,22 @@ public function reduce(\Closure $closure): self
122122 return $ this ->createSubCrawler ($ elements );
123123 }
124124
125- public function last (): self
125+ public function last (): static
126126 {
127127 return $ this ->eq (\count ($ this ->elements ) - 1 );
128128 }
129129
130- public function siblings (): self
130+ public function siblings (): static
131131 {
132132 return $ this ->createSubCrawlerFromXpath ('(preceding-sibling::* | following-sibling::*) ' );
133133 }
134134
135- public function nextAll (): self
135+ public function nextAll (): static
136136 {
137137 return $ this ->createSubCrawlerFromXpath ('following-sibling::* ' );
138138 }
139139
140- public function previousAll (): self
140+ public function previousAll (): static
141141 {
142142 return $ this ->createSubCrawlerFromXpath ('preceding-sibling::* ' );
143143 }
@@ -149,15 +149,15 @@ public function parents(): self
149149 return $ this ->ancestors ();
150150 }
151151
152- public function ancestors (): self
152+ public function ancestors (): static
153153 {
154154 return $ this ->createSubCrawlerFromXpath ('ancestor::* ' , true );
155155 }
156156
157157 /**
158158 * @see https://github.com/symfony/symfony/issues/26432
159159 */
160- public function children (string $ selector = null ): self
160+ public function children (string $ selector = null ): static
161161 {
162162 $ xpath = 'child::* ' ;
163163 if (null !== $ selector ) {
@@ -219,7 +219,7 @@ public function html(string $default = null): string
219219 }
220220 }
221221
222- public function evaluate ($ xpath ): self
222+ public function evaluate ($ xpath ): static
223223 {
224224 throw $ this ->createNotSupportedException (__METHOD__ );
225225 }
@@ -241,29 +241,29 @@ public function extract($attributes): array
241241 return $ data ;
242242 }
243243
244- public function filterXPath ($ xpath ): self
244+ public function filterXPath ($ xpath ): static
245245 {
246246 return $ this ->filterWebDriverBy (WebDriverBy::xpath ($ xpath ));
247247 }
248248
249- public function filter ($ selector ): self
249+ public function filter ($ selector ): static
250250 {
251251 return $ this ->filterWebDriverBy (WebDriverBy::cssSelector ($ selector ));
252252 }
253253
254- public function selectLink ($ value ): self
254+ public function selectLink ($ value ): static
255255 {
256256 return $ this ->selectFromXpath (
257257 sprintf ('descendant-or-self::a[contains(concat( \' \', normalize-space(string(.)), \' \'), %1$s) or ./img[contains(concat( \' \', normalize-space(string(@alt)), \' \'), %1$s)]] ' , self ::xpathLiteral (' ' .$ value .' ' ))
258258 );
259259 }
260260
261- public function selectImage ($ value ): self
261+ public function selectImage ($ value ): static
262262 {
263263 return $ this ->selectFromXpath (sprintf ('descendant-or-self::img[contains(normalize-space(string(@alt)), %s)] ' , self ::xpathLiteral ($ value )));
264264 }
265265
266- public function selectButton ($ value ): self
266+ public function selectButton ($ value ): static
267267 {
268268 return $ this ->selectFromXpath (
269269 sprintf (
0 commit comments