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 ddfd72e + 5270fc8 commit 3cd13dc
Show file tree
Hide file tree
Showing 28 changed files with 55 additions and 55 deletions.
8 changes: 4 additions & 4 deletions Attribute/AsAnnounceListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ final class AsAnnounceListener extends AsEventListener
use BuildEventNameTrait;

public function __construct(
string $workflow = null,
string $transition = null,
string $method = null,
?string $workflow = null,
?string $transition = null,
?string $method = null,
int $priority = 0,
string $dispatcher = null,
?string $dispatcher = null,
) {
parent::__construct($this->buildEventName('announce', 'transition', $workflow, $transition), $method, $priority, $dispatcher);
}
Expand Down
8 changes: 4 additions & 4 deletions Attribute/AsCompletedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ final class AsCompletedListener extends AsEventListener
use BuildEventNameTrait;

public function __construct(
string $workflow = null,
string $transition = null,
string $method = null,
?string $workflow = null,
?string $transition = null,
?string $method = null,
int $priority = 0,
string $dispatcher = null,
?string $dispatcher = null,
) {
parent::__construct($this->buildEventName('completed', 'transition', $workflow, $transition), $method, $priority, $dispatcher);
}
Expand Down
8 changes: 4 additions & 4 deletions Attribute/AsEnterListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ final class AsEnterListener extends AsEventListener
use BuildEventNameTrait;

public function __construct(
string $workflow = null,
string $place = null,
string $method = null,
?string $workflow = null,
?string $place = null,
?string $method = null,
int $priority = 0,
string $dispatcher = null,
?string $dispatcher = null,
) {
parent::__construct($this->buildEventName('enter', 'place', $workflow, $place), $method, $priority, $dispatcher);
}
Expand Down
8 changes: 4 additions & 4 deletions Attribute/AsEnteredListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ final class AsEnteredListener extends AsEventListener
use BuildEventNameTrait;

public function __construct(
string $workflow = null,
string $place = null,
string $method = null,
?string $workflow = null,
?string $place = null,
?string $method = null,
int $priority = 0,
string $dispatcher = null,
?string $dispatcher = null,
) {
parent::__construct($this->buildEventName('entered', 'place', $workflow, $place), $method, $priority, $dispatcher);
}
Expand Down
8 changes: 4 additions & 4 deletions Attribute/AsGuardListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ final class AsGuardListener extends AsEventListener
use BuildEventNameTrait;

public function __construct(
string $workflow = null,
string $transition = null,
string $method = null,
?string $workflow = null,
?string $transition = null,
?string $method = null,
int $priority = 0,
string $dispatcher = null,
?string $dispatcher = null,
) {
parent::__construct($this->buildEventName('guard', 'transition', $workflow, $transition), $method, $priority, $dispatcher);
}
Expand Down
8 changes: 4 additions & 4 deletions Attribute/AsLeaveListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ final class AsLeaveListener extends AsEventListener
use BuildEventNameTrait;

public function __construct(
string $workflow = null,
string $place = null,
string $method = null,
?string $workflow = null,
?string $place = null,
?string $method = null,
int $priority = 0,
string $dispatcher = null,
?string $dispatcher = null,
) {
parent::__construct($this->buildEventName('leave', 'place', $workflow, $place), $method, $priority, $dispatcher);
}
Expand Down
8 changes: 4 additions & 4 deletions Attribute/AsTransitionListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ final class AsTransitionListener extends AsEventListener
use BuildEventNameTrait;

