Skip to content

Commit a1152fb

Browse files
Merge branch '7.0' into 7.1
* 7.0: List CS fix in .git-blame-ignore-revs Fix implicitly-required parameters 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 [Messenger][AmazonSqs] Allow async-aws/sqs version 2
2 parents e077cc5 + f24e256 commit a1152fb

30 files changed

+53
-53
lines changed

BinaryFileResponse.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class BinaryFileResponse extends Response
4242
* @param bool $autoEtag Whether the ETag header should be automatically set
4343
* @param bool $autoLastModified Whether the Last-Modified header should be automatically set
4444
*/
45-
public function __construct(\SplFileInfo|string $file, int $status = 200, array $headers = [], bool $public = true, string $contentDisposition = null, bool $autoEtag = false, bool $autoLastModified = true)
45+
public function __construct(\SplFileInfo|string $file, int $status = 200, array $headers = [], bool $public = true, ?string $contentDisposition = null, bool $autoEtag = false, bool $autoLastModified = true)
4646
{
4747
parent::__construct(null, $status, $headers);
4848

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

Cookie.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public static function fromString(string $cookie, bool $decode = false): static
7676
*
7777
* @param self::SAMESITE_*|''|null $sameSite
7878
*/
79-
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
79+
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
8080
{
8181
return new self($name, $value, $expire, $path, $domain, $secure, $httpOnly, $raw, $sameSite, $partitioned);
8282
}
@@ -94,7 +94,7 @@ public static function create(string $name, string $value = null, int|string|\Da
9494
*
9595
* @throws \InvalidArgumentException
9696
*/
97-
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)
97+
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)
9898
{
9999
// from PHP source code
100100
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
@@ -61,7 +61,7 @@ class UploadedFile extends File
6161
* @throws FileException If file_uploads is disabled
6262
* @throws FileNotFoundException If the file does not exist
6363
*/
64-
public function __construct(string $path, string $originalName, string $mimeType = null, int $error = null, bool $test = false)
64+
public function __construct(string $path, string $originalName, ?string $mimeType = null, ?int $error = null, bool $test = false)
6565
{
6666
$this->originalName = $this->getName($originalName);
6767
$this->originalPath = strtr($originalName, '\\', '/');
@@ -175,7 +175,7 @@ public function isValid(): bool
175175
*
176176
* @throws FileException if, for any reason, the file could not have been moved
177177
*/
178-
public function move(string $directory, string $name = null): File
178+
public function move(string $directory, ?string $name = null): File
179179
{
180180
if ($this->isValid()) {
181181
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)] ?? [];
@@ -106,7 +106,7 @@ public function add(array $headers): void
106106
/**
107107
* Returns the first header by name or the default one.
108108
*/
109-
public function get(string $key, string $default = null): ?string
109+
public function get(string $key, ?string $default = null): ?string
110110
{
111111
$headers = $this->all($key);
112112

@@ -187,7 +187,7 @@ public function remove(string $key): void
187187
*
188188
* @throws \RuntimeException When the HTTP header is not parseable
189189
*/
190-
public function getDate(string $key, \DateTimeInterface $default = null): ?\DateTimeImmutable
190+
public function getDate(string $key, ?\DateTimeInterface $default = null): ?\DateTimeImmutable
191191
{
192192
if (null === $value = $this->get($key)) {
193193
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);

ParameterBag.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function __construct(array $parameters = [])
3535
*
3636
* @param string|null $key The name of the parameter to return or null to get them all
3737
*/
38-
public function all(string $key = null): array
38+
public function all(?string $key = null): array
3939
{
4040
if (null === $key) {
4141
return $this->parameters;
@@ -161,7 +161,7 @@ public function getBoolean(string $key, bool $default = false): bool
161161
*
162162
* @return ?T
163163
*/
164-
public function getEnum(string $key, string $class, \BackedEnum $default = null): ?\BackedEnum
164+
public function getEnum(string $key, string $class, ?\BackedEnum $default = null): ?\BackedEnum
165165
{
166166
$value = $this->get($key);
167167

Request.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ public static function setFactory(?callable $callable): void
395395
* @param array|null $files The FILES parameters
396396
* @param array|null $server The SERVER parameters
397397
*/
398-
public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null): static
398+
public function duplicate(?array $query = null, ?array $request = null, ?array $attributes = null, ?array $cookies = null, ?array $files = null, ?array $server = null): static
399399
{
400400
$dup = clone $this;
401401
if (null !== $query) {
@@ -1524,7 +1524,7 @@ public function getPreferredFormat(?string $default = 'html'): ?string
15241524
*
15251525
* @param string[] $locales An array of ordered available locales
15261526
*/
1527-
public function getPreferredLanguage(array $locales = null): ?string
1527+
public function getPreferredLanguage(?array $locales = null): ?string
15281528
{
15291529
$preferredLanguages = $this->getLanguages();
15301530

@@ -1917,7 +1917,7 @@ public function isFromTrustedProxy(): bool
19171917
* getPort(), isSecure(), getHost(), getClientIps(), getBaseUrl() etc. Thus, we try to cache the results for
19181918
* best performance.
19191919
*/
1920-
private function getTrustedValues(int $type, string $ip = null): array
1920+
private function getTrustedValues(int $type, ?string $ip = null): array
19211921
{
19221922
$cacheKey = $type."\0".((self::$trustedHeaderSet & $type) ? $this->headers->get(self::TRUSTED_HEADERS[$type]) : '');
19231923
$cacheKey .= "\0".$ip."\0".$this->headers->get(self::TRUSTED_HEADERS[self::HEADER_FORWARDED]);

Response.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ public function prepare(Request $request): static
311311
*
312312
* @return $this
313313
*/
314-
public function sendHeaders(int $statusCode = null): static
314+
public function sendHeaders(?int $statusCode = null): static
315315
{
316316
// headers have already been sent by the developer
317317
if (headers_sent()) {
@@ -471,7 +471,7 @@ public function getProtocolVersion(): string
471471
*
472472
* @final
473473
*/
474-
public function setStatusCode(int $code, string $text = null): static
474+
public function setStatusCode(int $code, ?string $text = null): static
475475
{
476476
$this->statusCode = $code;
477477
if ($this->isInvalid()) {
@@ -1249,7 +1249,7 @@ public function isNotFound(): bool
12491249
*
12501250
* @final
12511251
*/
1252-
public function isRedirect(string $location = null): bool
1252+
public function isRedirect(?string $location = null): bool
12531253
{
12541254
return \in_array($this->statusCode, [201, 301, 302, 303, 307, 308]) && (null === $location ?: $location == $this->headers->get('Location'));
12551255
}

ResponseHeaderBag.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function replace(array $headers = []): void
8080
}
8181
}
8282

83-
public function all(string $key = null): array
83+
public function all(?string $key = null): array
8484
{
8585
$headers = parent::all();
8686

@@ -166,7 +166,7 @@ public function setCookie(Cookie $cookie): void
166166
/**
167167
* Removes a cookie from the array, but does not unset it in the browser.
168168
*/
169-
public function removeCookie(string $name, ?string $path = '/', string $domain = null): void
169+
public function removeCookie(string $name, ?string $path = '/', ?string $domain = null): void
170170
{
171171
$path ??= '/';
172172

@@ -217,7 +217,7 @@ public function getCookies(string $format = self::COOKIES_FLAT): array
217217
/**
218218
* Clears a cookie in the browser.
219219
*/
220-
public function clearCookie(string $name, ?string $path = '/', string $domain = null, bool $secure = false, bool $httpOnly = true, string $sameSite = null): void
220+
public function clearCookie(string $name, ?string $path = '/', ?string $domain = null, bool $secure = false, bool $httpOnly = true, ?string $sameSite = null): void
221221
{
222222
$this->setCookie(new Cookie($name, null, 1, $path, $domain, $secure, $httpOnly, false, $sameSite));
223223
}

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(...);
@@ -142,14 +142,14 @@ public function isEmpty(): bool
142142
return true;
143143
}
144144

145-
public function invalidate(int $lifetime = null): bool
145+
public function invalidate(?int $lifetime = null): bool
146146
{
147147
$this->storage->clear();
148148

149149
return $this->migrate(true, $lifetime);
150150
}
151151

152-
public function migrate(bool $destroy = false, int $lifetime = null): bool
152+
public function migrate(bool $destroy = false, ?int $lifetime = null): bool
153153
{
154154
return $this->storage->regenerate($destroy, $lifetime);
155155
}

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
@@ -58,7 +58,7 @@ public function setName(string $name): void;
5858
* to expire with browser session. Time is in seconds, and is
5959
* not a Unix timestamp.
6060
*/
61-
public function invalidate(int $lifetime = null): bool;
61+
public function invalidate(?int $lifetime = null): bool;
6262

6363
/**
6464
* Migrates the current session to a new session id while maintaining all
@@ -70,7 +70,7 @@ public function invalidate(int $lifetime = null): bool;
7070
* to expire with browser session. Time is in seconds, and is
7171
* not a Unix timestamp.
7272
*/
73-
public function migrate(bool $destroy = false, int $lifetime = null): bool;
73+
public function migrate(bool $destroy = false, ?int $lifetime = null): bool;
7474

7575
/**
7676
* 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
@@ -75,7 +75,7 @@ public function getLifetime(): int
7575
* to expire with browser session. Time is in seconds, and is
7676
* not a Unix timestamp.
7777
*/
78-
public function stampNew(int $lifetime = null): void
78+
public function stampNew(?int $lifetime = null): void
7979
{
8080
$this->stampCreated($lifetime);
8181
}
@@ -124,7 +124,7 @@ public function setName(string $name): void
124124
$this->name = $name;
125125
}
126126

127-
private function stampCreated(int $lifetime = null): void
127+
private function stampCreated(?int $lifetime = null): void
128128
{
129129
$timeStamp = time();
130130
$this->meta[self::CREATED] = $this->meta[self::UPDATED] = $this->lastUsed = $timeStamp;

Session/Storage/MockArraySessionStorage.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class MockArraySessionStorage implements SessionStorageInterface
3939
*/
4040
protected array $bags = [];
4141

42-
public function __construct(string $name = 'MOCKSESSID', MetadataBag $metaBag = null)
42+
public function __construct(string $name = 'MOCKSESSID', ?MetadataBag $metaBag = null)
4343
{
4444
$this->name = $name;
4545
$this->setMetadataBag($metaBag);
@@ -65,7 +65,7 @@ public function start(): bool
6565
return true;
6666
}
6767

68-
public function regenerate(bool $destroy = false, int $lifetime = null): bool
68+
public function regenerate(bool $destroy = false, ?int $lifetime = null): bool
6969
{
7070
if (!$this->started) {
7171
$this->start();

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();

Session/Storage/MockFileSessionStorageFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class MockFileSessionStorageFactory implements SessionStorageFactoryInterface
2828
/**
2929
* @see MockFileSessionStorage constructor.
3030
*/
31-
public function __construct(string $savePath = null, string $name = 'MOCKSESSID', MetadataBag $metaBag = null)
31+
public function __construct(?string $savePath = null, string $name = 'MOCKSESSID', ?MetadataBag $metaBag = null)
3232
{
3333
$this->savePath = $savePath;
3434
$this->name = $name;

Session/Storage/NativeSessionStorage.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class NativeSessionStorage implements SessionStorageInterface
7373
* trans_sid_hosts, $_SERVER['HTTP_HOST']
7474
* trans_sid_tags, "a=href,area=href,frame=src,form="
7575
*/
76-
public function __construct(array $options = [], AbstractProxy|\SessionHandlerInterface $handler = null, MetadataBag $metaBag = null)
76+
public function __construct(array $options = [], AbstractProxy|\SessionHandlerInterface|null $handler = null, ?MetadataBag $metaBag = null)
7777
{
7878
if (!\extension_loaded('session')) {
7979
throw new \LogicException('PHP extension "session" is required.');
@@ -182,7 +182,7 @@ public function setName(string $name): void
182182
$this->saveHandler->setName($name);
183183
}
184184

185-
public function regenerate(bool $destroy = false, int $lifetime = null): bool
185+
public function regenerate(bool $destroy = false, ?int $lifetime = null): bool
186186
{
187187
// Cannot regenerate the session ID for non-active sessions.
188188
if (\PHP_SESSION_ACTIVE !== session_status()) {
@@ -382,7 +382,7 @@ public function setSaveHandler(AbstractProxy|\SessionHandlerInterface|null $save
382382
* PHP takes the return value from the read() handler, unserializes it
383383
* and populates $_SESSION with the result automatically.
384384
*/
385-
protected function loadSession(array &$session = null): void
385+
protected function loadSession(?array &$session = null): void
386386
{
387387
if (null === $session) {
388388
$session = &$_SESSION;

Session/Storage/NativeSessionStorageFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class NativeSessionStorageFactory implements SessionStorageFactoryInterface
3030
/**
3131
* @see NativeSessionStorage constructor.
3232
*/
33-
public function __construct(array $options = [], AbstractProxy|\SessionHandlerInterface $handler = null, MetadataBag $metaBag = null, bool $secure = false)
33+
public function __construct(array $options = [], AbstractProxy|\SessionHandlerInterface|null $handler = null, ?MetadataBag $metaBag = null, bool $secure = false)
3434
{
3535
$this->options = $options;
3636
$this->handler = $handler;

0 commit comments

Comments
 (0)