Skip to content

Commit f2ab692

Browse files
Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value
1 parent 528f59f commit f2ab692

30 files changed

+55
-55
lines changed

BinaryFileResponse.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class BinaryFileResponse extends Response
4545
* @param bool $autoEtag Whether the ETag header should be automatically set
4646
* @param bool $autoLastModified Whether the Last-Modified header should be automatically set
4747
*/
48-
public function __construct($file, int $status = 200, array $headers = [], bool $public = true, string $contentDisposition = null, bool $autoEtag = false, bool $autoLastModified = true)
48+
public function __construct($file, int $status = 200, array $headers = [], bool $public = true, ?string $contentDisposition = null, bool $autoEtag = false, bool $autoLastModified = true)
4949
{
5050
parent::__construct(null, $status, $headers);
5151

@@ -69,7 +69,7 @@ public function __construct($file, int $status = 200, array $headers = [], bool
6969
*
7070
* @deprecated since Symfony 5.2, use __construct() instead.
7171
*/
72-
public static function create($file = null, int $status = 200, array $headers = [], bool $public = true, string $contentDisposition = null, bool $autoEtag = false, bool $autoLastModified = true)
72+
public static function create($file = null, int $status = 200, array $headers = [], bool $public = true, ?string $contentDisposition = null, bool $autoEtag = false, bool $autoLastModified = true)
7373
{
7474
trigger_deprecation('symfony/http-foundation', '5.2', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, static::class);
7575

@@ -85,7 +85,7 @@ public static function create($file = null, int $status = 200, array $headers =
8585
*
8686
* @throws FileException
8787
*/
88-
public function setFile($file, string $contentDisposition = null, bool $autoEtag = false, bool $autoLastModified = true)
88+
public function setFile($file, ?string $contentDisposition = null, bool $autoEtag = false, bool $autoLastModified = true)
8989
{
9090
if (!$file instanceof File) {
9191
if ($file instanceof \SplFileInfo) {

Cookie.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public static function fromString(string $cookie, bool $decode = false)
7171
return new static($name, $value, $data['expires'], $data['path'], $data['domain'], $data['secure'], $data['httponly'], $data['raw'], $data['samesite']);
7272
}
7373

74-
public static function create(string $name, string $value = null, $expire = 0, ?string $path = '/', string $domain = null, bool $secure = null, bool $httpOnly = true, bool $raw = false, ?string $sameSite = self::SAMESITE_LAX): self
74+
public static function create(string $name, ?string $value = null, $expire = 0, ?string $path = '/', ?string $domain = null, ?bool $secure = null, bool $httpOnly = true, bool $raw = false, ?string $sameSite = self::SAMESITE_LAX): self
7575
{
7676
return new self($name, $value, $expire, $path, $domain, $secure, $httpOnly, $raw, $sameSite);
7777
}
@@ -89,7 +89,7 @@ public static function create(string $name, string $value = null, $expire = 0, ?
8989
*
9090
* @throws \InvalidArgumentException
9191
*/
92-
public function __construct(string $name, string $value = null, $expire = 0, ?string $path = '/', string $domain = null, bool $secure = null, bool $httpOnly = true, bool $raw = false, ?string $sameSite = 'lax')
92+
public function __construct(string $name, ?string $value = null, $expire = 0, ?string $path = '/', ?string $domain = null, ?bool $secure = null, bool $httpOnly = true, bool $raw = false, ?string $sameSite = 'lax')
9393
{
9494
// from PHP source code
9595
if ($raw && false !== strpbrk($name, self::RESERVED_CHARS_LIST)) {

Exception/SessionNotFoundException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
class SessionNotFoundException extends \LogicException implements RequestExceptionInterface
2222
{
23-
public function __construct(string $message = 'There is currently no session available.', int $code = 0, \Throwable $previous = null)
23+
public function __construct(string $message = 'There is currently no session available.', int $code = 0, ?\Throwable $previous = null)
2424
{
2525
parent::__construct($message, $code, $previous);
2626
}

File/File.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function getMimeType()
8888
*
8989
* @throws FileException if the target file could not be created
9090
*/
91-
public function move(string $directory, string $name = null)
91+
public function move(string $directory, ?string $name = null)
9292
{
9393
$target = $this->getTargetFile($directory, $name);
9494

@@ -121,7 +121,7 @@ public function getContent(): string
121121
/**
122122
* @return self
123123
*/
124-
protected function getTargetFile(string $directory, string $name = null)
124+
protected function getTargetFile(string $directory, ?string $name = null)
125125
{
126126
if (!is_dir($directory)) {
127127
if (false === @mkdir($directory, 0777, true) && !is_dir($directory)) {

File/UploadedFile.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class UploadedFile extends File
6060
* @throws FileException If file_uploads is disabled
6161
* @throws FileNotFoundException If the file does not exist
6262
*/
63-
public function __construct(string $path, string $originalName, string $mimeType = null, int $error = null, bool $test = false)
63+
public function __construct(string $path, string $originalName, ?string $mimeType = null, ?int $error = null, bool $test = false)
6464
{
6565
$this->originalName = $this->getName($originalName);
6666
$this->mimeType = $mimeType ?: 'application/octet-stream';
@@ -172,7 +172,7 @@ public function isValid()
172172
*
173173
* @throws FileException if, for any reason, the file could not have been moved
174174
*/
175-
public function move(string $directory, string $name = null)
175+
public function move(string $directory, ?string $name = null)
176176
{
177177
if ($this->isValid()) {
178178
if ($this->test) {

HeaderBag.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function __toString()
6767
*
6868
* @return array<string, array<int, string|null>>|array<int, string|null>
6969
*/
70-
public function all(string $key = null)
70+
public function all(?string $key = null)
7171
{
7272
if (null !== $key) {
7373
return $this->headers[strtr($key, self::UPPER, self::LOWER)] ?? [];
@@ -110,7 +110,7 @@ public function add(array $headers)
110110
*
111111
* @return string|null
112112
*/
113-
public function get(string $key, string $default = null)
113+
public function get(string $key, ?string $default = null)
114114
{
115115
$headers = $this->all($key);
116116

@@ -197,7 +197,7 @@ public function remove(string $key)
197197
*
198198
* @throws \RuntimeException When the HTTP header is not parseable
199199
*/
200-
public function getDate(string $key, \DateTime $default = null)
200+
public function getDate(string $key, ?\DateTime $default = null)
201201
{
202202
if (null === $value = $this->get($key)) {
203203
return $default;

InputBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function get(string $key, $default = null)
4545
/**
4646
* {@inheritdoc}
4747
*/
48-
public function all(string $key = null): array
48+
public function all(?string $key = null): array
4949
{
5050
return parent::all($key);
5151
}

JsonResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public static function fromJsonString(string $data, int $status = 200, array $he
105105
*
106106
* @throws \InvalidArgumentException When the callback name is not valid
107107
*/
108-
public function setCallback(string $callback = null)
108+
public function setCallback(?string $callback = null)
109109
{
110110
if (null !== $callback) {
111111
// partially taken from https://geekality.net/2011/08/03/valid-javascript-identifier/

Request.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ public static function setFactory(?callable $callable)
451451
*
452452
* @return static
453453
*/
454-
public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null)
454+
public function duplicate(?array $query = null, ?array $request = null, ?array $attributes = null, ?array $cookies = null, ?array $files = null, ?array $server = null)
455455
{
456456
$dup = clone $this;
457457
if (null !== $query) {
@@ -1651,7 +1651,7 @@ public function getPreferredFormat(?string $default = 'html'): ?string
16511651
*
16521652
* @return string|null
16531653
*/
1654-
public function getPreferredLanguage(array $locales = null)
1654+
public function getPreferredLanguage(?array $locales = null)
16551655
{
16561656
$preferredLanguages = $this->getLanguages();
16571657

@@ -2061,7 +2061,7 @@ public function isFromTrustedProxy()
20612061
return self::$trustedProxies && IpUtils::checkIp($this->server->get('REMOTE_ADDR', ''), self::$trustedProxies);
20622062
}
20632063

2064-
private function getTrustedValues(int $type, string $ip = null): array
2064+
private function getTrustedValues(int $type, ?string $ip = null): array
20652065
{
20662066
$clientValues = [];
20672067
$forwardedValues = [];

RequestMatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class RequestMatcher implements RequestMatcherInterface
5858
* @param string|string[]|null $ips
5959
* @param string|string[]|null $schemes
6060
*/
61-
public function __construct(string $path = null, string $host = null, $methods = null, $ips = null, array $attributes = [], $schemes = null, int $port = null)
61+
public function __construct(?string $path = null, ?string $host = null, $methods = null, $ips = null, array $attributes = [], $schemes = null, ?int $port = null)
6262
{
6363
$this->matchPath($path);
6464
$this->matchHost($host);

0 commit comments

Comments
 (0)