@@ -64,7 +64,7 @@ class Crawler implements \Countable, \IteratorAggregate
6464 /**
6565 * @param \DOMNodeList|\DOMNode|\DOMNode[]|string|null $node A Node to use as the base for the crawling
6666 */
67- public function __construct (\DOMNodeList |\DOMNode |array |string $ node = null , string $ uri = null , string $ baseHref = null , bool $ useHtml5Parser = true )
67+ public function __construct (\DOMNodeList |\DOMNode |array |string | null $ node = null , ? string $ uri = null , ? string $ baseHref = null , bool $ useHtml5Parser = true )
6868 {
6969 $ this ->uri = $ uri ;
7070 $ this ->baseHref = $ baseHref ?: $ uri ;
@@ -138,7 +138,7 @@ public function add(\DOMNodeList|\DOMNode|array|string|null $node)
138138 *
139139 * @return void
140140 */
141- public function addContent (string $ content , string $ type = null )
141+ public function addContent (string $ content , ? string $ type = null )
142142 {
143143 if (empty ($ type )) {
144144 $ type = str_starts_with ($ content , '<?xml ' ) ? 'application/xml ' : 'text/html ' ;
@@ -351,7 +351,7 @@ public function each(\Closure $closure): array
351351 /**
352352 * Slices the list of nodes by $offset and $length.
353353 */
354- public function slice (int $ offset = 0 , int $ length = null ): static
354+ public function slice (int $ offset = 0 , ? int $ length = null ): static
355355 {
356356 return $ this ->createSubCrawler (\array_slice ($ this ->nodes , $ offset , $ length ));
357357 }
@@ -501,7 +501,7 @@ public function ancestors(): static
501501 * @throws \InvalidArgumentException When current node is empty
502502 * @throws \RuntimeException If the CssSelector Component is not available and $selector is provided
503503 */
504- public function children (string $ selector = null ): static
504+ public function children (? string $ selector = null ): static
505505 {
506506 if (!$ this ->nodes ) {
507507 throw new \InvalidArgumentException ('The current node list is empty. ' );
@@ -559,7 +559,7 @@ public function nodeName(): string
559559 *
560560 * @throws \InvalidArgumentException When current node is empty
561561 */
562- public function text (string $ default = null , bool $ normalizeWhitespace = true ): string
562+ public function text (? string $ default = null , bool $ normalizeWhitespace = true ): string
563563 {
564564 if (!$ this ->nodes ) {
565565 if (null !== $ default ) {
@@ -609,7 +609,7 @@ public function innerText(/* bool $normalizeWhitespace = true */): string
609609 *
610610 * @throws \InvalidArgumentException When current node is empty
611611 */
612- public function html (string $ default = null ): string
612+ public function html (? string $ default = null ): string
613613 {
614614 if (!$ this ->nodes ) {
615615 if (null !== $ default ) {
@@ -858,7 +858,7 @@ public function images(): array
858858 *
859859 * @throws \InvalidArgumentException If the current node list is empty or the selected node is not instance of DOMElement
860860 */
861- public function form (array $ values = null , string $ method = null ): Form
861+ public function form (? array $ values = null , ? string $ method = null ): Form
862862 {
863863 if (!$ this ->nodes ) {
864864 throw new \InvalidArgumentException ('The current node list is empty. ' );
0 commit comments