Skip to content

Commit 5677bdf

Browse files
Merge branch '6.3' into 6.4
* 6.3: minor #53524 [Messenger] [AmazonSqs] Allow `async-aws/sqs` version 2 (smoench) Fix bad merge List CS fix in .git-blame-ignore-revs Fix implicitly-required parameters List CS fix in .git-blame-ignore-revs Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value
2 parents 292b163 + 3b72add commit 5677bdf

32 files changed

+59
-59
lines changed

BinaryFileResponse.php

+2-2
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(\SplFileInfo|string $file, int $status = 200, array $headers = [], bool $public = true, string $contentDisposition = null, bool $autoEtag = false, bool $autoLastModified = true)
48+
public function __construct(\SplFileInfo|string $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

@@ -63,7 +63,7 @@ public function __construct(\SplFileInfo|string $file, int $status = 200, array
6363
*
6464
* @throws FileException
6565
*/
66-
public function setFile(\SplFileInfo|string $file, string $contentDisposition = null, bool $autoEtag = false, bool $autoLastModified = true): static
66+
public function setFile(\SplFileInfo|string $file, ?string $contentDisposition = null, bool $autoEtag = false, bool $autoLastModified = true): static
6767
{
6868
if (!$file instanceof File) {
6969
if ($file instanceof \SplFileInfo) {

Cookie.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public static function fromString(string $cookie, bool $decode = false): static
7777
* @param self::SAMESITE_*|''|null $sameSite
7878
* @param bool $partitioned
7979
*/
80-
public static function create(string $name, string $value = null, int|string|\DateTimeInterface $expire = 0, ?string $path = '/', string $domain = null, bool $secure = null, bool $httpOnly = true, bool $raw = false, ?string $sameSite = self::SAMESITE_LAX /* , bool $partitioned = false */): self
80+
public static function create(string $name, ?string $value = null, int|string|\DateTimeInterface $expire = 0, ?string $path = '/', ?string $domain = null, ?bool $secure = null, bool $httpOnly = true, bool $raw = false, ?string $sameSite = self::SAMESITE_LAX /* , bool $partitioned = false */): self
8181
{
8282
$partitioned = 9 < \func_num_args() ? func_get_arg(9) : false;
8383

@@ -97,7 +97,7 @@ public static function create(string $name, string $value = null, int|string|\Da
9797
*
9898
* @throws \InvalidArgumentException
9999
*/
100-
public function __construct(string $name, string $value = null, int|string|\DateTimeInterface $expire = 0, ?string $path = '/', string $domain = null, bool $secure = null, bool $httpOnly = true, bool $raw = false, ?string $sameSite = self::SAMESITE_LAX, bool $partitioned = false)
100+
public function __construct(string $name, ?string $value = null, int|string|\DateTimeInterface $expire = 0, ?string $path = '/', ?string $domain = null, ?bool $secure = null, bool $httpOnly = true, bool $raw = false, ?string $sameSite = self::SAMESITE_LAX, bool $partitioned = false)
101101
{
102102
// from PHP source code
103103
if ($raw && false !== strpbrk($name, self::RESERVED_CHARS_LIST)) {

Exception/SessionNotFoundException.php

+1-1
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

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function getMimeType(): ?string
8282
*
8383
* @throws FileException if the target file could not be created
8484
*/
85-
public function move(string $directory, string $name = null): self
85+
public function move(string $directory, ?string $name = null): self
8686
{
8787
$target = $this->getTargetFile($directory, $name);
8888

@@ -112,7 +112,7 @@ public function getContent(): string
112112
return $content;
113113
}
114114

115-
protected function getTargetFile(string $directory, string $name = null): self
115+
protected function getTargetFile(string $directory, ?string $name = null): self
116116
{
117117
if (!is_dir($directory)) {
118118
if (false === @mkdir($directory, 0777, true) && !is_dir($directory)) {

File/UploadedFile.php

+2-2
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';
@@ -158,7 +158,7 @@ public function isValid(): bool
158158
*
159159
* @throws FileException if, for any reason, the file could not have been moved
160160
*/
161-
public function move(string $directory, string $name = null): File
161+
public function move(string $directory, ?string $name = null): File
162162
{
163163
if ($this->isValid()) {
164164
if ($this->test) {

HeaderBag.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function __toString(): string
6565
*
6666
* @return ($key is null ? array<string, list<string|null>> : list<string|null>)
6767
*/
68-
public function all(string $key = null): array
68+
public function all(?string $key = null): array
6969
{
7070
if (null !== $key) {
7171
return $this->headers[strtr($key, self::UPPER, self::LOWER)] ?? [];
@@ -110,7 +110,7 @@ public function add(array $headers)
110110
/**
111111
* Returns the first header by name or the default one.
112112
*/
113-
public function get(string $key, string $default = null): ?string
113+
public function get(string $key, ?string $default = null): ?string
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, \DateTimeInterface $default = null): ?\DateTimeInterface
200+
public function getDate(string $key, ?\DateTimeInterface $default = null): ?\DateTimeInterface
201201
{
202202
if (null === $value = $this->get($key)) {
203203
return null !== $default ? \DateTimeImmutable::createFromInterface($default) : null;

InputBag.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function set(string $key, mixed $value): void
8484
*
8585
* @return ?T
8686
*/
87-
public function getEnum(string $key, string $class, \BackedEnum $default = null): ?\BackedEnum
87+
public function getEnum(string $key, string $class, ?\BackedEnum $default = null): ?\BackedEnum
8888
{
8989
try {
9090
return parent::getEnum($key, $class, $default);

JsonResponse.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public static function fromJsonString(string $data, int $status = 200, array $he
7575
*
7676
* @throws \InvalidArgumentException When the callback name is not valid
7777
*/
78-
public function setCallback(string $callback = null): static
78+
public function setCallback(?string $callback = null): static
7979
{
8080
if (1 > \func_num_args()) {
8181
trigger_deprecation('symfony/http-foundation', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);

ParameterBag.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct(array $parameters = [])
3838
*
3939
* @param string|null $key The name of the parameter to return or null to get them all
4040
*/
41-
public function all(string $key = null): array
41+
public function all(?string $key = null): array
4242
{
4343
if (null === $key) {
4444
return $this->parameters;
@@ -174,7 +174,7 @@ public function getBoolean(string $key, bool $default = false): bool
174174
*
175175
* @return ?T
176176
*/
177-
public function getEnum(string $key, string $class, \BackedEnum $default = null): ?\BackedEnum
177+
public function getEnum(string $key, string $class, ?\BackedEnum $default = null): ?\BackedEnum
178178
{
179179
$value = $this->get($key);
180180

Request.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ public static function setFactory(?callable $callable)
448448
* @param array|null $files The FILES parameters
449449
* @param array|null $server The SERVER parameters
450450
*/
451-
public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null): static
451+
public function duplicate(?array $query = null, ?array $request = null, ?array $attributes = null, ?array $cookies = null, ?array $files = null, ?array $server = null): static
452452
{
453453
$dup = clone $this;
454454
if (null !== $query) {
@@ -1606,7 +1606,7 @@ public function getPreferredFormat(?string $default = 'html'): ?string
16061606
*
16071607
* @param string[] $locales An array of ordered available locales
16081608
*/
1609-
public function getPreferredLanguage(array $locales = null): ?string
1609+
public function getPreferredLanguage(?array $locales = null): ?string
16101610
{
16111611
$preferredLanguages = $this->getLanguages();
16121612

@@ -2004,7 +2004,7 @@ public function isFromTrustedProxy(): bool
20042004
* getPort(), isSecure(), getHost(), getClientIps(), getBaseUrl() etc. Thus, we try to cache the results for
20052005
* best performance.
20062006
*/
2007-
private function getTrustedValues(int $type, string $ip = null): array
2007+
private function getTrustedValues(int $type, ?string $ip = null): array
20082008
{
20092009
$cacheKey = $type."\0".((self::$trustedHeaderSet & $type) ? $this->headers->get(self::TRUSTED_HEADERS[$type]) : '');
20102010
$cacheKey .= "\0".$ip."\0".$this->headers->get(self::TRUSTED_HEADERS[self::HEADER_FORWARDED]);

RequestMatcher.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class RequestMatcher implements RequestMatcherInterface
5151
* @param string|string[]|null $ips
5252
* @param string|string[]|null $schemes
5353
*/
54-
public function __construct(string $path = null, string $host = null, string|array $methods = null, string|array $ips = null, array $attributes = [], string|array $schemes = null, int $port = null)
54+
public function __construct(?string $path = null, ?string $host = null, string|array|null $methods = null, string|array|null $ips = null, array $attributes = [], string|array|null $schemes = null, ?int $port = null)
5555
{
5656
$this->matchPath($path);
5757
$this->matchHost($host);

Response.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ public function getProtocolVersion(): string
497497
*
498498
* @final
499499
*/
500-
public function setStatusCode(int $code, string $text = null): static
500+
public function setStatusCode(int $code, ?string $text = null): static
501501
{
502502
$this->statusCode = $code;
503503
if ($this->isInvalid()) {
@@ -762,7 +762,7 @@ public function getExpires(): ?\DateTimeImmutable
762762
*
763763
* @final
764764
*/
765-
public function setExpires(\DateTimeInterface $date = null): static
765+
public function setExpires(?\DateTimeInterface $date = null): static
766766
{
767767
if (1 > \func_num_args()) {
768768
trigger_deprecation('symfony/http-foundation', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
@@ -943,7 +943,7 @@ public function getLastModified(): ?\DateTimeImmutable
943943
*
944944
* @final
945945
*/
946-
public function setLastModified(\DateTimeInterface $date = null): static
946+
public function setLastModified(?\DateTimeInterface $date = null): static
947947
{
948948
if (1 > \func_num_args()) {
949949
trigger_deprecation('symfony/http-foundation', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
@@ -981,7 +981,7 @@ public function getEtag(): ?string
981981
*
982982
* @final
983983
*/
984-
public function setEtag(string $etag = null, bool $weak = false): static
984+
public function setEtag(?string $etag = null, bool $weak = false): static
985985
{
986986
if (1 > \func_num_args()) {
987987
trigger_deprecation('symfony/http-foundation', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
@@ -1284,7 +1284,7 @@ public function isNotFound(): bool
12841284
*
12851285
* @final
12861286
*/
1287-
public function isRedirect(string $location = null): bool
1287+
public function isRedirect(?string $location = null): bool
12881288
{
12891289
return \in_array($this->statusCode, [201, 301, 302, 303, 307, 308]) && (null === $location ?: $location == $this->headers->get('Location'));
12901290
}

ResponseHeaderBag.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function replace(array $headers = [])
8686
}
8787
}
8888

89-
public function all(string $key = null): array
89+
public function all(?string $key = null): array
9090
{
9191
$headers = parent::all();
9292

@@ -183,7 +183,7 @@ public function setCookie(Cookie $cookie)
183183
*
184184
* @return void
185185
*/
186-
public function removeCookie(string $name, ?string $path = '/', string $domain = null)
186+
public function removeCookie(string $name, ?string $path = '/', ?string $domain = null)
187187
{
188188
$path ??= '/';
189189

@@ -236,7 +236,7 @@ public function getCookies(string $format = self::COOKIES_FLAT): array
236236
*
237237
* @return void
238238
*/
239-
public function clearCookie(string $name, ?string $path = '/', string $domain = null, bool $secure = false, bool $httpOnly = true, string $sameSite = null)
239+
public function clearCookie(string $name, ?string $path = '/', ?string $domain = null, bool $secure = false, bool $httpOnly = true, ?string $sameSite = null)
240240
{
241241
$this->setCookie(new Cookie($name, null, 1, $path, $domain, $secure, $httpOnly, false, $sameSite));
242242
}

Session/Session.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Session implements FlashBagAwareSessionInterface, \IteratorAggregate, \Cou
4040
private int $usageIndex = 0;
4141
private ?\Closure $usageReporter;
4242

43-
public function __construct(SessionStorageInterface $storage = null, AttributeBagInterface $attributes = null, FlashBagInterface $flashes = null, callable $usageReporter = null)
43+
public function __construct(?SessionStorageInterface $storage = null, ?AttributeBagInterface $attributes = null, ?FlashBagInterface $flashes = null, ?callable $usageReporter = null)
4444
{
4545
$this->storage = $storage ?? new NativeSessionStorage();
4646
$this->usageReporter = null === $usageReporter ? null : $usageReporter(...);
@@ -151,14 +151,14 @@ public function isEmpty(): bool
151151
return true;
152152
}
153153

154-
public function invalidate(int $lifetime = null): bool
154+
public function invalidate(?int $lifetime = null): bool
155155
{
156156
$this->storage->clear();
157157

158158
return $this->migrate(true, $lifetime);
159159
}
160160

161-
public function migrate(bool $destroy = false, int $lifetime = null): bool
161+
public function migrate(bool $destroy = false, ?int $lifetime = null): bool
162162
{
163163
return $this->storage->regenerate($destroy, $lifetime);
164164
}

Session/SessionFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class SessionFactory implements SessionFactoryInterface
2626
private SessionStorageFactoryInterface $storageFactory;
2727
private ?\Closure $usageReporter;
2828

29-
public function __construct(RequestStack $requestStack, SessionStorageFactoryInterface $storageFactory, callable $usageReporter = null)
29+
public function __construct(RequestStack $requestStack, SessionStorageFactoryInterface $storageFactory, ?callable $usageReporter = null)
3030
{
3131
$this->requestStack = $requestStack;
3232
$this->storageFactory = $storageFactory;

Session/SessionInterface.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function setName(string $name);
6262
* to expire with browser session. Time is in seconds, and is
6363
* not a Unix timestamp.
6464
*/
65-
public function invalidate(int $lifetime = null): bool;
65+
public function invalidate(?int $lifetime = null): bool;
6666

6767
/**
6868
* Migrates the current session to a new session id while maintaining all
@@ -74,7 +74,7 @@ public function invalidate(int $lifetime = null): bool;
7474
* to expire with browser session. Time is in seconds, and is
7575
* not a Unix timestamp.
7676
*/
77-
public function migrate(bool $destroy = false, int $lifetime = null): bool;
77+
public function migrate(bool $destroy = false, ?int $lifetime = null): bool;
7878

7979
/**
8080
* Force the session to be saved and closed.

Session/Storage/Handler/NativeFileSessionHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class NativeFileSessionHandler extends \SessionHandler
2828
* @throws \InvalidArgumentException On invalid $savePath
2929
* @throws \RuntimeException When failing to create the save directory
3030
*/
31-
public function __construct(string $savePath = null)
31+
public function __construct(?string $savePath = null)
3232
{
3333
$baseDir = $savePath ??= \ini_get('session.save_path');
3434

Session/Storage/Handler/PdoSessionHandler.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class PdoSessionHandler extends AbstractSessionHandler
151151
*
152152
* @throws \InvalidArgumentException When PDO error mode is not PDO::ERRMODE_EXCEPTION
153153
*/
154-
public function __construct(#[\SensitiveParameter] \PDO|string $pdoOrDsn = null, #[\SensitiveParameter] array $options = [])
154+
public function __construct(#[\SensitiveParameter] \PDO|string|null $pdoOrDsn = null, #[\SensitiveParameter] array $options = [])
155155
{
156156
if ($pdoOrDsn instanceof \PDO) {
157157
if (\PDO::ERRMODE_EXCEPTION !== $pdoOrDsn->getAttribute(\PDO::ATTR_ERRMODE)) {
@@ -181,7 +181,7 @@ public function __construct(#[\SensitiveParameter] \PDO|string $pdoOrDsn = null,
181181
/**
182182
* Adds the Table to the Schema if it doesn't exist.
183183
*/
184-
public function configureSchema(Schema $schema, \Closure $isSameDatabase = null): void
184+
public function configureSchema(Schema $schema, ?\Closure $isSameDatabase = null): void
185185
{
186186
if ($schema->hasTable($this->table) || ($isSameDatabase && !$isSameDatabase($this->getConnection()->exec(...)))) {
187187
return;

Session/Storage/MetadataBag.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function getLifetime(): int
8888
*
8989
* @return void
9090
*/
91-
public function stampNew(int $lifetime = null)
91+
public function stampNew(?int $lifetime = null)
9292
{
9393
$this->stampCreated($lifetime);
9494
}
@@ -139,7 +139,7 @@ public function setName(string $name)
139139
$this->name = $name;
140140
}
141141

142-
private function stampCreated(int $lifetime = null): void
142+
private function stampCreated(?int $lifetime = null): void
143143
{
144144
$timeStamp = time();
145145
$this->meta[self::CREATED] = $this->meta[self::UPDATED] = $this->lastUsed = $timeStamp;

Session/Storage/MockArraySessionStorage.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class MockArraySessionStorage implements SessionStorageInterface
6262
*/
6363
protected $bags = [];
6464

65-
public function __construct(string $name = 'MOCKSESSID', MetadataBag $metaBag = null)
65+
public function __construct(string $name = 'MOCKSESSID', ?MetadataBag $metaBag = null)
6666
{
6767
$this->name = $name;
6868
$this->setMetadataBag($metaBag);
@@ -91,7 +91,7 @@ public function start(): bool
9191
return true;
9292
}
9393

94-
public function regenerate(bool $destroy = false, int $lifetime = null): bool
94+
public function regenerate(bool $destroy = false, ?int $lifetime = null): bool
9595
{
9696
if (!$this->started) {
9797
$this->start();
@@ -192,7 +192,7 @@ public function isStarted(): bool
192192
/**
193193
* @return void
194194
*/
195-
public function setMetadataBag(MetadataBag $bag = null)
195+
public function setMetadataBag(?MetadataBag $bag = null)
196196
{
197197
if (1 > \func_num_args()) {
198198
trigger_deprecation('symfony/http-foundation', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);

Session/Storage/MockFileSessionStorage.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class MockFileSessionStorage extends MockArraySessionStorage
3030
/**
3131
* @param string|null $savePath Path of directory to save session files
3232
*/
33-
public function __construct(string $savePath = null, string $name = 'MOCKSESSID', MetadataBag $metaBag = null)
33+
public function __construct(?string $savePath = null, string $name = 'MOCKSESSID', ?MetadataBag $metaBag = null)
3434
{
3535
$savePath ??= sys_get_temp_dir();
3636

@@ -60,7 +60,7 @@ public function start(): bool
6060
return true;
6161
}
6262

63-
public function regenerate(bool $destroy = false, int $lifetime = null): bool
63+
public function regenerate(bool $destroy = false, ?int $lifetime = null): bool
6464
{
6565
if (!$this->started) {
6666
$this->start();

0 commit comments

Comments
 (0)