88 * @license https://opensource.org/licenses/MIT
99 */
1010
11- declare (strict_types = 0 );
11+ declare (strict_types= 0 );
1212
1313namespace ServiceBus \Sagas \Configuration \Attributes ;
1414
@@ -41,8 +41,7 @@ final class SagaAttributeBasedConfigurationLoader implements SagaConfigurationLo
4141 public function __construct (
4242 SagaMessageProcessorFactory $ eventListenerProcessorFactory ,
4343 ?Reader $ attributesReader = null
44- )
45- {
44+ ) {
4645 $ this ->eventListenerProcessorFactory = $ eventListenerProcessorFactory ;
4746 $ this ->attributesReader = $ attributesReader ?? new AttributesReader ();
4847 }
@@ -79,7 +78,7 @@ classLevelAttributes: $attributes->classLevelCollection
7978 )
8079 );
8180 }
82- catch (\Throwable $ throwable )
81+ catch (\Throwable $ throwable )
8382 {
8483 throw InvalidSagaConfiguration::fromThrowable ($ throwable );
8584 }
@@ -97,15 +96,14 @@ classLevelAttributes: $attributes->classLevelCollection
9796 private function collectSagaEventHandlers (
9897 \SplObjectStorage $ methodLevelAttributes ,
9998 SagaMetadata $ sagaMetadata
100- ): \SplObjectStorage
101- {
99+ ): \SplObjectStorage {
102100 /** @psalm-var \SplObjectStorage<MessageHandler, null> $handlersCollection */
103101 $ handlersCollection = new \SplObjectStorage ();
104102
105103 /** @var MethodLevel $methodLevelAttribute */
106- foreach ($ methodLevelAttributes as $ methodLevelAttribute )
104+ foreach ($ methodLevelAttributes as $ methodLevelAttribute )
107105 {
108- if ($ methodLevelAttribute ->attribute instanceof SagaEventListener)
106+ if ($ methodLevelAttribute ->attribute instanceof SagaEventListener)
109107 {
110108 $ handlersCollection ->attach (
111109 $ this ->createMessageHandler (
@@ -129,8 +127,7 @@ private function createMessageHandler(
129127 MethodLevel $ methodLevelAttribute ,
130128 SagaMetadata $ sagaMetadata ,
131129 SagaMessageHandlerType $ handlerType
132- ): MessageHandler
133- {
130+ ): MessageHandler {
134131 /** @var SagaEventListener|SagaInitialHandler $attribute */
135132 $ attribute = $ methodLevelAttribute ->attribute ;
136133
@@ -156,7 +153,7 @@ private function createMessageHandler(
156153 SagaMessageHandlerType::EVENT_LISTENER => createEventListenerName ($ messageClass )
157154 };
158155
159- if ($ expectedMethodName === $ reflectionMethod ->name )
156+ if ($ expectedMethodName === $ reflectionMethod ->name )
160157 {
161158 /** @var callable $processor */
162159 $ processor = match ($ handlerType )
@@ -201,7 +198,7 @@ private function extractMessageClass(\ReflectionMethod $reflectionMethod): strin
201198 ? $ reflectionParameters [0 ]->getType ()
202199 : null ;
203200
204- if ($ firstArgumentType !== null )
201+ if ($ firstArgumentType !== null )
205202 {
206203 /** @var \ReflectionNamedType $reflectionType */
207204 $ reflectionType = $ reflectionParameters [0 ]->getType ();
@@ -210,7 +207,7 @@ private function extractMessageClass(\ReflectionMethod $reflectionMethod): strin
210207 $ messageClass = $ reflectionType ->getName ();
211208
212209 /** @psalm-suppress RedundantConditionGivenDocblockType */
213- if (\class_exists ($ messageClass ))
210+ if (\class_exists ($ messageClass ))
214211 {
215212 return $ messageClass ;
216213 }
@@ -228,7 +225,7 @@ private function extractMessageClass(\ReflectionMethod $reflectionMethod): strin
228225 */
229226 private static function createSagaMetadata (string $ sagaClass , SagaHeader $ sagaHeader ): SagaMetadata
230227 {
231- if (\class_exists ($ sagaHeader ->idClass ) === false )
228+ if (\class_exists ($ sagaHeader ->idClass ) === false )
232229 {
233230 throw new \InvalidArgumentException (
234231 \sprintf (
@@ -258,20 +255,19 @@ private static function createSagaMetadata(string $sagaClass, SagaHeader $sagaHe
258255 private function findInitialCommandHandlerAttribute (
259256 string $ sagaClass ,
260257 \SplObjectStorage $ methodLevelAttributes
261- ): MethodLevel
262- {
258+ ): MethodLevel {
263259 /** @var MethodLevel[] $commandHandlersAttributes */
264260 $ commandHandlersAttributes = \array_filter (
265261 \array_map (
266- static function (MethodLevel $ attribute ): ?MethodLevel
262+ static function (MethodLevel $ attribute ): ?MethodLevel
267263 {
268264 return $ attribute ->attribute instanceof SagaInitialHandler ? $ attribute : null ;
269265 },
270266 \iterator_to_array ($ methodLevelAttributes )
271267 )
272268 );
273269
274- if (\count ($ commandHandlersAttributes ) === 1 )
270+ if (\count ($ commandHandlersAttributes ) === 1 )
275271 {
276272 return \end ($ commandHandlersAttributes );
277273 }
@@ -292,11 +288,11 @@ static function(MethodLevel $attribute): ?MethodLevel
292288 private static function searchSagaHeader (string $ sagaClass , \SplObjectStorage $ classLevelAttributes ): SagaHeader
293289 {
294290 /** @var ClassLevel $attributes */
295- foreach ($ classLevelAttributes as $ attributes )
291+ foreach ($ classLevelAttributes as $ attributes )
296292 {
297293 $ attributeObject = $ attributes ->attribute ;
298294
299- if ($ attributeObject instanceof SagaHeader)
295+ if ($ attributeObject instanceof SagaHeader)
300296 {
301297 return $ attributeObject ;
302298 }
0 commit comments