@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | public function __construct( |
| 29 | 29 | private readonly ?EventDispatcherInterface $dispatcher = null |
| 30 | - ) { |
|
| 30 | + ){ |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | public function withInterceptors(InterceptorInterface ...$interceptors): self |
| 37 | 37 | { |
| 38 | 38 | $clone = clone $this; |
| 39 | - foreach ($interceptors as $interceptor) { |
|
| 39 | + foreach ($interceptors as $interceptor){ |
|
| 40 | 40 | $clone->interceptors[] = $interceptor; |
| 41 | 41 | } |
| 42 | 42 | |
@@ -55,11 +55,11 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function handle(CallContext $context): mixed |
| 57 | 57 | { |
| 58 | - if ($this->handler === null) { |
|
| 58 | + if ($this->handler === null){ |
|
| 59 | 59 | throw new InterceptorException('Unable to invoke pipeline without last handler.'); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if (isset($this->interceptors[$this->position])) { |
|
| 62 | + if (isset($this->interceptors[$this->position])){ |
|
| 63 | 63 | $interceptor = $this->interceptors[$this->position]; |
| 64 | 64 | |
| 65 | 65 | $this->dispatcher?->dispatch(new InterceptorCalling(context: $context, interceptor: $interceptor)); |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | public function testInterceptorCallingEventShouldBeDispatched(): void |
| 21 | 21 | { |
| 22 | 22 | $context = $this->createPathContext(['test', 'test2']); |
| 23 | - $interceptor = new class implements InterceptorInterface { |
|
| 23 | + $interceptor = new class implements InterceptorInterface{ |
|
| 24 | 24 | public function intercept(CallContextInterface $context, HandlerInterface $handler): mixed |
| 25 | 25 | { |
| 26 | 26 | return null; |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $pipeline = $this->createPipeline(interceptors: [$interceptor], dispatcher: $dispatcher); |
| 40 | 40 | |
| 41 | 41 | $pipeline->withHandler( |
| 42 | - new class implements HandlerInterface { |
|
| 42 | + new class implements HandlerInterface{ |
|
| 43 | 43 | public function handle(CallContext $context): mixed |
| 44 | 44 | { |
| 45 | 45 | return null; |
@@ -125,8 +125,8 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | private function createPipeline( |
| 127 | 127 | array $interceptors = [], |
| 128 | - HandlerInterface|null $lastHandler = null, |
|
| 129 | - EventDispatcherInterface|null $dispatcher = null, |
|
| 128 | + HandlerInterface | null $lastHandler = null, |
|
| 129 | + EventDispatcherInterface | null $dispatcher = null, |
|
| 130 | 130 | ): InterceptorPipeline { |
| 131 | 131 | $pipeline = new InterceptorPipeline($dispatcher); |
| 132 | 132 | |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | private ?\ReflectionFunctionAbstract $reflection = null, |
| 21 | 21 | private readonly ?object $object = null, |
| 22 | 22 | private string $delimiter = '.', |
| 23 | - private \Closure|array|null $callable = null, |
|
| 24 | - ) { |
|
| 23 | + private \Closure | array | null $callable = null, |
|
| 24 | + ){ |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | public function __toString(): string |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public static function fromReflectionMethod( |
| 47 | 47 | \ReflectionFunctionAbstract $reflection, |
| 48 | - string|object $classOrObject, |
|
| 48 | + string | object $classOrObject, |
|
| 49 | 49 | ): self { |
| 50 | 50 | $method = $reflection->getName(); |
| 51 | 51 | $isStatic = $reflection->isStatic(); |
@@ -53,17 +53,17 @@ discard block |
||
| 53 | 53 | /** @var self<T> $result */ |
| 54 | 54 | $result = \is_object($classOrObject) |
| 55 | 55 | ? new self( |
| 56 | - path: [$classOrObject::class, $method], |
|
| 57 | - reflection: $reflection, |
|
| 58 | - object: $classOrObject, |
|
| 59 | - delimiter: $isStatic ? '::' : '->', |
|
| 60 | - callable: [$classOrObject, $method], |
|
| 56 | + path : [$classOrObject::class, $method], |
|
| 57 | + reflection : $reflection, |
|
| 58 | + object : $classOrObject, |
|
| 59 | + delimiter : $isStatic ? '::' : '->', |
|
| 60 | + callable : [$classOrObject, $method], |
|
| 61 | 61 | ) |
| 62 | 62 | : new self( |
| 63 | - path: [$classOrObject, $method], |
|
| 64 | - reflection: $reflection, |
|
| 65 | - delimiter: $isStatic ? '::' : '->', |
|
| 66 | - callable: [$classOrObject, $method], |
|
| 63 | + path : [$classOrObject, $method], |
|
| 64 | + reflection : $reflection, |
|
| 65 | + delimiter : $isStatic ? '::' : '->', |
|
| 66 | + callable : [$classOrObject, $method], |
|
| 67 | 67 | ); |
| 68 | 68 | return $result; |
| 69 | 69 | } |
@@ -133,10 +133,10 @@ discard block |
||
| 133 | 133 | * |
| 134 | 134 | * @return ($controller is class-string|T ? self<T> : self<null>) |
| 135 | 135 | */ |
| 136 | - public static function fromPair(string|object $controller, string $action): self |
|
| 136 | + public static function fromPair(string | object $controller, string $action): self |
|
| 137 | 137 | { |
| 138 | 138 | /** @psalm-suppress ArgumentTypeCoercion */ |
| 139 | - if (\is_object($controller) || \method_exists($controller, $action)) { |
|
| 139 | + if (\is_object($controller) || \method_exists($controller, $action)){ |
|
| 140 | 140 | /** @var T|class-string<T> $controller */ |
| 141 | 141 | return self::fromReflectionMethod(new \ReflectionMethod($controller, $action), $controller); |
| 142 | 142 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | return $this->object; |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - public function getCallable(): callable|array|null |
|
| 170 | + public function getCallable(): callable | array | null |
|
| 171 | 171 | { |
| 172 | 172 | return $this->callable; |
| 173 | 173 | } |
@@ -58,5 +58,5 @@ |
||
| 58 | 58 | * |
| 59 | 59 | * @return callable|array{class-string, non-empty-string}|null |
| 60 | 60 | */ |
| 61 | - public function getCallable(): callable|array|null; |
|
| 61 | + public function getCallable(): callable | array | null; |
|
| 62 | 62 | } |
@@ -28,17 +28,17 @@ |
||
| 28 | 28 | $this->pipeline = clone $this->pipeline; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public function withInterceptors(CoreInterceptorInterface|InterceptorInterface ...$interceptors): static |
|
| 31 | + public function withInterceptors(CoreInterceptorInterface | InterceptorInterface ...$interceptors): static |
|
| 32 | 32 | { |
| 33 | 33 | $clone = clone $this; |
| 34 | - foreach ($interceptors as $interceptor) { |
|
| 34 | + foreach ($interceptors as $interceptor){ |
|
| 35 | 35 | $clone->pipeline->addInterceptor($interceptor); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | return $clone; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function build(HandlerInterface|CoreInterface $last): InterceptorPipeline |
|
| 41 | + public function build(HandlerInterface | CoreInterface $last): InterceptorPipeline |
|
| 42 | 42 | { |
| 43 | 43 | /** @psalm-suppress InvalidArgument */ |
| 44 | 44 | return $last instanceof HandlerInterface |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | { |
| 21 | 21 | public function __construct( |
| 22 | 22 | private readonly ContainerInterface $container, |
| 23 | - ) { |
|
| 23 | + ){ |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -30,13 +30,13 @@ discard block |
||
| 30 | 30 | array $interceptors, |
| 31 | 31 | ?EventDispatcherInterface $eventDispatcher = null, |
| 32 | 32 | ?PipelineBuilderInterface $pipelineBuilder = null, |
| 33 | - ): CoreInterface|HandlerInterface { |
|
| 33 | + ): CoreInterface | HandlerInterface { |
|
| 34 | 34 | /** @var CommandCore $core */ |
| 35 | 35 | $core = $this->container->get(CommandCore::class); |
| 36 | 36 | $pipelineBuilder ??= new CompatiblePipelineBuilder($eventDispatcher); |
| 37 | 37 | |
| 38 | 38 | $resolved = []; |
| 39 | - foreach ($interceptors as $interceptor) { |
|
| 39 | + foreach ($interceptors as $interceptor){ |
|
| 40 | 40 | $resolved[] = $this->container->get($interceptor); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -83,13 +83,13 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | protected function execute(InputInterface $input, OutputInterface $output): int |
| 85 | 85 | { |
| 86 | - if ($this->container === null) { |
|
| 86 | + if ($this->container === null){ |
|
| 87 | 87 | throw new ScopeException('Container is not set'); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | $method = method_exists($this, 'perform') ? 'perform' : '__invoke'; |
| 91 | 91 | |
| 92 | - try { |
|
| 92 | + try{ |
|
| 93 | 93 | [$this->input, $this->output] = [$this->prepareInput($input), $this->prepareOutput($input, $output)]; |
| 94 | 94 | |
| 95 | 95 | $this->eventDispatcher?->dispatch(new CommandStarting($this, $this->input, $this->output)); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $this->eventDispatcher?->dispatch(new CommandFinished($this, $code, $this->input, $this->output)); |
| 123 | 123 | |
| 124 | 124 | return $code; |
| 125 | - } finally { |
|
| 125 | + }finally{ |
|
| 126 | 126 | [$this->input, $this->output] = [null, null]; |
| 127 | 127 | } |
| 128 | 128 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | /** |
| 131 | 131 | * @deprecated This method will be removed in v4.0. |
| 132 | 132 | */ |
| 133 | - protected function buildCore(): CoreInterface|HandlerInterface |
|
| 133 | + protected function buildCore(): CoreInterface | HandlerInterface |
|
| 134 | 134 | { |
| 135 | 135 | /** @var InvokerInterface $invoker */ |
| 136 | 136 | $invoker = $this->container->get(InvokerInterface::class); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | private readonly FactoryInterface $factory, |
| 27 | 27 | ?EventDispatcherInterface $dispatcher = null, |
| 28 | 28 | ?PipelineBuilderInterface $builder = null, |
| 29 | - ) { |
|
| 29 | + ){ |
|
| 30 | 30 | $this->builder = $builder ?? new CompatiblePipelineBuilder($dispatcher); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | // Replaces alias with real pipeline name |
| 37 | 37 | $name = $this->config->getAliases()[$name] ?? $name; |
| 38 | 38 | |
| 39 | - if (!isset($this->pipelines[$name])) { |
|
| 39 | + if (!isset($this->pipelines[$name])){ |
|
| 40 | 40 | $this->pipelines[$name] = $this->resolveConnection($name); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -51,18 +51,18 @@ discard block |
||
| 51 | 51 | { |
| 52 | 52 | $config = $this->config->getConnection($name); |
| 53 | 53 | |
| 54 | - try { |
|
| 54 | + try{ |
|
| 55 | 55 | $driver = $this->factory->make($config['driver'], $config); |
| 56 | 56 | |
| 57 | 57 | $list = []; |
| 58 | - foreach ($this->config->getPushInterceptors() as $interceptor) { |
|
| 58 | + foreach ($this->config->getPushInterceptors() as $interceptor){ |
|
| 59 | 59 | $list[] = \is_string($interceptor) || $interceptor instanceof Autowire |
| 60 | 60 | ? $this->container->get($interceptor) |
| 61 | 61 | : $interceptor; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | return new Queue($this->builder->withInterceptors(...$list)->build(new PushCore($driver))); |
| 65 | - } catch (ContainerException $e) { |
|
| 65 | + }catch (ContainerException $e){ |
|
| 66 | 66 | throw new Exception\NotSupportedDriverException( |
| 67 | 67 | \sprintf( |
| 68 | 68 | '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 | |
@@ -147,10 +147,10 @@ discard block |
||
| 147 | 147 | $builder ??= new CompatiblePipelineBuilder($dispatcher); |
| 148 | 148 | |
| 149 | 149 | $list = []; |
| 150 | - foreach ($config->getConsumeInterceptors() as $interceptor) { |
|
| 151 | - if (\is_string($interceptor)) { |
|
| 150 | + foreach ($config->getConsumeInterceptors() as $interceptor){ |
|
| 151 | + if (\is_string($interceptor)){ |
|
| 152 | 152 | $list[] = $container->get($interceptor); |
| 153 | - } elseif ($interceptor instanceof Autowire) { |
|
| 153 | + } elseif ($interceptor instanceof Autowire){ |
|
| 154 | 154 | $list[] = $interceptor->resolve($factory); |
| 155 | 155 | } |
| 156 | 156 | } |