From c06092fbef1d89772de37e11e71e53233c527e5a Mon Sep 17 00:00:00 2001 From: YunusEmreNalbant Date: Wed, 13 Dec 2023 10:39:06 +0000 Subject: [PATCH] chore: Fix styling --- src/Actor/Machine.php | 6 ++--- src/Actor/State.php | 4 ++-- src/Behavior/ActionBehavior.php | 2 +- src/Behavior/EventBehavior.php | 2 +- src/Behavior/GuardBehavior.php | 2 +- src/Behavior/InvokableBehavior.php | 2 +- src/Behavior/ResultBehavior.php | 2 +- src/Behavior/ValidationGuardBehavior.php | 2 +- src/ContextManager.php | 2 +- src/Definition/MachineDefinition.php | 22 +++++++++---------- src/Definition/StateDefinition.php | 4 ++-- src/Definition/TransitionBranch.php | 2 +- src/Enums/InternalEvent.php | 6 ++--- tests/ActionTest.php | 2 +- tests/InvokableBehaviorArgumentsTest.php | 6 ++--- tests/Stubs/Actions/IsOddAction.php | 2 +- tests/Stubs/Guards/IsOddGuard.php | 2 +- .../Guards/IsTimerValidValidationGuard.php | 2 +- tests/Stubs/Guards/IsValidatedOddGuard.php | 2 +- tests/Stubs/Machines/Asd/Actions/AAction.php | 2 +- tests/Stubs/Machines/Asd/Actions/DAction.php | 2 +- tests/Stubs/Machines/Asd/Actions/SAction.php | 2 +- .../Machines/Asd/Actions/SleepAction.php | 2 +- .../Stubs/Machines/Qwerty/Actions/TAction.php | 2 +- .../Actions/AddAnotherValueAction.php | 2 +- .../TrafficLights/Actions/AddValueAction.php | 2 +- .../TrafficLights/Actions/DecrementAction.php | 2 +- .../Actions/DoNothingInsideClassAction.php | 2 +- .../TrafficLights/Actions/IncrementAction.php | 2 +- .../Actions/MultiplyByTwoAction.php | 2 +- .../Actions/SubtractValueAction.php | 2 +- .../TrafficLights/Guards/IsEvenGuard.php | 2 +- tests/Stubs/Machines/Xyz/Actions/XAction.php | 2 +- tests/Stubs/Machines/Xyz/Actions/YAction.php | 2 +- tests/Stubs/Machines/Xyz/Actions/ZAction.php | 2 +- tests/Stubs/Results/GreenResult.php | 2 +- 36 files changed, 54 insertions(+), 54 deletions(-) diff --git a/src/Actor/Machine.php b/src/Actor/Machine.php index 0055cf95..51d331e9 100644 --- a/src/Actor/Machine.php +++ b/src/Actor/Machine.php @@ -107,8 +107,8 @@ public static function definition(): ?MachineDefinition * @return self The newly created and initialized machine instance. */ public static function create( - MachineDefinition|array $definition = null, - State|string $state = null, + MachineDefinition|array|null $definition = null, + State|string|null $state = null, ): self { if (is_array($definition)) { $definition = MachineDefinition::define( @@ -135,7 +135,7 @@ public static function create( * * @return self The started machine instance. */ - public function start(State|string $state = null): self + public function start(State|string|null $state = null): self { $this->state = match (true) { $state === null => $this->definition->getInitialState(), diff --git a/src/Actor/State.php b/src/Actor/State.php index a92165cd..11498ac4 100644 --- a/src/Actor/State.php +++ b/src/Actor/State.php @@ -82,8 +82,8 @@ public function setCurrentStateDefinition(StateDefinition $stateDefinition): sel */ public function setInternalEventBehavior( InternalEvent $type, - string $placeholder = null, - array $payload = null, + ?string $placeholder = null, + ?array $payload = null, bool $shouldLog = false, ): self { $eventDefinition = new EventDefinition( diff --git a/src/Behavior/ActionBehavior.php b/src/Behavior/ActionBehavior.php index d47a4294..da139fa3 100644 --- a/src/Behavior/ActionBehavior.php +++ b/src/Behavior/ActionBehavior.php @@ -24,6 +24,6 @@ abstract class ActionBehavior extends InvokableBehavior abstract public function __invoke( ContextManager $context, EventBehavior $eventBehavior, - array $arguments = null, + ?array $arguments = null, ): void; } diff --git a/src/Behavior/EventBehavior.php b/src/Behavior/EventBehavior.php index 6412c3d7..dae38587 100644 --- a/src/Behavior/EventBehavior.php +++ b/src/Behavior/EventBehavior.php @@ -39,7 +39,7 @@ public function __construct( public null|string|Optional $type = null, public null|array|Optional $payload = null, #[WithoutValidation] - bool $isTransactional = null, + ?bool $isTransactional = null, #[WithoutValidation] mixed $actor = null, public int|Optional $version = 1, diff --git a/src/Behavior/GuardBehavior.php b/src/Behavior/GuardBehavior.php index f3f6024e..b6515a0c 100644 --- a/src/Behavior/GuardBehavior.php +++ b/src/Behavior/GuardBehavior.php @@ -26,6 +26,6 @@ abstract class GuardBehavior extends InvokableBehavior abstract public function __invoke( ContextManager $context, EventBehavior $eventBehavior, - array $arguments = null, + ?array $arguments = null, ): bool; } diff --git a/src/Behavior/InvokableBehavior.php b/src/Behavior/InvokableBehavior.php index 3513fa86..915f4784 100644 --- a/src/Behavior/InvokableBehavior.php +++ b/src/Behavior/InvokableBehavior.php @@ -54,7 +54,7 @@ public function __construct( abstract public function __invoke( ContextManager $context, EventBehavior $eventBehavior, - array $arguments = null, + ?array $arguments = null, ); /** diff --git a/src/Behavior/ResultBehavior.php b/src/Behavior/ResultBehavior.php index c80a68f5..08867730 100644 --- a/src/Behavior/ResultBehavior.php +++ b/src/Behavior/ResultBehavior.php @@ -11,6 +11,6 @@ abstract class ResultBehavior extends InvokableBehavior abstract public function __invoke( ContextManager $context, EventBehavior $eventBehavior, - array $arguments = null, + ?array $arguments = null, ): mixed; } diff --git a/src/Behavior/ValidationGuardBehavior.php b/src/Behavior/ValidationGuardBehavior.php index 439c2bd5..ad2046c5 100644 --- a/src/Behavior/ValidationGuardBehavior.php +++ b/src/Behavior/ValidationGuardBehavior.php @@ -31,6 +31,6 @@ abstract class ValidationGuardBehavior extends GuardBehavior abstract public function __invoke( ContextManager $context, EventBehavior $eventBehavior, - array $arguments = null, + ?array $arguments = null, ): bool; } diff --git a/src/ContextManager.php b/src/ContextManager.php index bd51e957..fd9122a9 100644 --- a/src/ContextManager.php +++ b/src/ContextManager.php @@ -87,7 +87,7 @@ public function set(string $key, mixed $value): mixed * @return bool True if the key exists and (if a type is specified) * its value is of the given type. False otherwise. */ - public function has(string $key, string $type = null): bool + public function has(string $key, ?string $type = null): bool { $hasKey = match (true) { get_class($this) === self::class => Arr::has($this->data, $key), diff --git a/src/Definition/MachineDefinition.php b/src/Definition/MachineDefinition.php index 3d0924c4..e0586ff8 100644 --- a/src/Definition/MachineDefinition.php +++ b/src/Definition/MachineDefinition.php @@ -117,9 +117,9 @@ private function __construct( * @return self The created machine definition. */ public static function define( - array $config = null, - array $behavior = null, - array $scenarios = null, + ?array $config = null, + ?array $behavior = null, + ?array $scenarios = null, ): self { return new self( config: $config ?? null, @@ -203,7 +203,7 @@ protected function createScenarioStateDefinitions(): void * * @return ?State The initial state of the machine. */ - public function getInitialState(EventBehavior|array $event = null): ?State + public function getInitialState(EventBehavior|array|null $event = null): ?State { if (is_null($this->initialStateDefinition)) { return null; @@ -275,7 +275,7 @@ public function getInitialState(EventBehavior|array $event = null): ?State * * @return State|null The scenario state if scenario is enabled and found, otherwise returns the current state. */ - public function getScenarioStateIfAvailable(State $state, EventBehavior|array $eventBehavior = null): ?State + public function getScenarioStateIfAvailable(State $state, EventBehavior|array|null $eventBehavior = null): ?State { if ($this->scenariosEnabled === false) { return $state; @@ -310,8 +310,8 @@ public function getScenarioStateIfAvailable(State $state, EventBehavior|array $e */ protected function buildCurrentState( ContextManager $context, - StateDefinition $currentStateDefinition = null, - EventBehavior $eventBehavior = null, + ?StateDefinition $currentStateDefinition = null, + ?EventBehavior $eventBehavior = null, ): State { return new State( context: $context, @@ -348,7 +348,7 @@ protected function getCurrentStateDefinition(string|State|null $state): mixed * * @return ContextManager The initialized context manager */ - public function initializeContextFromState(State $state = null): ContextManager + public function initializeContextFromState(?State $state = null): ContextManager { // If a state is provided, use it's context if (!is_null($state)) { @@ -513,7 +513,7 @@ public function checkFinalStatesForTransitions(): void protected function findTransitionDefinition( StateDefinition $currentStateDefinition, EventBehavior $eventBehavior, - string $firstStateDefinitionId = null, + ?string $firstStateDefinitionId = null, ): ?TransitionDefinition { $transitionDefinition = $currentStateDefinition->transitionDefinitions[$eventBehavior->type] ?? null; @@ -552,7 +552,7 @@ protected function findTransitionDefinition( */ public function transition( EventBehavior|array $event, - State $state = null + ?State $state = null ): State { if ($state !== null) { $state = $this->getScenarioStateIfAvailable(state: $state, eventBehavior: $event); @@ -688,7 +688,7 @@ public function transition( public function runAction( string $actionDefinition, State $state, - EventBehavior $eventBehavior = null + ?EventBehavior $eventBehavior = null ): void { [$actionDefinition, $actionArguments] = array_pad(explode(':', $actionDefinition, 2), 2, null); $actionArguments = $actionArguments === null ? [] : explode(',', $actionArguments); diff --git a/src/Definition/StateDefinition.php b/src/Definition/StateDefinition.php index ebbee988..2cf56c0e 100644 --- a/src/Definition/StateDefinition.php +++ b/src/Definition/StateDefinition.php @@ -104,7 +104,7 @@ class StateDefinition */ public function __construct( public ?array $config, - array $options = null, + ?array $options = null, ) { $this->initializeOptions($options); @@ -457,7 +457,7 @@ public function runExitActions(State $state): void * * @param \Tarfinlabs\EventMachine\Behavior\EventBehavior|null $eventBehavior The event to be processed. */ - public function runEntryActions(State $state, EventBehavior $eventBehavior = null): void + public function runEntryActions(State $state, ?EventBehavior $eventBehavior = null): void { // Record state entry start event $state->setInternalEventBehavior( diff --git a/src/Definition/TransitionBranch.php b/src/Definition/TransitionBranch.php index 4710e0c5..835197b7 100644 --- a/src/Definition/TransitionBranch.php +++ b/src/Definition/TransitionBranch.php @@ -169,7 +169,7 @@ protected function initializeInlineBehaviors(array $inlineBehaviors, BehaviorTyp */ public function runActions( State $state, - EventBehavior $eventBehavior = null + ?EventBehavior $eventBehavior = null ): void { if ($this->actions === null) { return; diff --git a/src/Enums/InternalEvent.php b/src/Enums/InternalEvent.php index f1a23244..ac29a9b4 100644 --- a/src/Enums/InternalEvent.php +++ b/src/Enums/InternalEvent.php @@ -29,8 +29,8 @@ enum InternalEvent: string case ACTION_START = '{machine}.action.{placeholder}.start'; case ACTION_FINISH = '{machine}.action.{placeholder}.finish'; - case GUARD_PASS = '{machine}.guard.{placeholder}.pass'; - case GUARD_FAIL = '{machine}.guard.{placeholder}.fail'; + case GUARD_PASS = '{machine}.guard.{placeholder}.pass'; + case GUARD_FAIL = '{machine}.guard.{placeholder}.fail'; case EVENT_RAISED = '{machine}.event.{placeholder}.raised'; @@ -42,7 +42,7 @@ enum InternalEvent: string * * @return string The generated internal event name. */ - public function generateInternalEventName(string $machineId, string $placeholder = null): string + public function generateInternalEventName(string $machineId, ?string $placeholder = null): string { if ($placeholder !== null && class_exists($placeholder)) { $placeholder = Str::of($placeholder)->classBasename()->toString(); diff --git a/tests/ActionTest.php b/tests/ActionTest.php index e642de62..be137d49 100644 --- a/tests/ActionTest.php +++ b/tests/ActionTest.php @@ -95,7 +95,7 @@ public function __invoke( ContextManager $context, EventBehavior $eventBehavior, - array $arguments = null + ?array $arguments = null ): int { return $eventBehavior->payload['value'] * $eventBehavior->payload['value']; } diff --git a/tests/InvokableBehaviorArgumentsTest.php b/tests/InvokableBehaviorArgumentsTest.php index 4e46df4d..963dfad9 100644 --- a/tests/InvokableBehaviorArgumentsTest.php +++ b/tests/InvokableBehaviorArgumentsTest.php @@ -25,7 +25,7 @@ ], behavior: [ 'actions' => [ - 'additionAction' => function (ContextManager $context, EventDefinition $eventDefinition, array $arguments = null): void { + 'additionAction' => function (ContextManager $context, EventDefinition $eventDefinition, ?array $arguments = null): void { $context->count += array_sum($arguments); }, ], @@ -57,12 +57,12 @@ ], behavior: [ 'actions' => [ - 'additionAction' => function (ContextManager $context, EventDefinition $eventDefinition, array $arguments = null): void { + 'additionAction' => function (ContextManager $context, EventDefinition $eventDefinition, ?array $arguments = null): void { $context->count += array_sum($arguments); }, ], 'guards' => [ - 'biggerThan' => function (ContextManager $context, EventDefinition $eventDefinition, array $arguments = null): bool { + 'biggerThan' => function (ContextManager $context, EventDefinition $eventDefinition, ?array $arguments = null): bool { return $context->count > $arguments[0]; }, ], diff --git a/tests/Stubs/Actions/IsOddAction.php b/tests/Stubs/Actions/IsOddAction.php index 1c9041a9..c02bc801 100644 --- a/tests/Stubs/Actions/IsOddAction.php +++ b/tests/Stubs/Actions/IsOddAction.php @@ -14,7 +14,7 @@ class IsOddAction extends ActionBehavior 'counts.oddCount' => 'integer', ]; - public function __invoke(ContextManager $context, EventBehavior $eventBehavior, array $arguments = null): void + public function __invoke(ContextManager $context, EventBehavior $eventBehavior, ?array $arguments = null): void { $context->set('counts.oddCount', 1); } diff --git a/tests/Stubs/Guards/IsOddGuard.php b/tests/Stubs/Guards/IsOddGuard.php index 1f049792..ab657058 100644 --- a/tests/Stubs/Guards/IsOddGuard.php +++ b/tests/Stubs/Guards/IsOddGuard.php @@ -18,7 +18,7 @@ class IsOddGuard extends GuardBehavior public function __invoke( TrafficLightsContext|ContextManager $context, EventBehavior $eventBehavior, - array $arguments = null + ?array $arguments = null ): bool { return $context->count % 2 === 1; } diff --git a/tests/Stubs/Guards/IsTimerValidValidationGuard.php b/tests/Stubs/Guards/IsTimerValidValidationGuard.php index f6195c6c..f392cc10 100644 --- a/tests/Stubs/Guards/IsTimerValidValidationGuard.php +++ b/tests/Stubs/Guards/IsTimerValidValidationGuard.php @@ -13,7 +13,7 @@ class IsTimerValidValidationGuard extends ValidationGuardBehavior public function __invoke( ContextManager $context, EventBehavior $eventBehavior, - array $arguments = null + ?array $arguments = null ): bool { $value = $eventBehavior->payload['value']; $result = $value > (int) $arguments[0]; diff --git a/tests/Stubs/Guards/IsValidatedOddGuard.php b/tests/Stubs/Guards/IsValidatedOddGuard.php index 69df16bc..837a49d6 100644 --- a/tests/Stubs/Guards/IsValidatedOddGuard.php +++ b/tests/Stubs/Guards/IsValidatedOddGuard.php @@ -19,7 +19,7 @@ class IsValidatedOddGuard extends ValidationGuardBehavior public function __invoke( TrafficLightsContext|ContextManager $context, EventBehavior $eventBehavior, - array $arguments = null + ?array $arguments = null ): bool { return $context->count % 2 === 1; } diff --git a/tests/Stubs/Machines/Asd/Actions/AAction.php b/tests/Stubs/Machines/Asd/Actions/AAction.php index 1515e782..ae8f56dd 100644 --- a/tests/Stubs/Machines/Asd/Actions/AAction.php +++ b/tests/Stubs/Machines/Asd/Actions/AAction.php @@ -11,7 +11,7 @@ class AAction extends ActionBehavior { - public function __invoke(ContextManager $context, EventBehavior $eventBehavior, array $arguments = null): void + public function __invoke(ContextManager $context, EventBehavior $eventBehavior, ?array $arguments = null): void { ModelA::create([ 'value' => 'lorem ipsum dolor', diff --git a/tests/Stubs/Machines/Asd/Actions/DAction.php b/tests/Stubs/Machines/Asd/Actions/DAction.php index 9b12bd39..c85e94d1 100644 --- a/tests/Stubs/Machines/Asd/Actions/DAction.php +++ b/tests/Stubs/Machines/Asd/Actions/DAction.php @@ -13,7 +13,7 @@ class DAction extends ActionBehavior /** * @throws \Exception */ - public function __invoke(ContextManager $context, EventBehavior $eventBehavior, array $arguments = null): void + public function __invoke(ContextManager $context, EventBehavior $eventBehavior, ?array $arguments = null): void { throw new \Exception('error'); } diff --git a/tests/Stubs/Machines/Asd/Actions/SAction.php b/tests/Stubs/Machines/Asd/Actions/SAction.php index 79421dc7..434c9cbc 100644 --- a/tests/Stubs/Machines/Asd/Actions/SAction.php +++ b/tests/Stubs/Machines/Asd/Actions/SAction.php @@ -14,7 +14,7 @@ class SAction extends ActionBehavior /** * @throws \Exception */ - public function __invoke(ContextManager $context, EventBehavior $eventBehavior, array $arguments = null): void + public function __invoke(ContextManager $context, EventBehavior $eventBehavior, ?array $arguments = null): void { ModelA::first()->update([ 'value' => 'new value', diff --git a/tests/Stubs/Machines/Asd/Actions/SleepAction.php b/tests/Stubs/Machines/Asd/Actions/SleepAction.php index 0cfaf38e..8ac96b31 100644 --- a/tests/Stubs/Machines/Asd/Actions/SleepAction.php +++ b/tests/Stubs/Machines/Asd/Actions/SleepAction.php @@ -13,7 +13,7 @@ class SleepAction extends ActionBehavior /** * @throws \Exception */ - public function __invoke(ContextManager $context, EventBehavior $eventBehavior, array $arguments = null): void + public function __invoke(ContextManager $context, EventBehavior $eventBehavior, ?array $arguments = null): void { sleep(1); } diff --git a/tests/Stubs/Machines/Qwerty/Actions/TAction.php b/tests/Stubs/Machines/Qwerty/Actions/TAction.php index 48456d97..9bc93f21 100644 --- a/tests/Stubs/Machines/Qwerty/Actions/TAction.php +++ b/tests/Stubs/Machines/Qwerty/Actions/TAction.php @@ -11,7 +11,7 @@ class TAction extends ActionBehavior { - public function __invoke(ContextManager $context, EventBehavior $eventBehavior, array $arguments = null): void + public function __invoke(ContextManager $context, EventBehavior $eventBehavior, ?array $arguments = null): void { $this->raise(new TEvent(actor: $eventBehavior->actor($context))); } diff --git a/tests/Stubs/Machines/TrafficLights/Actions/AddAnotherValueAction.php b/tests/Stubs/Machines/TrafficLights/Actions/AddAnotherValueAction.php index 0b39508d..3e90db64 100644 --- a/tests/Stubs/Machines/TrafficLights/Actions/AddAnotherValueAction.php +++ b/tests/Stubs/Machines/TrafficLights/Actions/AddAnotherValueAction.php @@ -12,7 +12,7 @@ class AddAnotherValueAction extends ActionBehavior { - public function __invoke(ContextManager|TrafficLightsContext $context, EventBehavior|AddAnotherValueEvent $eventBehavior, array $arguments = null): void + public function __invoke(ContextManager|TrafficLightsContext $context, EventBehavior|AddAnotherValueEvent $eventBehavior, ?array $arguments = null): void { $context->count += $eventBehavior->value; } diff --git a/tests/Stubs/Machines/TrafficLights/Actions/AddValueAction.php b/tests/Stubs/Machines/TrafficLights/Actions/AddValueAction.php index 386c27ad..58adbb0c 100644 --- a/tests/Stubs/Machines/TrafficLights/Actions/AddValueAction.php +++ b/tests/Stubs/Machines/TrafficLights/Actions/AddValueAction.php @@ -11,7 +11,7 @@ class AddValueAction extends ActionBehavior { - public function __invoke(ContextManager|TrafficLightsContext $context, EventBehavior $eventBehavior, array $arguments = null): void + public function __invoke(ContextManager|TrafficLightsContext $context, EventBehavior $eventBehavior, ?array $arguments = null): void { /* @var \Tarfinlabs\EventMachine\Tests\Stubs\Machines\TrafficLights\TrafficLightsContext $context */ $context->count += $eventBehavior->payload['value']; diff --git a/tests/Stubs/Machines/TrafficLights/Actions/DecrementAction.php b/tests/Stubs/Machines/TrafficLights/Actions/DecrementAction.php index 6ee64072..a7cd9fb5 100644 --- a/tests/Stubs/Machines/TrafficLights/Actions/DecrementAction.php +++ b/tests/Stubs/Machines/TrafficLights/Actions/DecrementAction.php @@ -14,7 +14,7 @@ class DecrementAction extends ActionBehavior public function __invoke( ContextManager|TrafficLightsContext $context, EventBehavior $eventBehavior, - array $arguments = null + ?array $arguments = null ): void { /* @var \Tarfinlabs\EventMachine\Tests\Stubs\Machines\TrafficLights\TrafficLightsContext $context */ $context->count--; diff --git a/tests/Stubs/Machines/TrafficLights/Actions/DoNothingInsideClassAction.php b/tests/Stubs/Machines/TrafficLights/Actions/DoNothingInsideClassAction.php index c2066d58..f0f0a1d8 100644 --- a/tests/Stubs/Machines/TrafficLights/Actions/DoNothingInsideClassAction.php +++ b/tests/Stubs/Machines/TrafficLights/Actions/DoNothingInsideClassAction.php @@ -10,7 +10,7 @@ class DoNothingInsideClassAction extends ActionBehavior { - public function __invoke(ContextManager $context, EventBehavior $eventBehavior, array $arguments = null): void + public function __invoke(ContextManager $context, EventBehavior $eventBehavior, ?array $arguments = null): void { // Do nothing. } diff --git a/tests/Stubs/Machines/TrafficLights/Actions/IncrementAction.php b/tests/Stubs/Machines/TrafficLights/Actions/IncrementAction.php index 6f69df32..4b245bb8 100644 --- a/tests/Stubs/Machines/TrafficLights/Actions/IncrementAction.php +++ b/tests/Stubs/Machines/TrafficLights/Actions/IncrementAction.php @@ -11,7 +11,7 @@ class IncrementAction extends ActionBehavior { - public function __invoke(ContextManager|TrafficLightsContext $context, EventBehavior $eventBehavior, array $arguments = null): void + public function __invoke(ContextManager|TrafficLightsContext $context, EventBehavior $eventBehavior, ?array $arguments = null): void { /* @var \Tarfinlabs\EventMachine\Tests\Stubs\Machines\TrafficLights\TrafficLightsContext $context */ $context->count++; diff --git a/tests/Stubs/Machines/TrafficLights/Actions/MultiplyByTwoAction.php b/tests/Stubs/Machines/TrafficLights/Actions/MultiplyByTwoAction.php index 1367e676..4c57768a 100644 --- a/tests/Stubs/Machines/TrafficLights/Actions/MultiplyByTwoAction.php +++ b/tests/Stubs/Machines/TrafficLights/Actions/MultiplyByTwoAction.php @@ -13,7 +13,7 @@ class MultiplyByTwoAction extends ActionBehavior { public bool $shouldLog = true; - public function __invoke(ContextManager|TrafficLightsContext $context, EventBehavior $eventBehavior, array $arguments = null): void + public function __invoke(ContextManager|TrafficLightsContext $context, EventBehavior $eventBehavior, ?array $arguments = null): void { /* @var \Tarfinlabs\EventMachine\Tests\Stubs\Machines\TrafficLights\TrafficLightsContext $context */ $context->count *= 2; diff --git a/tests/Stubs/Machines/TrafficLights/Actions/SubtractValueAction.php b/tests/Stubs/Machines/TrafficLights/Actions/SubtractValueAction.php index 8139c9ee..1d6bf979 100644 --- a/tests/Stubs/Machines/TrafficLights/Actions/SubtractValueAction.php +++ b/tests/Stubs/Machines/TrafficLights/Actions/SubtractValueAction.php @@ -11,7 +11,7 @@ class SubtractValueAction extends ActionBehavior { - public function __invoke(ContextManager|TrafficLightsContext $context, EventBehavior $eventBehavior, array $arguments = null): void + public function __invoke(ContextManager|TrafficLightsContext $context, EventBehavior $eventBehavior, ?array $arguments = null): void { /* @var \Tarfinlabs\EventMachine\Tests\Stubs\Machines\TrafficLights\TrafficLightsContext $context */ $context->count -= $eventBehavior->payload['value']; diff --git a/tests/Stubs/Machines/TrafficLights/Guards/IsEvenGuard.php b/tests/Stubs/Machines/TrafficLights/Guards/IsEvenGuard.php index aa2acc0b..bb20cb77 100644 --- a/tests/Stubs/Machines/TrafficLights/Guards/IsEvenGuard.php +++ b/tests/Stubs/Machines/TrafficLights/Guards/IsEvenGuard.php @@ -17,7 +17,7 @@ class IsEvenGuard extends ValidationGuardBehavior public function __invoke( ContextManager|TrafficLightsContext $context, EventBehavior $eventBehavior, - array $arguments = null + ?array $arguments = null ): bool { return $context->count % 2 === 0; } diff --git a/tests/Stubs/Machines/Xyz/Actions/XAction.php b/tests/Stubs/Machines/Xyz/Actions/XAction.php index 09e53e3b..ee360375 100644 --- a/tests/Stubs/Machines/Xyz/Actions/XAction.php +++ b/tests/Stubs/Machines/Xyz/Actions/XAction.php @@ -13,7 +13,7 @@ class XAction extends ActionBehavior public function __invoke( ContextManager $context, EventBehavior $eventBehavior, - array $arguments = null + ?array $arguments = null ): void { $context->value .= 'x'; diff --git a/tests/Stubs/Machines/Xyz/Actions/YAction.php b/tests/Stubs/Machines/Xyz/Actions/YAction.php index 3b172bd4..6887f847 100644 --- a/tests/Stubs/Machines/Xyz/Actions/YAction.php +++ b/tests/Stubs/Machines/Xyz/Actions/YAction.php @@ -14,7 +14,7 @@ class YAction extends ActionBehavior public function __invoke( ContextManager $context, EventBehavior $eventBehavior, - array $arguments = null + ?array $arguments = null ): void { $context->value .= 'y'; diff --git a/tests/Stubs/Machines/Xyz/Actions/ZAction.php b/tests/Stubs/Machines/Xyz/Actions/ZAction.php index 698f0e21..09cb7d72 100644 --- a/tests/Stubs/Machines/Xyz/Actions/ZAction.php +++ b/tests/Stubs/Machines/Xyz/Actions/ZAction.php @@ -13,7 +13,7 @@ class ZAction extends ActionBehavior public function __invoke( ContextManager $context, EventBehavior $eventBehavior, - array $arguments = null + ?array $arguments = null ): void { $context->value .= 'z'; diff --git a/tests/Stubs/Results/GreenResult.php b/tests/Stubs/Results/GreenResult.php index 40d67ceb..c2b72624 100644 --- a/tests/Stubs/Results/GreenResult.php +++ b/tests/Stubs/Results/GreenResult.php @@ -14,7 +14,7 @@ class GreenResult extends ResultBehavior public function __invoke( ContextManager $context, EventBehavior $eventBehavior, - array $arguments = null + ?array $arguments = null ): Carbon { return now(); }