@@ -60,7 +60,7 @@ class Crawler implements \Countable, \IteratorAggregate
60
60
/**
61
61
* @param \DOMNodeList|\DOMNode|\DOMNode[]|string|null $node A Node to use as the base for the crawling
62
62
*/
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 )
64
64
{
65
65
$ this ->uri = $ uri ;
66
66
$ this ->baseHref = $ baseHref ?: $ uri ;
@@ -128,7 +128,7 @@ public function add(\DOMNodeList|\DOMNode|array|string|null $node): void
128
128
* or ISO-8859-1 as a fallback, which is the default charset defined by the
129
129
* HTTP 1.1 specification.
130
130
*/
131
- public function addContent (string $ content , string $ type = null ): void
131
+ public function addContent (string $ content , ? string $ type = null ): void
132
132
{
133
133
if (empty ($ type )) {
134
134
$ type = str_starts_with ($ content , '<?xml ' ) ? 'application/xml ' : 'text/html ' ;
@@ -329,7 +329,7 @@ public function each(\Closure $closure): array
329
329
/**
330
330
* Slices the list of nodes by $offset and $length.
331
331
*/
332
- public function slice (int $ offset = 0 , int $ length = null ): static
332
+ public function slice (int $ offset = 0 , ? int $ length = null ): static
333
333
{
334
334
return $ this ->createSubCrawler (\array_slice ($ this ->nodes , $ offset , $ length ));
335
335
}
@@ -479,7 +479,7 @@ public function ancestors(): static
479
479
* @throws \InvalidArgumentException When current node is empty
480
480
* @throws \RuntimeException If the CssSelector Component is not available and $selector is provided
481
481
*/
482
- public function children (string $ selector = null ): static
482
+ public function children (? string $ selector = null ): static
483
483
{
484
484
if (!$ this ->nodes ) {
485
485
throw new \InvalidArgumentException ('The current node list is empty. ' );
@@ -504,7 +504,7 @@ public function children(string $selector = null): static
504
504
*
505
505
* @throws \InvalidArgumentException When current node is empty
506
506
*/
507
- public function attr (string $ attribute , string $ default = null ): ?string
507
+ public function attr (string $ attribute , ? string $ default = null ): ?string
508
508
{
509
509
if (!$ this ->nodes ) {
510
510
if (null !== $ default ) {
@@ -543,7 +543,7 @@ public function nodeName(): string
543
543
*
544
544
* @throws \InvalidArgumentException When current node is empty
545
545
*/
546
- public function text (string $ default = null , bool $ normalizeWhitespace = true ): string
546
+ public function text (? string $ default = null , bool $ normalizeWhitespace = true ): string
547
547
{
548
548
if (!$ this ->nodes ) {
549
549
if (null !== $ default ) {
@@ -591,7 +591,7 @@ public function innerText(bool $normalizeWhitespace = true): string
591
591
*
592
592
* @throws \InvalidArgumentException When current node is empty
593
593
*/
594
- public function html (string $ default = null ): string
594
+ public function html (? string $ default = null ): string
595
595
{
596
596
if (!$ this ->nodes ) {
597
597
if (null !== $ default ) {
@@ -840,7 +840,7 @@ public function images(): array
840
840
*
841
841
* @throws \InvalidArgumentException If the current node list is empty or the selected node is not instance of DOMElement
842
842
*/
843
- public function form (array $ values = null , string $ method = null ): Form
843
+ public function form (? array $ values = null , ? string $ method = null ): Form
844
844
{
845
845
if (!$ this ->nodes ) {
846
846
throw new \InvalidArgumentException ('The current node list is empty. ' );
0 commit comments