Skip to content

Commit e3b4806

Browse files
Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value
1 parent 728f1fc commit e3b4806

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

AbstractUriElement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ abstract class AbstractUriElement
4040
*
4141
* @throws \InvalidArgumentException if the node is not a link
4242
*/
43-
public function __construct(\DOMElement $node, string $currentUri = null, ?string $method = 'GET')
43+
public function __construct(\DOMElement $node, ?string $currentUri = null, ?string $method = 'GET')
4444
{
4545
$this->setNode($node);
4646
$this->method = $method ? strtoupper($method) : null;

Crawler.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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.');

Form.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Form extends Link implements \ArrayAccess
4444
*
4545
* @throws \LogicException if the node is not a button inside a form tag
4646
*/
47-
public function __construct(\DOMElement $node, string $currentUri = null, string $method = null, string $baseHref = null)
47+
public function __construct(\DOMElement $node, ?string $currentUri = null, ?string $method = null, ?string $baseHref = null)
4848
{
4949
parent::__construct($node, $currentUri, $method);
5050
$this->baseHref = $baseHref;

Image.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717
class Image extends AbstractUriElement
1818
{
19-
public function __construct(\DOMElement $node, string $currentUri = null)
19+
public function __construct(\DOMElement $node, ?string $currentUri = null)
2020
{
2121
parent::__construct($node, $currentUri, 'GET');
2222
}

Tests/AbstractCrawlerTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ abstract class AbstractCrawlerTestCase extends TestCase
2424

2525
abstract public static function getDoctype(): string;
2626

27-
protected function createCrawler($node = null, string $uri = null, string $baseHref = null)
27+
protected function createCrawler($node = null, ?string $uri = null, ?string $baseHref = null)
2828
{
2929
return new Crawler($node, $uri, $baseHref);
3030
}

0 commit comments

Comments
 (0)