@@ -60,7 +60,7 @@ class Crawler implements \Countable, \IteratorAggregate
6060 /**
6161 * @param \DOMNodeList|\DOMNode|\DOMNode[]|string|null $node A Node to use as the base for the crawling
6262 */
63- public function __construct (\DOMNodeList |\DOMNode |array |string $ node = null , string $ uri = null , string $ baseHref = null , bool $ useHtml5Parser = true )
63+ public function __construct (\DOMNodeList |\DOMNode |array |string | null $ node = null , ? string $ uri = null , ? string $ baseHref = null , bool $ useHtml5Parser = true )
6464 {
6565 $ this ->uri = $ uri ;
6666 $ this ->baseHref = $ baseHref ?: $ uri ;
@@ -128,7 +128,7 @@ public function add(\DOMNodeList|\DOMNode|array|string|null $node): void
128128 * or ISO-8859-1 as a fallback, which is the default charset defined by the
129129 * HTTP 1.1 specification.
130130 */
131- public function addContent (string $ content , string $ type = null ): void
131+ public function addContent (string $ content , ? string $ type = null ): void
132132 {
133133 if (empty ($ type )) {
134134 $ type = str_starts_with ($ content , '<?xml ' ) ? 'application/xml ' : 'text/html ' ;
@@ -329,7 +329,7 @@ public function each(\Closure $closure): array
329329 /**
330330 * Slices the list of nodes by $offset and $length.
331331 */
332- public function slice (int $ offset = 0 , int $ length = null ): static
332+ public function slice (int $ offset = 0 , ? int $ length = null ): static
333333 {
334334 return $ this ->createSubCrawler (\array_slice ($ this ->nodes , $ offset , $ length ));
335335 }
@@ -479,7 +479,7 @@ public function ancestors(): static
479479 * @throws \InvalidArgumentException When current node is empty
480480 * @throws \RuntimeException If the CssSelector Component is not available and $selector is provided
481481 */
482- public function children (string $ selector = null ): static
482+ public function children (? string $ selector = null ): static
483483 {
484484 if (!$ this ->nodes ) {
485485 throw new \InvalidArgumentException ('The current node list is empty. ' );
@@ -504,7 +504,7 @@ public function children(string $selector = null): static
504504 *
505505 * @throws \InvalidArgumentException When current node is empty
506506 */
507- public function attr (string $ attribute , string $ default = null ): ?string
507+ public function attr (string $ attribute , ? string $ default = null ): ?string
508508 {
509509 if (!$ this ->nodes ) {
510510 if (null !== $ default ) {
@@ -543,7 +543,7 @@ public function nodeName(): string
543543 *
544544 * @throws \InvalidArgumentException When current node is empty
545545 */
546- public function text (string $ default = null , bool $ normalizeWhitespace = true ): string
546+ public function text (? string $ default = null , bool $ normalizeWhitespace = true ): string
547547 {
548548 if (!$ this ->nodes ) {
549549 if (null !== $ default ) {
@@ -591,7 +591,7 @@ public function innerText(bool $normalizeWhitespace = true): string
591591 *
592592 * @throws \InvalidArgumentException When current node is empty
593593 */
594- public function html (string $ default = null ): string
594+ public function html (? string $ default = null ): string
595595 {
596596 if (!$ this ->nodes ) {
597597 if (null !== $ default ) {
@@ -840,7 +840,7 @@ public function images(): array
840840 *
841841 * @throws \InvalidArgumentException If the current node list is empty or the selected node is not instance of DOMElement
842842 */
843- public function form (array $ values = null , string $ method = null ): Form
843+ public function form (? array $ values = null , ? string $ method = null ): Form
844844 {
845845 if (!$ this ->nodes ) {
846846 throw new \InvalidArgumentException ('The current node list is empty. ' );
0 commit comments