@@ -63,7 +63,7 @@ class Crawler implements \Countable, \IteratorAggregate
6363 /**
6464 * @param \DOMNodeList|\DOMNode|\DOMNode[]|string|null $node A Node to use as the base for the crawling
6565 */
66- public function __construct (\DOMNodeList |\DOMNode |array |string $ node = null , string $ uri = null , string $ baseHref = null , bool $ useHtml5Parser = true )
66+ public function __construct (\DOMNodeList |\DOMNode |array |string | null $ node = null , ? string $ uri = null , ? string $ baseHref = null , bool $ useHtml5Parser = true )
6767 {
6868 $ this ->uri = $ uri ;
6969 $ this ->baseHref = $ baseHref ?: $ uri ;
@@ -137,7 +137,7 @@ public function add(\DOMNodeList|\DOMNode|array|string|null $node)
137137 *
138138 * @return void
139139 */
140- public function addContent (string $ content , string $ type = null )
140+ public function addContent (string $ content , ? string $ type = null )
141141 {
142142 if (empty ($ type )) {
143143 $ type = str_starts_with ($ content , '<?xml ' ) ? 'application/xml ' : 'text/html ' ;
@@ -350,7 +350,7 @@ public function each(\Closure $closure): array
350350 /**
351351 * Slices the list of nodes by $offset and $length.
352352 */
353- public function slice (int $ offset = 0 , int $ length = null ): static
353+ public function slice (int $ offset = 0 , ? int $ length = null ): static
354354 {
355355 return $ this ->createSubCrawler (\array_slice ($ this ->nodes , $ offset , $ length ));
356356 }
@@ -500,7 +500,7 @@ public function ancestors(): static
500500 * @throws \InvalidArgumentException When current node is empty
501501 * @throws \RuntimeException If the CssSelector Component is not available and $selector is provided
502502 */
503- public function children (string $ selector = null ): static
503+ public function children (? string $ selector = null ): static
504504 {
505505 if (!$ this ->nodes ) {
506506 throw new \InvalidArgumentException ('The current node list is empty. ' );
@@ -565,7 +565,7 @@ public function nodeName(): string
565565 *
566566 * @throws \InvalidArgumentException When current node is empty
567567 */
568- public function text (string $ default = null , bool $ normalizeWhitespace = true ): string
568+ public function text (? string $ default = null , bool $ normalizeWhitespace = true ): string
569569 {
570570 if (!$ this ->nodes ) {
571571 if (null !== $ default ) {
@@ -615,7 +615,7 @@ public function innerText(/* bool $normalizeWhitespace = true */): string
615615 *
616616 * @throws \InvalidArgumentException When current node is empty
617617 */
618- public function html (string $ default = null ): string
618+ public function html (? string $ default = null ): string
619619 {
620620 if (!$ this ->nodes ) {
621621 if (null !== $ default ) {
@@ -864,7 +864,7 @@ public function images(): array
864864 *
865865 * @throws \InvalidArgumentException If the current node list is empty or the selected node is not instance of DOMElement
866866 */
867- public function form (array $ values = null , string $ method = null ): Form
867+ public function form (? array $ values = null , ? string $ method = null ): Form
868868 {
869869 if (!$ this ->nodes ) {
870870 throw new \InvalidArgumentException ('The current node list is empty. ' );
0 commit comments