Skip to content

Commit

Permalink
Merge branch '6.3' into 6.4
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
nicolas-grekas committed Jan 23, 2024
2 parents 292b163 + 3b72add commit 5677bdf
Show file tree
Hide file tree
Showing 32 changed files with 59 additions and 59 deletions.
4 changes: 2 additions & 2 deletions BinaryFileResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class BinaryFileResponse extends Response
* @param bool $autoEtag Whether the ETag header should be automatically set
* @param bool $autoLastModified Whether the Last-Modified header should be automatically set
*/
public function __construct(\SplFileInfo|string $file, int $status = 200, array $headers = [], bool $public = true, string $contentDisposition = null, bool $autoEtag = false, bool $autoLastModified = true)
public function __construct(\SplFileInfo|string $file, int $status = 200, array $headers = [], bool $public = true, ?string $contentDisposition = null, bool $autoEtag = false, bool $autoLastModified = true)
{
parent::__construct(null, $status, $headers);

Expand All @@ -63,7 +63,7 @@ public function __construct(\SplFileInfo|string $file, int $status = 200, array
*
* @throws FileException
*/
public function setFile(\SplFileInfo|string $file, string $contentDisposition = null, bool $autoEtag = false, bool $autoLastModified = true): static
public function setFile(\SplFileInfo|string $file, ?string $contentDisposition = null, bool $autoEtag = false, bool $autoLastModified = true): static
{
if (!$file instanceof File) {
if ($file instanceof \SplFileInfo) {
Expand Down
4 changes: 2 additions & 2 deletions Cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static function fromString(string $cookie, bool $decode = false): static
* @param self::SAMESITE_*|''|null $sameSite
* @param bool $partitioned
*/
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
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
{
$partitioned = 9 < \func_num_args() ? func_get_arg(9) : false;

Expand All @@ -97,7 +97,7 @@ public static function create(string $name, string $value = null, int|string|\Da
*
* @throws \InvalidArgumentException
*/
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)
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)
{
// from PHP source code
if ($raw && false !== strpbrk($name, self::RESERVED_CHARS_LIST)) {
Expand Down
2 changes: 1 addition & 1 deletion Exception/SessionNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
class SessionNotFoundException extends \LogicException implements RequestExceptionInterface
{
public function __construct(string $message = 'There is currently no session available.', int $code = 0, \Throwable $previous = null)
public function __construct(string $message = 'There is currently no session available.', int $code = 0, ?\Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
Expand Down
4 changes: 2 additions & 2 deletions File/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function getMimeType(): ?string
*
* @throws FileException if the target file could not be created
*/
public function move(string $directory, string $name = null): self
public function move(string $directory, ?string $name = null): self
{
$target = $this->getTargetFile($directory, $name);

Expand Down Expand Up @@ -112,7 +112,7 @@ public function getContent(): string
return $content;
}

protected function getTargetFile(string $directory, string $name = null): self
protected function getTargetFile(string $directory, ?string $name = null): self
{
if (!is_dir($directory)) {
if (false === @mkdir($directory, 0777, true) && !is_dir($directory)) {
Expand Down
4 changes: 2 additions & 2 deletions File/UploadedFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class UploadedFile extends File
* @throws FileException If file_uploads is disabled
* @throws FileNotFoundException If the file does not exist
*/
public function __construct(string $path, string $originalName, string $mimeType = null, int $error = null, bool $test = false)
public function __construct(string $path, string $originalName, ?string $mimeType = null, ?int $error = null, bool $test = false)
{
$this->originalName = $this->getName($originalName);
$this->mimeType = $mimeType ?: 'application/octet-stream';
Expand Down Expand Up @@ -158,7 +158,7 @@ public function isValid(): bool
*
* @throws FileException if, for any reason, the file could not have been moved
*/
public function move(string $directory, string $name = null): File
public function move(string $directory, ?string $name = null): File
{
if ($this->isValid()) {
if ($this->test) {
Expand Down
6 changes: 3 additions & 3 deletions HeaderBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function __toString(): string
*
* @return ($key is null ? array<string, list<string|null>> : list<string|null>)
*/
public function all(string $key = null): array
public function all(?string $key = null): array
{
if (null !== $key) {
return $this->headers[strtr($key, self::UPPER, self::LOWER)] ?? [];
Expand Down Expand Up @@ -110,7 +110,7 @@ public function add(array $headers)
/**
* Returns the first header by name or the default one.
*/
public function get(string $key, string $default = null): ?string
public function get(string $key, ?string $default = null): ?string
{
$headers = $this->all($key);

Expand Down Expand Up @@ -197,7 +197,7 @@ public function remove(string $key)
*
* @throws \RuntimeException When the HTTP header is not parseable
*/
public function getDate(string $key, \DateTimeInterface $default = null): ?\DateTimeInterface
public function getDate(string $key, ?\DateTimeInterface $default = null): ?\DateTimeInterface
{
if (null === $value = $this->get($key)) {
return null !== $default ? \DateTimeImmutable::createFromInterface($default) : null;
Expand Down
2 changes: 1 addition & 1 deletion InputBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function set(string $key, mixed $value): void
*
* @return ?T
*/
public function getEnum(string $key, string $class, \BackedEnum $default = null): ?\BackedEnum
public function getEnum(string $key, string $class, ?\BackedEnum $default = null): ?\BackedEnum
{
try {
return parent::getEnum($key, $class, $default);
Expand Down
2 changes: 1 addition & 1 deletion JsonResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static function fromJsonString(string $data, int $status = 200, array $he
*
* @throws \InvalidArgumentException When the callback name is not valid
*/
public function setCallback(string $callback = null): static
public function setCallback(?string $callback = null): static
{
if (1 > \func_num_args()) {
trigger_deprecation('symfony/http-foundation', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
Expand Down
4 changes: 2 additions & 2 deletions ParameterBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __construct(array $parameters = [])
*
* @param string|null $key The name of the parameter to return or null to get them all
*/
public function all(string $key = null): array
public function all(?string $key = null): array
{
if (null === $key) {
return $this->parameters;
Expand Down Expand Up @@ -174,7 +174,7 @@ public function getBoolean(string $key, bool $default = false): bool
*
* @return ?T
*/
public function getEnum(string $key, string $class, \BackedEnum $default = null): ?\BackedEnum
public function getEnum(string $key, string $class, ?\BackedEnum $default = null): ?\BackedEnum
{
$value = $this->get($key);

Expand Down
6 changes: 3 additions & 3 deletions Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ public static function setFactory(?callable $callable)
* @param array|null $files The FILES parameters
* @param array|null $server The SERVER parameters
*/
public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null): static
public function duplicate(?array $query = null, ?array $request = null, ?array $attributes = null, ?array $cookies = null, ?array $files = null, ?array $server = null): static
{
$dup = clone $this;
if (null !== $query) {
Expand Down Expand Up @@ -1606,7 +1606,7 @@ public function getPreferredFormat(?string $default = 'html'): ?string
*
* @param string[] $locales An array of ordered available locales
*/
public function getPreferredLanguage(array $locales = null): ?string
public function getPreferredLanguage(?array $locales = null): ?string
{
$preferredLanguages = $this->getLanguages();

Expand Down Expand Up @@ -2004,7 +2004,7 @@ public function isFromTrustedProxy(): bool
* getPort(), isSecure(), getHost(), getClientIps(), getBaseUrl() etc. Thus, we try to cache the results for
* best performance.
*/
private function getTrustedValues(int $type, string $ip = null): array
private function getTrustedValues(int $type, ?string $ip = null): array
{
$cacheKey = $type."\0".((self::$trustedHeaderSet & $type) ? $this->headers->get(self::TRUSTED_HEADERS[$type]) : '');
$cacheKey .= "\0".$ip."\0".$this->headers->get(self::TRUSTED_HEADERS[self::HEADER_FORWARDED]);
Expand Down
2 changes: 1 addition & 1 deletion RequestMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class RequestMatcher implements RequestMatcherInterface
* @param string|string[]|null $ips
* @param string|string[]|null $schemes
*/
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)
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)
{
$this->matchPath($path);
$this->matchHost($host);
Expand Down
10 changes: 5 additions & 5 deletions Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ public function getProtocolVersion(): string
*
* @final
*/
public function setStatusCode(int $code, string $text = null): static
public function setStatusCode(int $code, ?string $text = null): static
{
$this->statusCode = $code;
if ($this->isInvalid()) {
Expand Down Expand Up @@ -762,7 +762,7 @@ public function getExpires(): ?\DateTimeImmutable
*
* @final
*/
public function setExpires(\DateTimeInterface $date = null): static
public function setExpires(?\DateTimeInterface $date = null): static
{
if (1 > \func_num_args()) {
trigger_deprecation('symfony/http-foundation', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
Expand Down Expand Up @@ -943,7 +943,7 @@ public function getLastModified(): ?\DateTimeImmutable
*
* @final
*/
public function setLastModified(\DateTimeInterface $date = null): static
public function setLastModified(?\DateTimeInterface $date = null): static
{
if (1 > \func_num_args()) {
trigger_deprecation('symfony/http-foundation', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
Expand Down Expand Up @@ -981,7 +981,7 @@ public function getEtag(): ?string
*
* @final
*/
public function setEtag(string $etag = null, bool $weak = false): static
public function setEtag(?string $etag = null, bool $weak = false): static
{
if (1 > \func_num_args()) {
trigger_deprecation('symfony/http-foundation', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
Expand Down Expand Up @@ -1284,7 +1284,7 @@ public function isNotFound(): bool
*
* @final
*/
public function isRedirect(string $location = null): bool
public function isRedirect(?string $location = null): bool
{
return \in_array($this->statusCode, [201, 301, 302, 303, 307, 308]) && (null === $location ?: $location == $this->headers->get('Location'));
}
Expand Down
6 changes: 3 additions & 3 deletions ResponseHeaderBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function replace(array $headers = [])
}
}

public function all(string $key = null): array
public function all(?string $key = null): array
{
$headers = parent::all();

Expand Down Expand Up @@ -183,7 +183,7 @@ public function setCookie(Cookie $cookie)
*
* @return void
*/
public function removeCookie(string $name, ?string $path = '/', string $domain = null)
public function removeCookie(string $name, ?string $path = '/', ?string $domain = null)
{
$path ??= '/';

Expand Down Expand Up @@ -236,7 +236,7 @@ public function getCookies(string $format = self::COOKIES_FLAT): array
*
* @return void
*/
public function clearCookie(string $name, ?string $path = '/', string $domain = null, bool $secure = false, bool $httpOnly = true, string $sameSite = null)
public function clearCookie(string $name, ?string $path = '/', ?string $domain = null, bool $secure = false, bool $httpOnly = true, ?string $sameSite = null)
{
$this->setCookie(new Cookie($name, null, 1, $path, $domain, $secure, $httpOnly, false, $sameSite));
}
Expand Down
6 changes: 3 additions & 3 deletions Session/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Session implements FlashBagAwareSessionInterface, \IteratorAggregate, \Cou
private int $usageIndex = 0;
private ?\Closure $usageReporter;

public function __construct(SessionStorageInterface $storage = null, AttributeBagInterface $attributes = null, FlashBagInterface $flashes = null, callable $usageReporter = null)
public function __construct(?SessionStorageInterface $storage = null, ?AttributeBagInterface $attributes = null, ?FlashBagInterface $flashes = null, ?callable $usageReporter = null)
{
$this->storage = $storage ?? new NativeSessionStorage();
$this->usageReporter = null === $usageReporter ? null : $usageReporter(...);
Expand Down Expand Up @@ -151,14 +151,14 @@ public function isEmpty(): bool
return true;
}

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

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

public function migrate(bool $destroy = false, int $lifetime = null): bool
public function migrate(bool $destroy = false, ?int $lifetime = null): bool
{
return $this->storage->regenerate($destroy, $lifetime);
}
Expand Down
2 changes: 1 addition & 1 deletion Session/SessionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class SessionFactory implements SessionFactoryInterface
private SessionStorageFactoryInterface $storageFactory;
private ?\Closure $usageReporter;

public function __construct(RequestStack $requestStack, SessionStorageFactoryInterface $storageFactory, callable $usageReporter = null)
public function __construct(RequestStack $requestStack, SessionStorageFactoryInterface $storageFactory, ?callable $usageReporter = null)
{
$this->requestStack = $requestStack;
$this->storageFactory = $storageFactory;
Expand Down
4 changes: 2 additions & 2 deletions Session/SessionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function setName(string $name);
* to expire with browser session. Time is in seconds, and is
* not a Unix timestamp.
*/
public function invalidate(int $lifetime = null): bool;
public function invalidate(?int $lifetime = null): bool;

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

/**
* Force the session to be saved and closed.
Expand Down
2 changes: 1 addition & 1 deletion Session/Storage/Handler/NativeFileSessionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class NativeFileSessionHandler extends \SessionHandler
* @throws \InvalidArgumentException On invalid $savePath
* @throws \RuntimeException When failing to create the save directory
*/
public function __construct(string $savePath = null)
public function __construct(?string $savePath = null)
{
$baseDir = $savePath ??= \ini_get('session.save_path');

Expand Down
4 changes: 2 additions & 2 deletions Session/Storage/Handler/PdoSessionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class PdoSessionHandler extends AbstractSessionHandler
*
* @throws \InvalidArgumentException When PDO error mode is not PDO::ERRMODE_EXCEPTION
*/
public function __construct(#[\SensitiveParameter] \PDO|string $pdoOrDsn = null, #[\SensitiveParameter] array $options = [])
public function __construct(#[\SensitiveParameter] \PDO|string|null $pdoOrDsn = null, #[\SensitiveParameter] array $options = [])
{
if ($pdoOrDsn instanceof \PDO) {
if (\PDO::ERRMODE_EXCEPTION !== $pdoOrDsn->getAttribute(\PDO::ATTR_ERRMODE)) {
Expand Down Expand Up @@ -181,7 +181,7 @@ public function __construct(#[\SensitiveParameter] \PDO|string $pdoOrDsn = null,
/**
* Adds the Table to the Schema if it doesn't exist.
*/
public function configureSchema(Schema $schema, \Closure $isSameDatabase = null): void
public function configureSchema(Schema $schema, ?\Closure $isSameDatabase = null): void
{
if ($schema->hasTable($this->table) || ($isSameDatabase && !$isSameDatabase($this->getConnection()->exec(...)))) {
return;
Expand Down
4 changes: 2 additions & 2 deletions Session/Storage/MetadataBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function getLifetime(): int
*
* @return void
*/
public function stampNew(int $lifetime = null)
public function stampNew(?int $lifetime = null)
{
$this->stampCreated($lifetime);
}
Expand Down Expand Up @@ -139,7 +139,7 @@ public function setName(string $name)
$this->name = $name;
}

private function stampCreated(int $lifetime = null): void
private function stampCreated(?int $lifetime = null): void
{
$timeStamp = time();
$this->meta[self::CREATED] = $this->meta[self::UPDATED] = $this->lastUsed = $timeStamp;
Expand Down
6 changes: 3 additions & 3 deletions Session/Storage/MockArraySessionStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class MockArraySessionStorage implements SessionStorageInterface
*/
protected $bags = [];

public function __construct(string $name = 'MOCKSESSID', MetadataBag $metaBag = null)
public function __construct(string $name = 'MOCKSESSID', ?MetadataBag $metaBag = null)
{
$this->name = $name;
$this->setMetadataBag($metaBag);
Expand Down Expand Up @@ -91,7 +91,7 @@ public function start(): bool
return true;
}

public function regenerate(bool $destroy = false, int $lifetime = null): bool
public function regenerate(bool $destroy = false, ?int $lifetime = null): bool
{
if (!$this->started) {
$this->start();
Expand Down Expand Up @@ -192,7 +192,7 @@ public function isStarted(): bool
/**
* @return void
*/
public function setMetadataBag(MetadataBag $bag = null)
public function setMetadataBag(?MetadataBag $bag = null)
{
if (1 > \func_num_args()) {
trigger_deprecation('symfony/http-foundation', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
Expand Down
4 changes: 2 additions & 2 deletions Session/Storage/MockFileSessionStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class MockFileSessionStorage extends MockArraySessionStorage
/**
* @param string|null $savePath Path of directory to save session files
*/
public function __construct(string $savePath = null, string $name = 'MOCKSESSID', MetadataBag $metaBag = null)
public function __construct(?string $savePath = null, string $name = 'MOCKSESSID', ?MetadataBag $metaBag = null)
{
$savePath ??= sys_get_temp_dir();

Expand Down Expand Up @@ -60,7 +60,7 @@ public function start(): bool
return true;
}

public function regenerate(bool $destroy = false, int $lifetime = null): bool
public function regenerate(bool $destroy = false, ?int $lifetime = null): bool
{
if (!$this->started) {
$this->start();
Expand Down
Loading

0 comments on commit 5677bdf

Please sign in to comment.