@@ -81,7 +81,7 @@ class Crawler implements \Countable, \IteratorAggregate
8181 /**
8282 * @param \DOMNodeList|\DOMNode|\DOMNode[]|string|null $node A Node to use as the base for the crawling
8383 */
84- public function __construct ($ node = null , string $ uri = null , string $ baseHref = null )
84+ public function __construct ($ node = null , ? string $ uri = null , ? string $ baseHref = null )
8585 {
8686 $ this ->uri = $ uri ;
8787 $ this ->baseHref = $ baseHref ?: $ uri ;
@@ -153,7 +153,7 @@ public function add($node)
153153 * or ISO-8859-1 as a fallback, which is the default charset defined by the
154154 * HTTP 1.1 specification.
155155 */
156- public function addContent (string $ content , string $ type = null )
156+ public function addContent (string $ content , ? string $ type = null )
157157 {
158158 if (empty ($ type )) {
159159 $ type = str_starts_with ($ content , '<?xml ' ) ? 'application/xml ' : 'text/html ' ;
@@ -366,7 +366,7 @@ public function each(\Closure $closure)
366366 *
367367 * @return static
368368 */
369- public function slice (int $ offset = 0 , int $ length = null )
369+ public function slice (int $ offset = 0 , ? int $ length = null )
370370 {
371371 return $ this ->createSubCrawler (\array_slice ($ this ->nodes , $ offset , $ length ));
372372 }
@@ -546,7 +546,7 @@ public function ancestors()
546546 * @throws \InvalidArgumentException When current node is empty
547547 * @throws \RuntimeException If the CssSelector Component is not available and $selector is provided
548548 */
549- public function children (string $ selector = null )
549+ public function children (? string $ selector = null )
550550 {
551551 if (!$ this ->nodes ) {
552552 throw new \InvalidArgumentException ('The current node list is empty. ' );
@@ -610,7 +610,7 @@ public function nodeName()
610610 *
611611 * @throws \InvalidArgumentException When current node is empty
612612 */
613- public function text (string $ default = null , bool $ normalizeWhitespace = true )
613+ public function text (? string $ default = null , bool $ normalizeWhitespace = true )
614614 {
615615 if (!$ this ->nodes ) {
616616 if (null !== $ default ) {
@@ -646,7 +646,7 @@ public function innerText(): string
646646 *
647647 * @throws \InvalidArgumentException When current node is empty
648648 */
649- public function html (string $ default = null )
649+ public function html (? string $ default = null )
650650 {
651651 if (!$ this ->nodes ) {
652652 if (null !== $ default ) {
@@ -915,7 +915,7 @@ public function images()
915915 *
916916 * @throws \InvalidArgumentException If the current node list is empty or the selected node is not instance of DOMElement
917917 */
918- public function form (array $ values = null , string $ method = null )
918+ public function form (? array $ values = null , ? string $ method = null )
919919 {
920920 if (!$ this ->nodes ) {
921921 throw new \InvalidArgumentException ('The current node list is empty. ' );
0 commit comments