Skip to content

Commit

Permalink
Merge branch '6.4' into 7.0
Browse files Browse the repository at this point in the history
* 6.4:
  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
  • Loading branch information
nicolas-grekas committed Jan 23, 2024
2 parents 9fe502f + 66d929d commit e9a5d25
Show file tree
Hide file tree
Showing 29 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion AppVariable.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public function getEnabled_locales(): array
* * getFlashes('notice') returns a simple array with flash messages of that type
* * getFlashes(['notice', 'error']) returns a nested array of type => messages.
*/
public function getFlashes(string|array $types = null): array
public function getFlashes(string|array|null $types = null): array
{
try {
$session = $this->getSession();
Expand Down
6 changes: 3 additions & 3 deletions Command/DebugCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class DebugCommand extends Command

private ?FileLinkFormatter $fileLinkFormatter;

public function __construct(Environment $twig, string $projectDir = null, array $bundlesMetadata = [], string $twigDefaultPath = null, FileLinkFormatter $fileLinkFormatter = null)
public function __construct(Environment $twig, ?string $projectDir = null, array $bundlesMetadata = [], ?string $twigDefaultPath = null, ?FileLinkFormatter $fileLinkFormatter = null)
{
parent::__construct();

Expand Down Expand Up @@ -214,7 +214,7 @@ private function displayPathsJson(SymfonyStyle $io, string $name): void
$io->writeln(json_encode($data));
}

private function displayGeneralText(SymfonyStyle $io, string $filter = null): void
private function displayGeneralText(SymfonyStyle $io, ?string $filter = null): void
{
$decorated = $io->isDecorated();
$types = ['functions', 'filters', 'tests', 'globals'];
Expand Down Expand Up @@ -276,7 +276,7 @@ private function displayGeneralJson(SymfonyStyle $io, ?string $filter): void
$io->writeln($decorated ? OutputFormatter::escape($data) : $data);
}

private function getLoaderPaths(string $name = null): array
private function getLoaderPaths(?string $name = null): array
{
$loaderPaths = [];
foreach ($this->getFilesystemLoaders() as $loader) {
Expand Down
2 changes: 1 addition & 1 deletion Command/LintCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ private function displayJson(OutputInterface $output, array $filesInfo): int
return min($errors, 1);
}

private function renderException(SymfonyStyle $output, string $template, Error $exception, string $file = null, GithubActionReporter $githubReporter = null): void
private function renderException(SymfonyStyle $output, string $template, Error $exception, ?string $file = null, ?GithubActionReporter $githubReporter = null): void
{
$line = $exception->getTemplateLine();

Expand Down
4 changes: 2 additions & 2 deletions DataCollector/TwigDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ class TwigDataCollector extends DataCollector implements LateDataCollectorInterf
private ?Environment $twig;
private array $computed;

public function __construct(Profile $profile, Environment $twig = null)
public function __construct(Profile $profile, ?Environment $twig = null)
{
$this->profile = $profile;
$this->twig = $twig;
}

public function collect(Request $request, Response $response, \Throwable $exception = null): void
public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
{
}

Expand Down
2 changes: 1 addition & 1 deletion ErrorRenderer/TwigErrorRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class TwigErrorRenderer implements ErrorRendererInterface
/**
* @param bool|callable $debug The debugging mode as a boolean or a callable that should return it
*/
public function __construct(Environment $twig, HtmlErrorRenderer $fallbackErrorRenderer = null, bool|callable $debug = false)
public function __construct(Environment $twig, ?HtmlErrorRenderer $fallbackErrorRenderer = null, bool|callable $debug = false)
{
$this->twig = $twig;
$this->fallbackErrorRenderer = $fallbackErrorRenderer ?? new HtmlErrorRenderer();
Expand Down
4 changes: 2 additions & 2 deletions Extension/AssetExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ public function getFunctions(): array
* If the package used to generate the path is an instance of
* UrlPackage, you will always get a URL and not a path.
*/
public function getAssetUrl(string $path, string $packageName = null): string
public function getAssetUrl(string $path, ?string $packageName = null): string
{
return $this->packages->getUrl($path, $packageName);
}

/**
* Returns the version of an asset.
*/
public function getAssetVersion(string $path, string $packageName = null): string
public function getAssetVersion(string $path, ?string $packageName = null): string
{
return $this->packages->getVersion($path, $packageName);
}
Expand Down
2 changes: 1 addition & 1 deletion Extension/DumpExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class DumpExtension extends AbstractExtension
private ClonerInterface $cloner;
private ?HtmlDumper $dumper;

public function __construct(ClonerInterface $cloner, HtmlDumper $dumper = null)
public function __construct(ClonerInterface $cloner, ?HtmlDumper $dumper = null)
{
$this->cloner = $cloner;
$this->dumper = $dumper;
Expand Down
2 changes: 1 addition & 1 deletion Extension/FormExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ final class FormExtension extends AbstractExtension
{
private ?TranslatorInterface $translator;

public function __construct(TranslatorInterface $translator = null)
public function __construct(?TranslatorInterface $translator = null)
{
$this->translator = $translator;
}
Expand Down
2 changes: 1 addition & 1 deletion Extension/HtmlSanitizerExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function getFilters(): array
];
}

public function sanitize(string $html, string $sanitizer = null): string
public function sanitize(string $html, ?string $sanitizer = null): string
{
return $this->sanitizers->get($sanitizer ?? $this->defaultSanitizer)->sanitize($html);
}
Expand Down
2 changes: 1 addition & 1 deletion Extension/HttpKernelRuntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class HttpKernelRuntime
private FragmentHandler $handler;
private ?FragmentUriGeneratorInterface $fragmentUriGenerator;

public function __construct(FragmentHandler $handler, FragmentUriGeneratorInterface $fragmentUriGenerator = null)
public function __construct(FragmentHandler $handler, ?FragmentUriGeneratorInterface $fragmentUriGenerator = null)
{
$this->handler = $handler;
$this->fragmentUriGenerator = $fragmentUriGenerator;
Expand Down
4 changes: 2 additions & 2 deletions Extension/LogoutUrlExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function getFunctions(): array
*
* @param string|null $key The firewall key or null to use the current firewall key
*/
public function getLogoutPath(string $key = null): string
public function getLogoutPath(?string $key = null): string
{
return $this->generator->getLogoutPath($key);
}
Expand All @@ -52,7 +52,7 @@ public function getLogoutPath(string $key = null): string
*
* @param string|null $key The firewall key or null to use the current firewall key
*/
public function getLogoutUrl(string $key = null): string
public function getLogoutUrl(?string $key = null): string
{
return $this->generator->getLogoutUrl($key);
}
Expand Down
2 changes: 1 addition & 1 deletion Extension/ProfilerExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final class ProfilerExtension extends BaseProfilerExtension
*/
private \SplObjectStorage $events;

public function __construct(Profile $profile, Stopwatch $stopwatch = null)
public function __construct(Profile $profile, ?Stopwatch $stopwatch = null)
{
parent::__construct($profile);

Expand Down
8 changes: 4 additions & 4 deletions Extension/SecurityExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ final class SecurityExtension extends AbstractExtension
private ?AuthorizationCheckerInterface $securityChecker;
private ?ImpersonateUrlGenerator $impersonateUrlGenerator;

public function __construct(AuthorizationCheckerInterface $securityChecker = null, ImpersonateUrlGenerator $impersonateUrlGenerator = null)
public function __construct(?AuthorizationCheckerInterface $securityChecker = null, ?ImpersonateUrlGenerator $impersonateUrlGenerator = null)
{
$this->securityChecker = $securityChecker;
$this->impersonateUrlGenerator = $impersonateUrlGenerator;
}

public function isGranted(mixed $role, mixed $object = null, string $field = null): bool
public function isGranted(mixed $role, mixed $object = null, ?string $field = null): bool
{
if (null === $this->securityChecker) {
return false;
Expand All @@ -51,7 +51,7 @@ public function isGranted(mixed $role, mixed $object = null, string $field = nul
}
}

public function getImpersonateExitUrl(string $exitTo = null): string
public function getImpersonateExitUrl(?string $exitTo = null): string
{
if (null === $this->impersonateUrlGenerator) {
return '';
Expand All @@ -60,7 +60,7 @@ public function getImpersonateExitUrl(string $exitTo = null): string
return $this->impersonateUrlGenerator->generateExitUrl($exitTo);
}

public function getImpersonateExitPath(string $exitTo = null): string
public function getImpersonateExitPath(?string $exitTo = null): string
{
if (null === $this->impersonateUrlGenerator) {
return '';
Expand Down
2 changes: 1 addition & 1 deletion Extension/StopwatchExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class StopwatchExtension extends AbstractExtension
private ?Stopwatch $stopwatch;
private bool $enabled;

public function __construct(Stopwatch $stopwatch = null, bool $enabled = true)
public function __construct(?Stopwatch $stopwatch = null, bool $enabled = true)
{
$this->stopwatch = $stopwatch;
$this->enabled = $enabled;
Expand Down
6 changes: 3 additions & 3 deletions Extension/TranslationExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ final class TranslationExtension extends AbstractExtension
private ?TranslatorInterface $translator;
private ?TranslationNodeVisitor $translationNodeVisitor;

public function __construct(TranslatorInterface $translator = null, TranslationNodeVisitor $translationNodeVisitor = null)
public function __construct(?TranslatorInterface $translator = null, ?TranslationNodeVisitor $translationNodeVisitor = null)
{
$this->translator = $translator;
$this->translationNodeVisitor = $translationNodeVisitor;
Expand Down Expand Up @@ -96,7 +96,7 @@ public function getTranslationNodeVisitor(): TranslationNodeVisitor
/**
* @param array|string $arguments Can be the locale as a string when $message is a TranslatableInterface
*/
public function trans(string|\Stringable|TranslatableInterface|null $message, array|string $arguments = [], string $domain = null, string $locale = null, int $count = null): string
public function trans(string|\Stringable|TranslatableInterface|null $message, array|string $arguments = [], ?string $domain = null, ?string $locale = null, ?int $count = null): string
{
if ($message instanceof TranslatableInterface) {
if ([] !== $arguments && !\is_string($arguments)) {
Expand Down Expand Up @@ -125,7 +125,7 @@ public function trans(string|\Stringable|TranslatableInterface|null $message, ar
return $this->getTranslator()->trans($message, $arguments, $domain, $locale);
}

public function createTranslatable(string $message, array $parameters = [], string $domain = null): TranslatableMessage
public function createTranslatable(string $message, array $parameters = [], ?string $domain = null): TranslatableMessage
{
if (!class_exists(TranslatableMessage::class)) {
throw new \LogicException(sprintf('You cannot use the "%s" as the Translation Component is not installed. Try running "composer require symfony/translation".', __CLASS__));
Expand Down
14 changes: 7 additions & 7 deletions Extension/WorkflowExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function getFunctions(): array
/**
* Returns true if the transition is enabled.
*/
public function canTransition(object $subject, string $transitionName, string $name = null): bool
public function canTransition(object $subject, string $transitionName, ?string $name = null): bool
{
return $this->workflowRegistry->get($subject, $name)->can($subject, $transitionName);
}
Expand All @@ -58,20 +58,20 @@ public function canTransition(object $subject, string $transitionName, string $n
*
* @return Transition[]
*/
public function getEnabledTransitions(object $subject, string $name = null): array
public function getEnabledTransitions(object $subject, ?string $name = null): array
{
return $this->workflowRegistry->get($subject, $name)->getEnabledTransitions($subject);
}

public function getEnabledTransition(object $subject, string $transition, string $name = null): ?Transition
public function getEnabledTransition(object $subject, string $transition, ?string $name = null): ?Transition
{
return $this->workflowRegistry->get($subject, $name)->getEnabledTransition($subject, $transition);
}

/**
* Returns true if the place is marked.
*/
public function hasMarkedPlace(object $subject, string $placeName, string $name = null): bool
public function hasMarkedPlace(object $subject, string $placeName, ?string $name = null): bool
{
return $this->workflowRegistry->get($subject, $name)->getMarking($subject)->has($placeName);
}
Expand All @@ -81,7 +81,7 @@ public function hasMarkedPlace(object $subject, string $placeName, string $name
*
* @return string[]|int[]
*/
public function getMarkedPlaces(object $subject, bool $placesNameOnly = true, string $name = null): array
public function getMarkedPlaces(object $subject, bool $placesNameOnly = true, ?string $name = null): array
{
$places = $this->workflowRegistry->get($subject, $name)->getMarking($subject)->getPlaces();

Expand All @@ -99,7 +99,7 @@ public function getMarkedPlaces(object $subject, bool $placesNameOnly = true, st
* Use a string (the place name) to get place metadata
* Use a Transition instance to get transition metadata
*/
public function getMetadata(object $subject, string $key, string|Transition $metadataSubject = null, string $name = null): mixed
public function getMetadata(object $subject, string $key, string|Transition|null $metadataSubject = null, ?string $name = null): mixed
{
return $this
->workflowRegistry
Expand All @@ -109,7 +109,7 @@ public function getMetadata(object $subject, string $key, string|Transition $met
;
}

public function buildTransitionBlockerList(object $subject, string $transitionName, string $name = null): TransitionBlockerList
public function buildTransitionBlockerList(object $subject, string $transitionName, ?string $name = null): TransitionBlockerList
{
$workflow = $this->workflowRegistry->get($subject, $name);

Expand Down
2 changes: 1 addition & 1 deletion Mime/BodyRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class BodyRenderer implements BodyRendererInterface
private HtmlToTextConverterInterface $converter;
private ?LocaleSwitcher $localeSwitcher = null;

public function __construct(Environment $twig, array $context = [], HtmlToTextConverterInterface $converter = null, LocaleSwitcher $localeSwitcher = null)
public function __construct(Environment $twig, array $context = [], ?HtmlToTextConverterInterface $converter = null, ?LocaleSwitcher $localeSwitcher = null)
{
$this->twig = $twig;
$this->context = $context;
Expand Down
4 changes: 2 additions & 2 deletions Mime/NotificationEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class NotificationEmail extends TemplatedEmail
];
private bool $rendered = false;

public function __construct(Headers $headers = null, AbstractPart $body = null)
public function __construct(?Headers $headers = null, ?AbstractPart $body = null)
{
$missingPackages = [];
if (!class_exists(CssInlinerExtension::class)) {
Expand All @@ -63,7 +63,7 @@ public function __construct(Headers $headers = null, AbstractPart $body = null)
/**
* Creates a NotificationEmail instance that is appropriate to send to normal (non-admin) users.
*/
public static function asPublicEmail(Headers $headers = null, AbstractPart $body = null): self
public static function asPublicEmail(?Headers $headers = null, ?AbstractPart $body = null): self
{
$email = new static($headers, $body);
$email->markAsPublic();
Expand Down
4 changes: 2 additions & 2 deletions Mime/WrappedTemplatedEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function toName(): string
* @param string|null $contentType The media type (i.e. MIME type) of the image file (e.g. 'image/png').
* Some email clients require this to display embedded images.
*/
public function image(string $image, string $contentType = null): string
public function image(string $image, ?string $contentType = null): string
{
$file = $this->twig->getLoader()->getSourceContext($image);
$body = $file->getPath() ? new File($file->getPath()) : $file->getCode();
Expand All @@ -59,7 +59,7 @@ public function image(string $image, string $contentType = null): string
* @param string|null $contentType The media type (i.e. MIME type) of the file (e.g. 'application/pdf').
* Some email clients require this to display attached files.
*/
public function attach(string $file, string $name = null, string $contentType = null): void
public function attach(string $file, ?string $name = null, ?string $contentType = null): void
{
$file = $this->twig->getLoader()->getSourceContext($file);
$body = $file->getPath() ? new File($file->getPath()) : $file->getCode();
Expand Down
2 changes: 1 addition & 1 deletion Node/DumpNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class DumpNode extends Node
{
private string $varPrefix;

public function __construct(string $varPrefix, ?Node $values, int $lineno, string $tag = null)
public function __construct(string $varPrefix, ?Node $values, int $lineno, ?string $tag = null)
{
$nodes = [];
if (null !== $values) {
Expand Down
2 changes: 1 addition & 1 deletion Node/FormThemeNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
final class FormThemeNode extends Node
{
public function __construct(Node $form, Node $resources, int $lineno, string $tag = null, bool $only = false)
public function __construct(Node $form, Node $resources, int $lineno, ?string $tag = null, bool $only = false)
{
parent::__construct(['form' => $form, 'resources' => $resources], ['only' => $only], $lineno, $tag);
}
Expand Down
2 changes: 1 addition & 1 deletion Node/StopwatchNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
final class StopwatchNode extends Node
{
public function __construct(Node $name, Node $body, AssignNameExpression $var, int $lineno = 0, string $tag = null)
public function __construct(Node $name, Node $body, AssignNameExpression $var, int $lineno = 0, ?string $tag = null)
{
parent::__construct(['body' => $body, 'name' => $name, 'var' => $var], [], $lineno, $tag);
}
Expand Down
2 changes: 1 addition & 1 deletion Node/TransDefaultDomainNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
final class TransDefaultDomainNode extends Node
{
public function __construct(AbstractExpression $expr, int $lineno = 0, string $tag = null)
public function __construct(AbstractExpression $expr, int $lineno = 0, ?string $tag = null)
{
parent::__construct(['expr' => $expr], [], $lineno, $tag);
}
Expand Down
2 changes: 1 addition & 1 deletion Node/TransNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
final class TransNode extends Node
{
public function __construct(Node $body, Node $domain = null, AbstractExpression $count = null, AbstractExpression $vars = null, AbstractExpression $locale = null, int $lineno = 0, string $tag = null)
public function __construct(Node $body, ?Node $domain = null, ?AbstractExpression $count = null, ?AbstractExpression $vars = null, ?AbstractExpression $locale = null, int $lineno = 0, ?string $tag = null)
{
$nodes = ['body' => $body];
if (null !== $domain) {
Expand Down
2 changes: 1 addition & 1 deletion NodeVisitor/Scope.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Scope
private array $data = [];
private bool $left = false;

public function __construct(self $parent = null)
public function __construct(?self $parent = null)
{
$this->parent = $parent;
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/Command/DebugCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public static function provideCompletionSuggestions(): iterable
yield 'option --format' => [['--format', ''], ['text', 'json']];
}

private function createCommandTester(array $paths = [], array $bundleMetadata = [], string $defaultPath = null, bool $useChainLoader = false, array $globals = []): CommandTester
private function createCommandTester(array $paths = [], array $bundleMetadata = [], ?string $defaultPath = null, bool $useChainLoader = false, array $globals = []): CommandTester
{
$projectDir = \dirname(__DIR__).\DIRECTORY_SEPARATOR.'Fixtures';
$loader = new FilesystemLoader([], $projectDir);
Expand Down
2 changes: 1 addition & 1 deletion Tests/Extension/AbstractLayoutTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2672,7 +2672,7 @@ public function testHelpWithTranslatableMessage()
public function testHelpWithTranslatableInterface()
{
$message = new class() implements TranslatableInterface {
public function trans(TranslatorInterface $translator, string $locale = null): string
public function trans(TranslatorInterface $translator, ?string $locale = null): string
{
return $translator->trans('foo');
}
Expand Down

0 comments on commit e9a5d25

Please sign in to comment.