Skip to content

Commit

Permalink
Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_…
Browse files Browse the repository at this point in the history
…null_value
  • Loading branch information
nicolas-grekas committed Jan 23, 2024
1 parent b93c436 commit ff424ed
Show file tree
Hide file tree
Showing 16 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion 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, $initialPlaces = null, MetadataStoreInterface $metadataStore = null)
public function __construct(array $places, array $transitions, $initialPlaces = null, ?MetadataStoreInterface $metadataStore = null)
{
foreach ($places as $place) {
$this->addPlace($place);
Expand Down
2 changes: 1 addition & 1 deletion Dumper/DumperInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ interface DumperInterface
*
* @return string
*/
public function dump(Definition $definition, Marking $marking = null, array $options = []);
public function dump(Definition $definition, ?Marking $marking = null, array $options = []);
}
4 changes: 2 additions & 2 deletions Dumper/GraphvizDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,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 = [])
public function dump(Definition $definition, ?Marking $marking = null, array $options = [])
{
$places = $this->findPlaces($definition, $marking);
$transitions = $this->findTransitions($definition);
Expand All @@ -62,7 +62,7 @@ public function dump(Definition $definition, Marking $marking = null, array $opt
/**
* @internal
*/
protected function findPlaces(Definition $definition, Marking $marking = null): array
protected function findPlaces(Definition $definition, ?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 @@ -66,7 +66,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
6 changes: 3 additions & 3 deletions Dumper/PlantUmlDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ class PlantUmlDumper implements DumperInterface

private $transitionType = self::STATEMACHINE_TRANSITION;

public function __construct(string $transitionType = null)
public function __construct(?string $transitionType = null)
{
if (!\in_array($transitionType, self::TRANSITION_TYPES, true)) {
throw new \InvalidArgumentException("Transition type '$transitionType' does not exist.");
}
$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 @@ -27,7 +27,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 = [])
public function dump(Definition $definition, ?Marking $marking = null, array $options = [])
{
$places = $this->findPlaces($definition, $marking);
$edges = $this->findEdges($definition);
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;
private $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 @@ -28,7 +28,7 @@ final class GuardEvent extends Event
/**
* {@inheritdoc}
*/
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 @@ -45,7 +45,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 $roleHierarchy;
private $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/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
4 changes: 2 additions & 2 deletions Registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,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 Workflow
*/
public function get(object $subject, string $workflowName = null)
public function get(object $subject, ?string $workflowName = null)
{
$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/EventListener/GuardListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function testGuardExpressionBlocks()
$this->assertTrue($event->isBlocked());
}

private function createEvent(Transition $transition = null)
private function createEvent(?Transition $transition = null)
{
$subject = new Subject();
$transition = $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 @@ -791,7 +791,7 @@ class EventDispatcherMock implements \Symfony\Contracts\EventDispatcher\EventDis
{
public $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 $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 ff424ed

Please sign in to comment.