Skip to content

Commit

Permalink
Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_…
Browse files Browse the repository at this point in the history
…null_value
  • Loading branch information
nicolas-grekas committed Jan 23, 2024
1 parent 728f1fc commit e3b4806
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion AbstractUriElement.php
Expand Up @@ -40,7 +40,7 @@ abstract class AbstractUriElement
*
* @throws \InvalidArgumentException if the node is not a link
*/
public function __construct(\DOMElement $node, string $currentUri = null, ?string $method = 'GET')
public function __construct(\DOMElement $node, ?string $currentUri = null, ?string $method = 'GET')
{
$this->setNode($node);
$this->method = $method ? strtoupper($method) : null;
Expand Down
14 changes: 7 additions & 7 deletions Crawler.php
Expand Up @@ -81,7 +81,7 @@ class Crawler implements \Countable, \IteratorAggregate
/**
* @param \DOMNodeList|\DOMNode|\DOMNode[]|string|null $node A Node to use as the base for the crawling
*/
public function __construct($node = null, string $uri = null, string $baseHref = null)
public function __construct($node = null, ?string $uri = null, ?string $baseHref = null)
{
$this->uri = $uri;
$this->baseHref = $baseHref ?: $uri;
Expand Down Expand Up @@ -153,7 +153,7 @@ public function add($node)
* or ISO-8859-1 as a fallback, which is the default charset defined by the
* HTTP 1.1 specification.
*/
public function addContent(string $content, string $type = null)
public function addContent(string $content, ?string $type = null)
{
if (empty($type)) {
$type = str_starts_with($content, '<?xml') ? 'application/xml' : 'text/html';
Expand Down Expand Up @@ -366,7 +366,7 @@ public function each(\Closure $closure)
*
* @return static
*/
public function slice(int $offset = 0, int $length = null)
public function slice(int $offset = 0, ?int $length = null)
{
return $this->createSubCrawler(\array_slice($this->nodes, $offset, $length));
}
Expand Down Expand Up @@ -546,7 +546,7 @@ public function ancestors()
* @throws \InvalidArgumentException When current node is empty
* @throws \RuntimeException If the CssSelector Component is not available and $selector is provided
*/
public function children(string $selector = null)
public function children(?string $selector = null)
{
if (!$this->nodes) {
throw new \InvalidArgumentException('The current node list is empty.');
Expand Down Expand Up @@ -610,7 +610,7 @@ public function nodeName()
*
* @throws \InvalidArgumentException When current node is empty
*/
public function text(string $default = null, bool $normalizeWhitespace = true)
public function text(?string $default = null, bool $normalizeWhitespace = true)
{
if (!$this->nodes) {
if (null !== $default) {
Expand Down Expand Up @@ -646,7 +646,7 @@ public function innerText(): string
*
* @throws \InvalidArgumentException When current node is empty
*/
public function html(string $default = null)
public function html(?string $default = null)
{
if (!$this->nodes) {
if (null !== $default) {
Expand Down Expand Up @@ -915,7 +915,7 @@ public function images()
*
* @throws \InvalidArgumentException If the current node list is empty or the selected node is not instance of DOMElement
*/
public function form(array $values = null, string $method = null)
public function form(?array $values = null, ?string $method = null)
{
if (!$this->nodes) {
throw new \InvalidArgumentException('The current node list is empty.');
Expand Down
2 changes: 1 addition & 1 deletion Form.php
Expand Up @@ -44,7 +44,7 @@ class Form extends Link implements \ArrayAccess
*
* @throws \LogicException if the node is not a button inside a form tag
*/
public function __construct(\DOMElement $node, string $currentUri = null, string $method = null, string $baseHref = null)
public function __construct(\DOMElement $node, ?string $currentUri = null, ?string $method = null, ?string $baseHref = null)
{
parent::__construct($node, $currentUri, $method);
$this->baseHref = $baseHref;
Expand Down
2 changes: 1 addition & 1 deletion Image.php
Expand Up @@ -16,7 +16,7 @@
*/
class Image extends AbstractUriElement
{
public function __construct(\DOMElement $node, string $currentUri = null)
public function __construct(\DOMElement $node, ?string $currentUri = null)
{
parent::__construct($node, $currentUri, 'GET');
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/AbstractCrawlerTestCase.php
Expand Up @@ -24,7 +24,7 @@ abstract class AbstractCrawlerTestCase extends TestCase

abstract public static function getDoctype(): string;

protected function createCrawler($node = null, string $uri = null, string $baseHref = null)
protected function createCrawler($node = null, ?string $uri = null, ?string $baseHref = null)
{
return new Crawler($node, $uri, $baseHref);
}
Expand Down

0 comments on commit e3b4806

Please sign in to comment.