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 0ed1f63 commit 2f6f979
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions AbstractBrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ abstract class AbstractBrowser
/**
* @param array $server The server parameters (equivalent of $_SERVER)
*/
public function __construct(array $server = [], History $history = null, CookieJar $cookieJar = null)
public function __construct(array $server = [], ?History $history = null, ?CookieJar $cookieJar = null)
{
$this->setServerParameters($server);
$this->history = $history ?? new History();
Expand Down Expand Up @@ -146,7 +146,7 @@ public function getServerParameter(string $key, $default = '')
return $this->server[$key] ?? $default;
}

public function xmlHttpRequest(string $method, string $uri, array $parameters = [], array $files = [], array $server = [], string $content = null, bool $changeHistory = true): Crawler
public function xmlHttpRequest(string $method, string $uri, array $parameters = [], array $files = [], array $server = [], ?string $content = null, bool $changeHistory = true): Crawler
{
$this->setServerParameter('HTTP_X_REQUESTED_WITH', 'XMLHttpRequest');

Expand Down Expand Up @@ -352,7 +352,7 @@ public function submitForm(string $button, array $fieldValues = [], string $meth
*
* @return Crawler
*/
public function request(string $method, string $uri, array $parameters = [], array $files = [], array $server = [], string $content = null, bool $changeHistory = true)
public function request(string $method, string $uri, array $parameters = [], array $files = [], array $server = [], ?string $content = null, bool $changeHistory = true)
{
if ($this->isMainRequest) {
$this->redirectCount = 0;
Expand Down
4 changes: 2 additions & 2 deletions Cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Cookie
* @param bool $encodedValue Whether the value is encoded or not
* @param string|null $samesite The cookie samesite attribute
*/
public function __construct(string $name, ?string $value, string $expires = null, string $path = null, string $domain = '', bool $secure = false, bool $httponly = true, bool $encodedValue = false, string $samesite = null)
public function __construct(string $name, ?string $value, ?string $expires = null, ?string $path = null, string $domain = '', bool $secure = false, bool $httponly = true, bool $encodedValue = false, ?string $samesite = null)
{
if ($encodedValue) {
$this->value = urldecode($value);
Expand Down Expand Up @@ -125,7 +125,7 @@ public function __toString()
*
* @throws \InvalidArgumentException
*/
public static function fromString(string $cookie, string $url = null)
public static function fromString(string $cookie, ?string $url = null)
{
$parts = explode(';', $cookie);

Expand Down
8 changes: 4 additions & 4 deletions CookieJar.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function set(Cookie $cookie)
*
* @return Cookie|null
*/
public function get(string $name, string $path = '/', string $domain = null)
public function get(string $name, string $path = '/', ?string $domain = null)
{
$this->flushExpiredCookies();

Expand Down Expand Up @@ -67,7 +67,7 @@ public function get(string $name, string $path = '/', string $domain = null)
* all cookies for the given name/path expire (this behavior
* ensures a BC behavior with previous versions of Symfony).
*/
public function expire(string $name, ?string $path = '/', string $domain = null)
public function expire(string $name, ?string $path = '/', ?string $domain = null)
{
if (null === $path) {
$path = '/';
Expand Down Expand Up @@ -107,7 +107,7 @@ public function clear()
*
* @param string[] $setCookies Set-Cookie headers from an HTTP response
*/
public function updateFromSetCookie(array $setCookies, string $uri = null)
public function updateFromSetCookie(array $setCookies, ?string $uri = null)
{
$cookies = [];

Expand All @@ -133,7 +133,7 @@ public function updateFromSetCookie(array $setCookies, string $uri = null)
/**
* Updates the cookie jar from a Response object.
*/
public function updateFromResponse(Response $response, string $uri = null)
public function updateFromResponse(Response $response, ?string $uri = null)
{
$this->updateFromSetCookie($response->getHeader('Set-Cookie', false), $uri);
}
Expand Down
2 changes: 1 addition & 1 deletion HttpBrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class HttpBrowser extends AbstractBrowser
{
private $client;

public function __construct(HttpClientInterface $client = null, History $history = null, CookieJar $cookieJar = null)
public function __construct(?HttpClientInterface $client = null, ?History $history = null, ?CookieJar $cookieJar = null)
{
if (!$client && !class_exists(HttpClient::class)) {
throw new \LogicException(sprintf('You cannot use "%s" as the HttpClient component is not installed. Try running "composer require symfony/http-client".', __CLASS__));
Expand Down
2 changes: 1 addition & 1 deletion Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Request
* @param array $server An array of server parameters
* @param string $content The raw body data
*/
public function __construct(string $uri, string $method, array $parameters = [], array $files = [], array $cookies = [], array $server = [], string $content = null)
public function __construct(string $uri, string $method, array $parameters = [], array $files = [], array $cookies = [], array $server = [], ?string $content = null)
{
$this->uri = $uri;
$this->method = $method;
Expand Down
2 changes: 1 addition & 1 deletion Test/Constraint/BrowserCookieValueSame.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class BrowserCookieValueSame extends Constraint
private $path;
private $domain;

public function __construct(string $name, string $value, bool $raw = false, string $path = '/', string $domain = null)
public function __construct(string $name, string $value, bool $raw = false, string $path = '/', ?string $domain = null)
{
$this->name = $name;
$this->path = $path;
Expand Down
2 changes: 1 addition & 1 deletion Test/Constraint/BrowserHasCookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final class BrowserHasCookie extends Constraint
private $path;
private $domain;

public function __construct(string $name, string $path = '/', string $domain = null)
public function __construct(string $name, string $path = '/', ?string $domain = null)
{
$this->name = $name;
$this->path = $path;
Expand Down
2 changes: 1 addition & 1 deletion Tests/AbstractBrowserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

class AbstractBrowserTest extends TestCase
{
public function getBrowser(array $server = [], History $history = null, CookieJar $cookieJar = null)
public function getBrowser(array $server = [], ?History $history = null, ?CookieJar $cookieJar = null)
{
return new TestClient($server, $history, $cookieJar);
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/HttpBrowserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

class HttpBrowserTest extends AbstractBrowserTest
{
public function getBrowser(array $server = [], History $history = null, CookieJar $cookieJar = null)
public function getBrowser(array $server = [], ?History $history = null, ?CookieJar $cookieJar = null)
{
return new TestHttpClient($server, $history, $cookieJar);
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/TestHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class TestHttpClient extends HttpBrowser
protected $nextResponse = null;
protected $nextScript = null;

public function __construct(array $server = [], History $history = null, CookieJar $cookieJar = null)
public function __construct(array $server = [], ?History $history = null, ?CookieJar $cookieJar = null)
{
$client = new MockHttpClient(function (string $method, string $url, array $options) {
if (null === $this->nextResponse) {
Expand Down

0 comments on commit 2f6f979

Please sign in to comment.