@@ -64,7 +64,7 @@ class Crawler implements \Countable, \IteratorAggregate
64
64
/**
65
65
* @param \DOMNodeList|\DOMNode|\DOMNode[]|string|null $node A Node to use as the base for the crawling
66
66
*/
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 )
68
68
{
69
69
$ this ->uri = $ uri ;
70
70
$ this ->baseHref = $ baseHref ?: $ uri ;
@@ -138,7 +138,7 @@ public function add(\DOMNodeList|\DOMNode|array|string|null $node)
138
138
*
139
139
* @return void
140
140
*/
141
- public function addContent (string $ content , string $ type = null )
141
+ public function addContent (string $ content , ? string $ type = null )
142
142
{
143
143
if (empty ($ type )) {
144
144
$ type = str_starts_with ($ content , '<?xml ' ) ? 'application/xml ' : 'text/html ' ;
@@ -351,7 +351,7 @@ public function each(\Closure $closure): array
351
351
/**
352
352
* Slices the list of nodes by $offset and $length.
353
353
*/
354
- public function slice (int $ offset = 0 , int $ length = null ): static
354
+ public function slice (int $ offset = 0 , ? int $ length = null ): static
355
355
{
356
356
return $ this ->createSubCrawler (\array_slice ($ this ->nodes , $ offset , $ length ));
357
357
}
@@ -501,7 +501,7 @@ public function ancestors(): static
501
501
* @throws \InvalidArgumentException When current node is empty
502
502
* @throws \RuntimeException If the CssSelector Component is not available and $selector is provided
503
503
*/
504
- public function children (string $ selector = null ): static
504
+ public function children (? string $ selector = null ): static
505
505
{
506
506
if (!$ this ->nodes ) {
507
507
throw new \InvalidArgumentException ('The current node list is empty. ' );
@@ -559,7 +559,7 @@ public function nodeName(): string
559
559
*
560
560
* @throws \InvalidArgumentException When current node is empty
561
561
*/
562
- public function text (string $ default = null , bool $ normalizeWhitespace = true ): string
562
+ public function text (? string $ default = null , bool $ normalizeWhitespace = true ): string
563
563
{
564
564
if (!$ this ->nodes ) {
565
565
if (null !== $ default ) {
@@ -609,7 +609,7 @@ public function innerText(/* bool $normalizeWhitespace = true */): string
609
609
*
610
610
* @throws \InvalidArgumentException When current node is empty
611
611
*/
612
- public function html (string $ default = null ): string
612
+ public function html (? string $ default = null ): string
613
613
{
614
614
if (!$ this ->nodes ) {
615
615
if (null !== $ default ) {
@@ -858,7 +858,7 @@ public function images(): array
858
858
*
859
859
* @throws \InvalidArgumentException If the current node list is empty or the selected node is not instance of DOMElement
860
860
*/
861
- public function form (array $ values = null , string $ method = null ): Form
861
+ public function form (? array $ values = null , ? string $ method = null ): Form
862
862
{
863
863
if (!$ this ->nodes ) {
864
864
throw new \InvalidArgumentException ('The current node list is empty. ' );
0 commit comments