public function __construct(
string $workflow = null,
string $transition = null,
string $method = null,
?string $workflow = null,
?string $transition = null,
?string $method = null,
int $priority = 0,
string $dispatcher = null,
?string $dispatcher = null,
) {
parent::__construct($this->buildEventName('transition', 'transition', $workflow, $transition), $method, $priority, $dispatcher);
}
Expand Down
2 changes: 1 addition & 1 deletion Attribute/BuildEventNameTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
trait BuildEventNameTrait
{
private static function buildEventName(string $keyword, string $argument, string $workflow = null, string $node = null): string
private static function buildEventName(string $keyword, string $argument, ?string $workflow = null, ?string $node = null): string
{
if (null === $workflow) {
if (null !== $node) {
Expand Down
4 changes: 2 additions & 2 deletions DataCollector/WorkflowDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct(
) {
}

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

Expand Down Expand Up @@ -165,7 +165,7 @@ private function getEventListeners(WorkflowInterface $workflow): array
return $listeners;
}

private function summarizeListener(callable $callable, string $eventName = null, Transition $transition = null): array
private function summarizeListener(callable $callable, ?string $eventName = null, ?Transition $transition = null): array
{
$extra = [];

Expand Down
4 changes: 2 additions & 2 deletions Definition.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final class Definition
* @param Transition[] $transitions
* @param string|string[]|null $initialPlaces
*/
public function __construct(array $places, array $transitions, string|array $initialPlaces = null, MetadataStoreInterface $metadataStore = null)
public function __construct(array $places, array $transitions, string|array|null $initialPlaces = null, ?MetadataStoreInterface $metadataStore = null)
{
foreach ($places as $place) {
$this->addPlace($place);
Expand Down Expand Up @@ -76,7 +76,7 @@ public function getMetadataStore(): MetadataStoreInterface
return $this->metadataStore;
}

private function setInitialPlaces(string|array $places = null): void
private function setInitialPlaces(string|array|null $places = null): void
{
if (1 > \func_num_args()) {
trigger_deprecation('symfony/workflow', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
Expand Down
2 changes: 1 addition & 1 deletion Dumper/DumperInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ interface DumperInterface
/**
* Dumps a workflow definition.
*/
public function dump(Definition $definition, Marking $marking = null, array $options = []): string;
public function dump(Definition $definition, ?Marking $marking = null, array $options = []): string;
}
4 changes: 2 additions & 2 deletions Dumper/GraphvizDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class GraphvizDumper implements DumperInterface
* * node: The default options for nodes (places + transitions)
* * edge: The default options for edges
*/
public function dump(Definition $definition, Marking $marking = null, array $options = []): string
public function dump(Definition $definition, ?Marking $marking = null, array $options = []): string
{
$withMetadata = $options['with-metadata'] ?? false;

Expand All @@ -64,7 +64,7 @@ public function dump(Definition $definition, Marking $marking = null, array $opt
/**
* @internal
*/
protected function findPlaces(Definition $definition, bool $withMetadata, Marking $marking = null): array
protected function findPlaces(Definition $definition, bool $withMetadata, ?Marking $marking = null): array
{
$workflowMetadata = $definition->getMetadataStore();

Expand Down
2 changes: 1 addition & 1 deletion Dumper/MermaidDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function __construct(string $transitionType, string $direction = self::DI
$this->transitionType = $transitionType;
}

public function dump(Definition $definition, Marking $marking = null, array $options = []): string
public function dump(Definition $definition, ?Marking $marking = null, array $options = []): string
{
$this->linkCount = 0;
$placeNameMap = [];
Expand Down
4 changes: 2 additions & 2 deletions Dumper/PlantUmlDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function __construct(string $transitionType)
$this->transitionType = $transitionType;
}

public function dump(Definition $definition, Marking $marking = null, array $options = []): string
public function dump(Definition $definition, ?Marking $marking = null, array $options = []): string
{
$options = array_replace_recursive(self::DEFAULT_OPTIONS, $options);

Expand Down Expand Up @@ -191,7 +191,7 @@ private function escape(string $string): string
return '"'.str_replace('"', '', $string).'"';
}

private function getState(string $place, Definition $definition, Marking $marking = null): string
private function getState(string $place, Definition $definition, ?Marking $marking = null): string
{
$workflowMetadata = $definition->getMetadataStore();

Expand Down
2 changes: 1 addition & 1 deletion Dumper/StateMachineGraphvizDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class StateMachineGraphvizDumper extends GraphvizDumper
* * node: The default options for nodes (places)
* * edge: The default options for edges
*/
public function dump(Definition $definition, Marking $marking = null, array $options = []): string
public function dump(Definition $definition, ?Marking $marking = null, array $options = []): string
{
$withMetadata = $options['with-metadata'] ?? false;

Expand Down
2 changes: 1 addition & 1 deletion Event/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Event extends BaseEvent
private ?Transition $transition;
private ?WorkflowInterface $workflow;

public function __construct(object $subject, Marking $marking, Transition $transition = null, WorkflowInterface $workflow = null, array $context = [])
public function __construct(object $subject, Marking $marking, ?Transition $transition = null, ?WorkflowInterface $workflow = null, array $context = [])
{
$this->subject = $subject;
$this->marking = $marking;
Expand Down
4 changes: 2 additions & 2 deletions Event/GuardEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class GuardEvent extends Event
{
private TransitionBlockerList $transitionBlockerList;

public function __construct(object $subject, Marking $marking, Transition $transition, WorkflowInterface $workflow = null)
public function __construct(object $subject, Marking $marking, Transition $transition, ?WorkflowInterface $workflow = null)
{
parent::__construct($subject, $marking, $transition, $workflow);

Expand All @@ -49,7 +49,7 @@ public function isBlocked(): bool
return !$this->transitionBlockerList->isEmpty();
}

public function setBlocked(bool $blocked, string $message = null): void
public function setBlocked(bool $blocked, ?string $message = null): void
{
if (!$blocked) {
$this->transitionBlockerList->clear();
Expand Down
2 changes: 1 addition & 1 deletion EventListener/GuardListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class GuardListener
private ?RoleHierarchyInterface $roleHierarchy;
private ?ValidatorInterface $validator;

public function __construct(array $configuration, ExpressionLanguage $expressionLanguage, TokenStorageInterface $tokenStorage, AuthorizationCheckerInterface $authorizationChecker, AuthenticationTrustResolverInterface $trustResolver, RoleHierarchyInterface $roleHierarchy = null, ValidatorInterface $validator = null)
public function __construct(array $configuration, ExpressionLanguage $expressionLanguage, TokenStorageInterface $tokenStorage, AuthorizationCheckerInterface $authorizationChecker, AuthenticationTrustResolverInterface $trustResolver, ?RoleHierarchyInterface $roleHierarchy = null, ?ValidatorInterface $validator = null)
{
$this->configuration = $configuration;
$this->expressionLanguage = $expressionLanguage;
Expand Down
2 changes: 1 addition & 1 deletion Metadata/GetMetadataTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ trait GetMetadataTrait
/**
* @return mixed
*/
public function getMetadata(string $key, string|Transition $subject = null)
public function getMetadata(string $key, string|Transition|null $subject = null)
{
if (null === $subject) {
return $this->getWorkflowMetadata()[$key] ?? null;
Expand Down
2 changes: 1 addition & 1 deletion Metadata/InMemoryMetadataStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final class InMemoryMetadataStore implements MetadataStoreInterface
/**
* @param \SplObjectStorage<Transition, array>|null $transitionsMetadata
*/
public function __construct(array $workflowMetadata = [], array $placesMetadata = [], \SplObjectStorage $transitionsMetadata = null)
public function __construct(array $workflowMetadata = [], array $placesMetadata = [], ?\SplObjectStorage $transitionsMetadata = null)
{
$this->workflowMetadata = $workflowMetadata;
$this->placesMetadata = $placesMetadata;
Expand Down
2 changes: 1 addition & 1 deletion Metadata/MetadataStoreInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ public function getTransitionMetadata(Transition $transition): array;
*
* @return mixed
*/
public function getMetadata(string $key, string|Transition $subject = null);
public function getMetadata(string $key, string|Transition|null $subject = null);
}
4 changes: 2 additions & 2 deletions Registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function addWorkflow(WorkflowInterface $workflow, WorkflowSupportStrategy
$this->workflows[] = [$workflow, $supportStrategy];
}

public function has(object $subject, string $workflowName = null): bool
public function has(object $subject, ?string $workflowName = null): bool
{
foreach ($this->workflows as [$workflow, $supportStrategy]) {
if ($this->supports($workflow, $supportStrategy, $subject, $workflowName)) {
Expand All @@ -41,7 +41,7 @@ public function has(object $subject, string $workflowName = null): bool
return false;
}

public function get(object $subject, string $workflowName = null): WorkflowInterface
public function get(object $subject, ?string $workflowName = null): WorkflowInterface
{
$matched = [];

Expand Down
2 changes: 1 addition & 1 deletion StateMachine.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
class StateMachine extends Workflow
{
public function __construct(Definition $definition, MarkingStoreInterface $markingStore = null, EventDispatcherInterface $dispatcher = null, string $name = 'unnamed', array $eventsToDispatch = null)
public function __construct(Definition $definition, ?MarkingStoreInterface $markingStore = null, ?EventDispatcherInterface $dispatcher = null, string $name = 'unnamed', ?array $eventsToDispatch = null)
{
parent::__construct($definition, $markingStore ?? new MethodMarkingStore(true), $dispatcher, $name, $eventsToDispatch);
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/Attribute/AsListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class AsListenerTest extends TestCase
/**
* @dataProvider provideOkTests
*/
public function testOk(string $class, string $expectedEvent, string $workflow = null, string $node = null)
public function testOk(string $class, string $expectedEvent, ?string $workflow = null, ?string $node = null)
{
$attribute = new $class($workflow, $node);

Expand Down
2 changes: 1 addition & 1 deletion Tests/EventListener/GuardListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function testGuardExpressionBlocks()
$this->assertTrue($event->isBlocked());
}

private function createEvent(Transition $transition = null): GuardEvent
private function createEvent(?Transition $transition = null): GuardEvent
{
$subject = new Subject();
$transition ??= new Transition('name', 'from', 'to');
Expand Down
2 changes: 1 addition & 1 deletion Tests/WorkflowTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ class EventDispatcherMock implements \Symfony\Contracts\EventDispatcher\EventDis
{
public array $dispatchedEvents = [];

public function dispatch($event, string $eventName = null): object
public function dispatch($event, ?string $eventName = null): object
{
$this->dispatchedEvents[] = $eventName;

Expand Down
2 changes: 1 addition & 1 deletion TransitionBlocker.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static function createBlockedByExpressionGuardListener(string $expression
* Creates a blocker that says the transition cannot be made because of an
* unknown reason.
*/
public static function createUnknown(string $message = null, int $backtraceFrame = 2): self
public static function createUnknown(?string $message = null, int $backtraceFrame = 2): self
{
if (null !== $message) {
return new static($message, self::UNKNOWN);
Expand Down
2 changes: 1 addition & 1 deletion Workflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Workflow implements WorkflowInterface
*/
private ?array $eventsToDispatch = null;

public function __construct(Definition $definition, MarkingStoreInterface $markingStore = null, EventDispatcherInterface $dispatcher = null, string $name = 'unnamed', array $eventsToDispatch = null)
public function __construct(Definition $definition, ?MarkingStoreInterface $markingStore = null, ?EventDispatcherInterface $dispatcher = null, string $name = 'unnamed', ?array $eventsToDispatch = null)
{
$this->definition = $definition;
$this->markingStore = $markingStore ?? new MethodMarkingStore();
Expand Down

0 comments on commit 3cd13dc

Please sign in to comment.