@@ -81,7 +81,7 @@ class Crawler implements \Countable, \IteratorAggregate
81
81
/**
82
82
* @param \DOMNodeList|\DOMNode|\DOMNode[]|string|null $node A Node to use as the base for the crawling
83
83
*/
84
- public function __construct ($ node = null , string $ uri = null , string $ baseHref = null )
84
+ public function __construct ($ node = null , ? string $ uri = null , ? string $ baseHref = null )
85
85
{
86
86
$ this ->uri = $ uri ;
87
87
$ this ->baseHref = $ baseHref ?: $ uri ;
@@ -153,7 +153,7 @@ public function add($node)
153
153
* or ISO-8859-1 as a fallback, which is the default charset defined by the
154
154
* HTTP 1.1 specification.
155
155
*/
156
- public function addContent (string $ content , string $ type = null )
156
+ public function addContent (string $ content , ? string $ type = null )
157
157
{
158
158
if (empty ($ type )) {
159
159
$ type = str_starts_with ($ content , '<?xml ' ) ? 'application/xml ' : 'text/html ' ;
@@ -366,7 +366,7 @@ public function each(\Closure $closure)
366
366
*
367
367
* @return static
368
368
*/
369
- public function slice (int $ offset = 0 , int $ length = null )
369
+ public function slice (int $ offset = 0 , ? int $ length = null )
370
370
{
371
371
return $ this ->createSubCrawler (\array_slice ($ this ->nodes , $ offset , $ length ));
372
372
}
@@ -546,7 +546,7 @@ public function ancestors()
546
546
* @throws \InvalidArgumentException When current node is empty
547
547
* @throws \RuntimeException If the CssSelector Component is not available and $selector is provided
548
548
*/
549
- public function children (string $ selector = null )
549
+ public function children (? string $ selector = null )
550
550
{
551
551
if (!$ this ->nodes ) {
552
552
throw new \InvalidArgumentException ('The current node list is empty. ' );
@@ -610,7 +610,7 @@ public function nodeName()
610
610
*
611
611
* @throws \InvalidArgumentException When current node is empty
612
612
*/
613
- public function text (string $ default = null , bool $ normalizeWhitespace = true )
613
+ public function text (? string $ default = null , bool $ normalizeWhitespace = true )
614
614
{
615
615
if (!$ this ->nodes ) {
616
616
if (null !== $ default ) {
@@ -646,7 +646,7 @@ public function innerText(): string
646
646
*
647
647
* @throws \InvalidArgumentException When current node is empty
648
648
*/
649
- public function html (string $ default = null )
649
+ public function html (? string $ default = null )
650
650
{
651
651
if (!$ this ->nodes ) {
652
652
if (null !== $ default ) {
@@ -915,7 +915,7 @@ public function images()
915
915
*
916
916
* @throws \InvalidArgumentException If the current node list is empty or the selected node is not instance of DOMElement
917
917
*/
918
- public function form (array $ values = null , string $ method = null )
918
+ public function form (? array $ values = null , ? string $ method = null )
919
919
{
920
920
if (!$ this ->nodes ) {
921
921
throw new \InvalidArgumentException ('The current node list is empty. ' );
0 commit comments