@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | { |
40 | 40 | $handler = $this->createHandler(); |
41 | 41 | // Call Context |
42 | - $ctx = new CallContext(Target::fromReflection(new class extends \ReflectionFunctionAbstract { |
|
42 | + $ctx = new CallContext(Target::fromReflection(new class extends \ReflectionFunctionAbstract{ |
|
43 | 43 | /** @psalm-immutable */ |
44 | 44 | public function getName(): string |
45 | 45 | { |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | public function createHandler(array $definitions = [], bool $resolveFromPath = true): ReflectionHandler |
124 | 124 | { |
125 | 125 | $container = new Container(); |
126 | - foreach ($definitions as $id => $definition) { |
|
126 | + foreach ($definitions as $id => $definition){ |
|
127 | 127 | $container->bind($id, $definition); |
128 | 128 | } |
129 | 129 |
@@ -123,7 +123,8 @@ |
||
123 | 123 | public function createHandler(array $definitions = [], bool $resolveFromPath = true): ReflectionHandler |
124 | 124 | { |
125 | 125 | $container = new Container(); |
126 | - foreach ($definitions as $id => $definition) { |
|
126 | + foreach ($definitions as $id => $definition) |
|
127 | + { |
|
127 | 128 | $container->bind($id, $definition); |
128 | 129 | } |
129 | 130 |
@@ -14,13 +14,13 @@ |
||
14 | 14 | |
15 | 15 | public function __construct( |
16 | 16 | private readonly int $counter, |
17 | - ) { |
|
17 | + ){ |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | public function intercept(CallContextInterface $context, HandlerInterface $handler): mixed |
21 | 21 | { |
22 | 22 | $this->result = []; |
23 | - for ($i = 0; $i < $this->counter; ++$i) { |
|
23 | + for ($i = 0; $i < $this->counter; ++$i){ |
|
24 | 24 | $this->result[] = $handler->handle($context); |
25 | 25 | } |
26 | 26 |
@@ -20,7 +20,8 @@ |
||
20 | 20 | public function intercept(CallContextInterface $context, HandlerInterface $handler): mixed |
21 | 21 | { |
22 | 22 | $this->result = []; |
23 | - for ($i = 0; $i < $this->counter; ++$i) { |
|
23 | + for ($i = 0; $i < $this->counter; ++$i) |
|
24 | + { |
|
24 | 25 | $this->result[] = $handler->handle($context); |
25 | 26 | } |
26 | 27 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | /** @internal */ |
23 | 23 | protected ContainerInterface $container, |
24 | 24 | protected bool $resolveFromPath = true, |
25 | - ) { |
|
25 | + ){ |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -34,14 +34,14 @@ discard block |
||
34 | 34 | { |
35 | 35 | // Resolve controller method |
36 | 36 | $method = $context->getTarget()->getReflection(); |
37 | - if ($method === null) { |
|
37 | + if ($method === null){ |
|
38 | 38 | $this->resolveFromPath or throw new TargetCallException( |
39 | 39 | "Reflection not provided for target `{$context->getTarget()}`.", |
40 | 40 | TargetCallException::NOT_FOUND, |
41 | 41 | ); |
42 | 42 | |
43 | 43 | $path = $context->getTarget()->getPath(); |
44 | - if (\count($path) !== 2) { |
|
44 | + if (\count($path) !== 2){ |
|
45 | 45 | throw new TargetCallException( |
46 | 46 | "Invalid target path to resolve reflection for `{$context->getTarget()}`." |
47 | 47 | . ' Expected two parts: class and method.', |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | $method = ActionResolver::pathToReflection(\reset($path), \end($path)); |
53 | 53 | } |
54 | 54 | |
55 | - if ($method instanceof \ReflectionFunction) { |
|
55 | + if ($method instanceof \ReflectionFunction){ |
|
56 | 56 | return $method->invokeArgs( |
57 | 57 | $this->resolveArguments($method, $context) |
58 | 58 | ); |
59 | 59 | } |
60 | 60 | |
61 | - if (!$method instanceof \ReflectionMethod) { |
|
61 | + if (!$method instanceof \ReflectionMethod){ |
|
62 | 62 | throw new TargetCallException("Action not found for target `{$context->getTarget()}`."); |
63 | 63 | } |
64 | 64 |
@@ -34,14 +34,16 @@ discard block |
||
34 | 34 | { |
35 | 35 | // Resolve controller method |
36 | 36 | $method = $context->getTarget()->getReflection(); |
37 | - if ($method === null) { |
|
37 | + if ($method === null) |
|
38 | + { |
|
38 | 39 | $this->resolveFromPath or throw new TargetCallException( |
39 | 40 | "Reflection not provided for target `{$context->getTarget()}`.", |
40 | 41 | TargetCallException::NOT_FOUND, |
41 | 42 | ); |
42 | 43 | |
43 | 44 | $path = $context->getTarget()->getPath(); |
44 | - if (\count($path) !== 2) { |
|
45 | + if (\count($path) !== 2) |
|
46 | + { |
|
45 | 47 | throw new TargetCallException( |
46 | 48 | "Invalid target path to resolve reflection for `{$context->getTarget()}`." |
47 | 49 | . ' Expected two parts: class and method.', |
@@ -52,13 +54,15 @@ discard block |
||
52 | 54 | $method = ActionResolver::pathToReflection(\reset($path), \end($path)); |
53 | 55 | } |
54 | 56 | |
55 | - if ($method instanceof \ReflectionFunction) { |
|
57 | + if ($method instanceof \ReflectionFunction) |
|
58 | + { |
|
56 | 59 | return $method->invokeArgs( |
57 | 60 | $this->resolveArguments($method, $context) |
58 | 61 | ); |
59 | 62 | } |
60 | 63 | |
61 | - if (!$method instanceof \ReflectionMethod) { |
|
64 | + if (!$method instanceof \ReflectionMethod) |
|
65 | + { |
|
62 | 66 | throw new TargetCallException("Action not found for target `{$context->getTarget()}`."); |
63 | 67 | } |
64 | 68 |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public static function pathToReflection(string $controller, string $action): \ReflectionMethod |
21 | 21 | { |
22 | - try { |
|
22 | + try{ |
|
23 | 23 | /** @psalm-suppress ArgumentTypeCoercion */ |
24 | 24 | $method = new \ReflectionMethod($controller, $action); |
25 | - } catch (\ReflectionException $e) { |
|
25 | + }catch (\ReflectionException $e){ |
|
26 | 26 | throw new TargetCallException( |
27 | 27 | \sprintf('Invalid action `%s`->`%s`', $controller, $action), |
28 | 28 | TargetCallException::BAD_ACTION, |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public static function validateControllerMethod(\ReflectionMethod $method, mixed $controller = null): void |
41 | 41 | { |
42 | - if ($method->isStatic() || !$method->isPublic()) { |
|
42 | + if ($method->isStatic() || !$method->isPublic()){ |
|
43 | 43 | throw new TargetCallException( |
44 | 44 | \sprintf( |
45 | 45 | 'Invalid action `%s`->`%s`', |
@@ -50,11 +50,11 @@ discard block |
||
50 | 50 | ); |
51 | 51 | } |
52 | 52 | |
53 | - if ($controller === null) { |
|
53 | + if ($controller === null){ |
|
54 | 54 | return; |
55 | 55 | } |
56 | 56 | |
57 | - if (!\is_object($controller) || !$method->getDeclaringClass()->isInstance($controller)) { |
|
57 | + if (!\is_object($controller) || !$method->getDeclaringClass()->isInstance($controller)){ |
|
58 | 58 | throw new TargetCallException( |
59 | 59 | \sprintf( |
60 | 60 | 'Invalid controller. Expected instance of `%s`, got `%s`.', |
@@ -19,10 +19,13 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public static function pathToReflection(string $controller, string $action): \ReflectionMethod |
21 | 21 | { |
22 | - try { |
|
22 | + try |
|
23 | + { |
|
23 | 24 | /** @psalm-suppress ArgumentTypeCoercion */ |
24 | 25 | $method = new \ReflectionMethod($controller, $action); |
25 | - } catch (\ReflectionException $e) { |
|
26 | + } |
|
27 | + catch (\ReflectionException $e) |
|
28 | + { |
|
26 | 29 | throw new TargetCallException( |
27 | 30 | \sprintf('Invalid action `%s`->`%s`', $controller, $action), |
28 | 31 | TargetCallException::BAD_ACTION, |
@@ -39,7 +42,8 @@ discard block |
||
39 | 42 | */ |
40 | 43 | public static function validateControllerMethod(\ReflectionMethod $method, mixed $controller = null): void |
41 | 44 | { |
42 | - if ($method->isStatic() || !$method->isPublic()) { |
|
45 | + if ($method->isStatic() || !$method->isPublic()) |
|
46 | + { |
|
43 | 47 | throw new TargetCallException( |
44 | 48 | \sprintf( |
45 | 49 | 'Invalid action `%s`->`%s`', |
@@ -50,11 +54,13 @@ discard block |
||
50 | 54 | ); |
51 | 55 | } |
52 | 56 | |
53 | - if ($controller === null) { |
|
57 | + if ($controller === null) |
|
58 | + { |
|
54 | 59 | return; |
55 | 60 | } |
56 | 61 | |
57 | - if (!\is_object($controller) || !$method->getDeclaringClass()->isInstance($controller)) { |
|
62 | + if (!\is_object($controller) || !$method->getDeclaringClass()->isInstance($controller)) |
|
63 | + { |
|
58 | 64 | throw new TargetCallException( |
59 | 65 | \sprintf( |
60 | 66 | 'Invalid controller. Expected instance of `%s`, got `%s`.', |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | public function __construct( |
29 | 29 | /** @internal */ |
30 | 30 | protected ContainerInterface $container |
31 | - ) { |
|
31 | + ){ |
|
32 | 32 | // resolver is usually the container itself |
33 | 33 | /** @psalm-suppress MixedAssignment */ |
34 | 34 | $this->resolver = $container->get(ResolverInterface::class); |
@@ -59,13 +59,13 @@ discard block |
||
59 | 59 | |
60 | 60 | protected function resolveArguments(\ReflectionMethod $method, array $parameters): array |
61 | 61 | { |
62 | - foreach ($method->getParameters() as $parameter) { |
|
62 | + foreach ($method->getParameters() as $parameter){ |
|
63 | 63 | $name = $parameter->getName(); |
64 | 64 | if ( |
65 | 65 | \array_key_exists($name, $parameters) && |
66 | 66 | $parameters[$name] === null && |
67 | 67 | $parameter->isDefaultValueAvailable() |
68 | - ) { |
|
68 | + ){ |
|
69 | 69 | /** @psalm-suppress MixedAssignment */ |
70 | 70 | $parameters[$name] = $parameter->getDefaultValue(); |
71 | 71 | } |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function invoke(\ReflectionMethod $method, array $arguments): mixed |
82 | 82 | { |
83 | - try { |
|
83 | + try{ |
|
84 | 84 | $args = $this->resolveArguments($method, $arguments); |
85 | - } catch (ArgumentResolvingException | InvalidArgumentException $e) { |
|
85 | + }catch (ArgumentResolvingException | InvalidArgumentException $e){ |
|
86 | 86 | throw new ControllerException( |
87 | 87 | \sprintf( |
88 | 88 | 'Missing/invalid parameter %s of `%s`->`%s`', |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | ControllerException::BAD_ARGUMENT, |
94 | 94 | $e, |
95 | 95 | ); |
96 | - } catch (ContainerExceptionInterface $e) { |
|
96 | + }catch (ContainerExceptionInterface $e){ |
|
97 | 97 | throw new ControllerException( |
98 | 98 | $e->getMessage(), |
99 | 99 | ControllerException::ERROR, |
@@ -59,7 +59,8 @@ discard block |
||
59 | 59 | |
60 | 60 | protected function resolveArguments(\ReflectionMethod $method, array $parameters): array |
61 | 61 | { |
62 | - foreach ($method->getParameters() as $parameter) { |
|
62 | + foreach ($method->getParameters() as $parameter) |
|
63 | + { |
|
63 | 64 | $name = $parameter->getName(); |
64 | 65 | if ( |
65 | 66 | \array_key_exists($name, $parameters) && |
@@ -80,9 +81,12 @@ discard block |
||
80 | 81 | */ |
81 | 82 | public function invoke(\ReflectionMethod $method, array $arguments): mixed |
82 | 83 | { |
83 | - try { |
|
84 | + try |
|
85 | + { |
|
84 | 86 | $args = $this->resolveArguments($method, $arguments); |
85 | - } catch (ArgumentResolvingException | InvalidArgumentException $e) { |
|
87 | + } |
|
88 | + catch (ArgumentResolvingException | InvalidArgumentException $e) |
|
89 | + { |
|
86 | 90 | throw new ControllerException( |
87 | 91 | \sprintf( |
88 | 92 | 'Missing/invalid parameter %s of `%s`->`%s`', |
@@ -93,7 +97,9 @@ discard block |
||
93 | 97 | ControllerException::BAD_ARGUMENT, |
94 | 98 | $e, |
95 | 99 | ); |
96 | - } catch (ContainerExceptionInterface $e) { |
|
100 | + } |
|
101 | + catch (ContainerExceptionInterface $e) |
|
102 | + { |
|
97 | 103 | throw new ControllerException( |
98 | 104 | $e->getMessage(), |
99 | 105 | ControllerException::ERROR, |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | protected function execute(InputInterface $input, OutputInterface $output): int |
81 | 81 | { |
82 | - if ($this->container === null) { |
|
82 | + if ($this->container === null){ |
|
83 | 83 | throw new ScopeException('Container is not set'); |
84 | 84 | } |
85 | 85 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | $core = $this->buildCore(); |
89 | 89 | |
90 | - try { |
|
90 | + try{ |
|
91 | 91 | [$this->input, $this->output] = [$this->prepareInput($input), $this->prepareOutput($input, $output)]; |
92 | 92 | |
93 | 93 | $this->eventDispatcher?->dispatch(new CommandStarting($this, $this->input, $this->output)); |
@@ -105,18 +105,18 @@ discard block |
||
105 | 105 | $this->eventDispatcher?->dispatch(new CommandFinished($this, $code, $this->input, $this->output)); |
106 | 106 | |
107 | 107 | return $code; |
108 | - } finally { |
|
108 | + }finally{ |
|
109 | 109 | [$this->input, $this->output] = [null, null]; |
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
113 | - protected function buildCore(): CoreInterface|HandlerInterface |
|
113 | + protected function buildCore(): CoreInterface | HandlerInterface |
|
114 | 114 | { |
115 | 115 | $core = $this->container->get(CommandCore::class); |
116 | 116 | |
117 | 117 | $interceptableCore = (new InterceptorPipeline($this->eventDispatcher))->withCore($core); |
118 | 118 | |
119 | - foreach ($this->interceptors as $interceptor) { |
|
119 | + foreach ($this->interceptors as $interceptor){ |
|
120 | 120 | $interceptableCore->addInterceptor($this->container->get($interceptor)); |
121 | 121 | } |
122 | 122 | $interceptableCore->addInterceptor($this->container->get(AttributeInterceptor::class)); |
@@ -79,7 +79,8 @@ discard block |
||
79 | 79 | */ |
80 | 80 | protected function execute(InputInterface $input, OutputInterface $output): int |
81 | 81 | { |
82 | - if ($this->container === null) { |
|
82 | + if ($this->container === null) |
|
83 | + { |
|
83 | 84 | throw new ScopeException('Container is not set'); |
84 | 85 | } |
85 | 86 | |
@@ -87,7 +88,8 @@ discard block |
||
87 | 88 | |
88 | 89 | $core = $this->buildCore(); |
89 | 90 | |
90 | - try { |
|
91 | + try |
|
92 | + { |
|
91 | 93 | [$this->input, $this->output] = [$this->prepareInput($input), $this->prepareOutput($input, $output)]; |
92 | 94 | |
93 | 95 | $this->eventDispatcher?->dispatch(new CommandStarting($this, $this->input, $this->output)); |
@@ -105,7 +107,9 @@ discard block |
||
105 | 107 | $this->eventDispatcher?->dispatch(new CommandFinished($this, $code, $this->input, $this->output)); |
106 | 108 | |
107 | 109 | return $code; |
108 | - } finally { |
|
110 | + } |
|
111 | + finally |
|
112 | + { |
|
109 | 113 | [$this->input, $this->output] = [null, null]; |
110 | 114 | } |
111 | 115 | } |
@@ -116,7 +120,8 @@ discard block |
||
116 | 120 | |
117 | 121 | $interceptableCore = (new InterceptorPipeline($this->eventDispatcher))->withCore($core); |
118 | 122 | |
119 | - foreach ($this->interceptors as $interceptor) { |
|
123 | + foreach ($this->interceptors as $interceptor) |
|
124 | + { |
|
120 | 125 | $interceptableCore->addInterceptor($this->container->get($interceptor)); |
121 | 126 | } |
122 | 127 | $interceptableCore->addInterceptor($this->container->get(AttributeInterceptor::class)); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | private readonly ContainerInterface $container, |
26 | 26 | private readonly FactoryInterface $factory, |
27 | 27 | private readonly ?EventDispatcherInterface $dispatcher = null |
28 | - ) { |
|
28 | + ){ |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | public function getConnection(?string $name = null): QueueInterface |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | // Replaces alias with real pipeline name |
35 | 35 | $name = $this->config->getAliases()[$name] ?? $name; |
36 | 36 | |
37 | - if (!isset($this->pipelines[$name])) { |
|
37 | + if (!isset($this->pipelines[$name])){ |
|
38 | 38 | $this->pipelines[$name] = $this->resolveConnection($name); |
39 | 39 | } |
40 | 40 | |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | { |
50 | 50 | $config = $this->config->getConnection($name); |
51 | 51 | |
52 | - try { |
|
52 | + try{ |
|
53 | 53 | $driver = $this->factory->make($config['driver'], $config); |
54 | 54 | $pipeline = (new InterceptorPipeline($this->dispatcher))->withHandler(new PushCore($driver)); |
55 | 55 | |
56 | - foreach ($this->config->getPushInterceptors() as $interceptor) { |
|
57 | - if (\is_string($interceptor) || $interceptor instanceof Autowire) { |
|
56 | + foreach ($this->config->getPushInterceptors() as $interceptor){ |
|
57 | + if (\is_string($interceptor) || $interceptor instanceof Autowire){ |
|
58 | 58 | $interceptor = $this->container->get($interceptor); |
59 | 59 | } |
60 | 60 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | return new Queue($pipeline); |
66 | - } catch (ContainerException $e) { |
|
66 | + }catch (ContainerException $e){ |
|
67 | 67 | throw new Exception\NotSupportedDriverException( |
68 | 68 | \sprintf( |
69 | 69 | 'Driver `%s` is not supported. Connection `%s` cannot be created. Reason: `%s`', |
@@ -34,7 +34,8 @@ discard block |
||
34 | 34 | // Replaces alias with real pipeline name |
35 | 35 | $name = $this->config->getAliases()[$name] ?? $name; |
36 | 36 | |
37 | - if (!isset($this->pipelines[$name])) { |
|
37 | + if (!isset($this->pipelines[$name])) |
|
38 | + { |
|
38 | 39 | $this->pipelines[$name] = $this->resolveConnection($name); |
39 | 40 | } |
40 | 41 | |
@@ -49,12 +50,15 @@ discard block |
||
49 | 50 | { |
50 | 51 | $config = $this->config->getConnection($name); |
51 | 52 | |
52 | - try { |
|
53 | + try |
|
54 | + { |
|
53 | 55 | $driver = $this->factory->make($config['driver'], $config); |
54 | 56 | $pipeline = (new InterceptorPipeline($this->dispatcher))->withHandler(new PushCore($driver)); |
55 | 57 | |
56 | - foreach ($this->config->getPushInterceptors() as $interceptor) { |
|
57 | - if (\is_string($interceptor) || $interceptor instanceof Autowire) { |
|
58 | + foreach ($this->config->getPushInterceptors() as $interceptor) |
|
59 | + { |
|
60 | + if (\is_string($interceptor) || $interceptor instanceof Autowire) |
|
61 | + { |
|
58 | 62 | $interceptor = $this->container->get($interceptor); |
59 | 63 | } |
60 | 64 | |
@@ -63,7 +67,9 @@ discard block |
||
63 | 67 | } |
64 | 68 | |
65 | 69 | return new Queue($pipeline); |
66 | - } catch (ContainerException $e) { |
|
70 | + } |
|
71 | + catch (ContainerException $e) |
|
72 | + { |
|
67 | 73 | throw new Exception\NotSupportedDriverException( |
68 | 74 | \sprintf( |
69 | 75 | 'Driver `%s` is not supported. Connection `%s` cannot be created. Reason: `%s`', |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | public function __construct( |
57 | 57 | private readonly ConfiguratorInterface $config, |
58 | - ) { |
|
58 | + ){ |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | public function init( |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | $registry = $container->get(QueueRegistry::class); |
74 | 74 | $config = $container->get(QueueConfig::class); |
75 | 75 | |
76 | - foreach ($config->getRegistryHandlers() as $jobType => $handler) { |
|
76 | + foreach ($config->getRegistryHandlers() as $jobType => $handler){ |
|
77 | 77 | $registry->setHandler($jobType, $handler); |
78 | 78 | } |
79 | 79 | |
80 | - foreach ($config->getRegistrySerializers() as $jobType => $serializer) { |
|
80 | + foreach ($config->getRegistrySerializers() as $jobType => $serializer){ |
|
81 | 81 | $registry->setSerializer($jobType, $serializer); |
82 | 82 | } |
83 | 83 | }); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | /** |
96 | 96 | * @param class-string<CoreInterceptorInterface>|CoreInterceptorInterface|Autowire $interceptor |
97 | 97 | */ |
98 | - public function addConsumeInterceptor(string|CoreInterceptorInterface|Autowire $interceptor): void |
|
98 | + public function addConsumeInterceptor(string | CoreInterceptorInterface | Autowire $interceptor): void |
|
99 | 99 | { |
100 | 100 | $this->config->modify( |
101 | 101 | QueueConfig::CONFIG, |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | /** |
107 | 107 | * @param class-string<CoreInterceptorInterface>|CoreInterceptorInterface|Autowire $interceptor |
108 | 108 | */ |
109 | - public function addPushInterceptor(string|CoreInterceptorInterface|Autowire $interceptor): void |
|
109 | + public function addPushInterceptor(string | CoreInterceptorInterface | Autowire $interceptor): void |
|
110 | 110 | { |
111 | 111 | $this->config->modify( |
112 | 112 | QueueConfig::CONFIG, |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | ContainerInterface $container, |
132 | 132 | FactoryInterface $factory, |
133 | 133 | ContainerRegistry $registry, |
134 | - ) { |
|
134 | + ){ |
|
135 | 135 | return new QueueRegistry($container, $factory, $registry); |
136 | 136 | } |
137 | 137 | |
@@ -145,10 +145,10 @@ discard block |
||
145 | 145 | ): Handler { |
146 | 146 | $pipeline = (new InterceptorPipeline($dispatcher))->withHandler($core); |
147 | 147 | |
148 | - foreach ($config->getConsumeInterceptors() as $interceptor) { |
|
149 | - if (\is_string($interceptor)) { |
|
148 | + foreach ($config->getConsumeInterceptors() as $interceptor){ |
|
149 | + if (\is_string($interceptor)){ |
|
150 | 150 | $interceptor = $container->get($interceptor); |
151 | - } elseif ($interceptor instanceof Autowire) { |
|
151 | + } elseif ($interceptor instanceof Autowire){ |
|
152 | 152 | $interceptor = $interceptor->resolve($factory); |
153 | 153 | } |
154 | 154 |
@@ -73,11 +73,13 @@ discard block |
||
73 | 73 | $registry = $container->get(QueueRegistry::class); |
74 | 74 | $config = $container->get(QueueConfig::class); |
75 | 75 | |
76 | - foreach ($config->getRegistryHandlers() as $jobType => $handler) { |
|
76 | + foreach ($config->getRegistryHandlers() as $jobType => $handler) |
|
77 | + { |
|
77 | 78 | $registry->setHandler($jobType, $handler); |
78 | 79 | } |
79 | 80 | |
80 | - foreach ($config->getRegistrySerializers() as $jobType => $serializer) { |
|
81 | + foreach ($config->getRegistrySerializers() as $jobType => $serializer) |
|
82 | + { |
|
81 | 83 | $registry->setSerializer($jobType, $serializer); |
82 | 84 | } |
83 | 85 | }); |
@@ -145,10 +147,14 @@ discard block |
||
145 | 147 | ): Handler { |
146 | 148 | $pipeline = (new InterceptorPipeline($dispatcher))->withHandler($core); |
147 | 149 | |
148 | - foreach ($config->getConsumeInterceptors() as $interceptor) { |
|
149 | - if (\is_string($interceptor)) { |
|
150 | + foreach ($config->getConsumeInterceptors() as $interceptor) |
|
151 | + { |
|
152 | + if (\is_string($interceptor)) |
|
153 | + { |
|
150 | 154 | $interceptor = $container->get($interceptor); |
151 | - } elseif ($interceptor instanceof Autowire) { |
|
155 | + } |
|
156 | + elseif ($interceptor instanceof Autowire) |
|
157 | + { |
|
152 | 158 | $interceptor = $interceptor->resolve($factory); |
153 | 159 | } |
154 | 160 |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | private readonly bool $isLegacy; |
24 | 24 | |
25 | 25 | public function __construct( |
26 | - private readonly CoreInterface|HandlerInterface $core, |
|
26 | + private readonly CoreInterface | HandlerInterface $core, |
|
27 | 27 | ?TracerFactoryInterface $tracerFactory = null, |
28 | - ) { |
|
28 | + ){ |
|
29 | 29 | $this->tracerFactory = $tracerFactory ?? new NullTracerFactory(new Container()); |
30 | 30 | $this->isLegacy = !$core instanceof HandlerInterface; |
31 | 31 | } |
@@ -51,16 +51,16 @@ discard block |
||
51 | 51 | return $tracer->trace( |
52 | 52 | name: \sprintf('Job handling [%s:%s]', $name, $id), |
53 | 53 | callback: $this->isLegacy |
54 | - ? fn (): mixed => $this->core->callAction($name, 'handle', $arguments) |
|
55 | - : fn (): mixed => $this->core->handle(new CallContext(Target::fromPair($name, 'handle'), $arguments)), |
|
56 | - attributes: [ |
|
54 | + ? fn () : mixed => $this->core->callAction($name, 'handle', $arguments) |
|
55 | + : fn () : mixed => $this->core->handle(new CallContext(Target::fromPair($name, 'handle'), $arguments)), |
|
56 | + attributes : [ |
|
57 | 57 | 'queue.driver' => $driver, |
58 | 58 | 'queue.name' => $queue, |
59 | 59 | 'queue.id' => $id, |
60 | 60 | 'queue.headers' => $headers, |
61 | 61 | ], |
62 | - scoped: true, |
|
63 | - traceKind: TraceKind::CONSUMER, |
|
62 | + scoped : true, |
|
63 | + traceKind : TraceKind::CONSUMER, |
|
64 | 64 | ); |
65 | 65 | } |
66 | 66 | } |