@@ -63,7 +63,7 @@ class Crawler implements \Countable, \IteratorAggregate
63
63
/**
64
64
* @param \DOMNodeList|\DOMNode|\DOMNode[]|string|null $node A Node to use as the base for the crawling
65
65
*/
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 )
67
67
{
68
68
$ this ->uri = $ uri ;
69
69
$ this ->baseHref = $ baseHref ?: $ uri ;
@@ -137,7 +137,7 @@ public function add(\DOMNodeList|\DOMNode|array|string|null $node)
137
137
*
138
138
* @return void
139
139
*/
140
- public function addContent (string $ content , string $ type = null )
140
+ public function addContent (string $ content , ? string $ type = null )
141
141
{
142
142
if (empty ($ type )) {
143
143
$ type = str_starts_with ($ content , '<?xml ' ) ? 'application/xml ' : 'text/html ' ;
@@ -350,7 +350,7 @@ public function each(\Closure $closure): array
350
350
/**
351
351
* Slices the list of nodes by $offset and $length.
352
352
*/
353
- public function slice (int $ offset = 0 , int $ length = null ): static
353
+ public function slice (int $ offset = 0 , ? int $ length = null ): static
354
354
{
355
355
return $ this ->createSubCrawler (\array_slice ($ this ->nodes , $ offset , $ length ));
356
356
}
@@ -500,7 +500,7 @@ public function ancestors(): static
500
500
* @throws \InvalidArgumentException When current node is empty
501
501
* @throws \RuntimeException If the CssSelector Component is not available and $selector is provided
502
502
*/
503
- public function children (string $ selector = null ): static
503
+ public function children (? string $ selector = null ): static
504
504
{
505
505
if (!$ this ->nodes ) {
506
506
throw new \InvalidArgumentException ('The current node list is empty. ' );
@@ -565,7 +565,7 @@ public function nodeName(): string
565
565
*
566
566
* @throws \InvalidArgumentException When current node is empty
567
567
*/
568
- public function text (string $ default = null , bool $ normalizeWhitespace = true ): string
568
+ public function text (? string $ default = null , bool $ normalizeWhitespace = true ): string
569
569
{
570
570
if (!$ this ->nodes ) {
571
571
if (null !== $ default ) {
@@ -615,7 +615,7 @@ public function innerText(/* bool $normalizeWhitespace = true */): string
615
615
*
616
616
* @throws \InvalidArgumentException When current node is empty
617
617
*/
618
- public function html (string $ default = null ): string
618
+ public function html (? string $ default = null ): string
619
619
{
620
620
if (!$ this ->nodes ) {
621
621
if (null !== $ default ) {
@@ -864,7 +864,7 @@ public function images(): array
864
864
*
865
865
* @throws \InvalidArgumentException If the current node list is empty or the selected node is not instance of DOMElement
866
866
*/
867
- public function form (array $ values = null , string $ method = null ): Form
867
+ public function form (? array $ values = null , ? string $ method = null ): Form
868
868
{
869
869
if (!$ this ->nodes ) {
870
870
throw new \InvalidArgumentException ('The current node list is empty. ' );
0 commit comments