@@ -16,9 +16,9 @@ |
||
16 | 16 | protected string $scope; |
17 | 17 | public function __construct( |
18 | 18 | protected readonly string $id, |
19 | - Container|string|null $scopeOrContainer = null, |
|
19 | + Container | string | null $scopeOrContainer = null, |
|
20 | 20 | protected readonly ?string $requiredScope = null, |
21 | - ) { |
|
21 | + ){ |
|
22 | 22 | $this->scope = \is_string($scopeOrContainer) |
23 | 23 | ? $scopeOrContainer |
24 | 24 | : Introspector::scopeName($scopeOrContainer); |
@@ -28,7 +28,7 @@ |
||
28 | 28 | |
29 | 29 | public function defineDirectories(string $root): array |
30 | 30 | { |
31 | - return \array_merge(parent::defineDirectories($root), ['app' => $root . '/App']); |
|
31 | + return \array_merge(parent::defineDirectories($root), ['app' => $root.'/App']); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | protected function tearDown(): void |
@@ -15,7 +15,7 @@ |
||
15 | 15 | { |
16 | 16 | public function __construct( |
17 | 17 | private readonly InvokerInterface $invoker, |
18 | - ) { |
|
18 | + ){ |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -84,13 +84,13 @@ discard block |
||
84 | 84 | */ |
85 | 85 | protected function execute(InputInterface $input, OutputInterface $output): int |
86 | 86 | { |
87 | - if ($this->container === null) { |
|
87 | + if ($this->container === null){ |
|
88 | 88 | throw new ScopeException('Container is not set'); |
89 | 89 | } |
90 | 90 | |
91 | 91 | $method = method_exists($this, 'perform') ? 'perform' : '__invoke'; |
92 | 92 | |
93 | - try { |
|
93 | + try{ |
|
94 | 94 | [$this->input, $this->output] = [$this->prepareInput($input), $this->prepareOutput($input, $output)]; |
95 | 95 | |
96 | 96 | $this->eventDispatcher?->dispatch(new CommandStarting($this, $this->input, $this->output)); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $this->eventDispatcher?->dispatch(new CommandFinished($this, $code, $this->input, $this->output)); |
124 | 124 | |
125 | 125 | return $code; |
126 | - } finally { |
|
126 | + }finally{ |
|
127 | 127 | [$this->input, $this->output] = [null, null]; |
128 | 128 | } |
129 | 129 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | /** |
132 | 132 | * @deprecated This method will be removed in v4.0. |
133 | 133 | */ |
134 | - protected function buildCore(): CoreInterface|HandlerInterface |
|
134 | + protected function buildCore(): CoreInterface | HandlerInterface |
|
135 | 135 | { |
136 | 136 | return ContainerScope::getContainer() |
137 | 137 | ->get(CommandCoreFactory::class) |
@@ -84,13 +84,15 @@ discard block |
||
84 | 84 | */ |
85 | 85 | protected function execute(InputInterface $input, OutputInterface $output): int |
86 | 86 | { |
87 | - if ($this->container === null) { |
|
87 | + if ($this->container === null) |
|
88 | + { |
|
88 | 89 | throw new ScopeException('Container is not set'); |
89 | 90 | } |
90 | 91 | |
91 | 92 | $method = method_exists($this, 'perform') ? 'perform' : '__invoke'; |
92 | 93 | |
93 | - try { |
|
94 | + try |
|
95 | + { |
|
94 | 96 | [$this->input, $this->output] = [$this->prepareInput($input), $this->prepareOutput($input, $output)]; |
95 | 97 | |
96 | 98 | $this->eventDispatcher?->dispatch(new CommandStarting($this, $this->input, $this->output)); |
@@ -107,7 +109,8 @@ discard block |
||
107 | 109 | ], |
108 | 110 | autowire: false, |
109 | 111 | ), |
110 | - function () use ($method) { |
|
112 | + function () use ($method) |
|
113 | + { |
|
111 | 114 | $core = $this->buildCore(); |
112 | 115 | $arguments = ['input' => $this->input, 'output' => $this->output, 'command' => $this]; |
113 | 116 | |
@@ -123,7 +126,9 @@ discard block |
||
123 | 126 | $this->eventDispatcher?->dispatch(new CommandFinished($this, $code, $this->input, $this->output)); |
124 | 127 | |
125 | 128 | return $code; |
126 | - } finally { |
|
129 | + } |
|
130 | + finally |
|
131 | + { |
|
127 | 132 | [$this->input, $this->output] = [null, null]; |
128 | 133 | } |
129 | 134 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | { |
20 | 20 | public function __construct( |
21 | 21 | private readonly ContainerInterface $container, |
22 | - ) { |
|
22 | + ){ |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | public function make( |
29 | 29 | array $interceptors, |
30 | 30 | ?EventDispatcherInterface $eventDispatcher = null, |
31 | - ): CoreInterface|HandlerInterface { |
|
31 | + ): CoreInterface | HandlerInterface { |
|
32 | 32 | /** @var CommandCore $core */ |
33 | 33 | $core = $this->container->get(CommandCore::class); |
34 | 34 | |
35 | 35 | $interceptableCore = (new InterceptorPipeline($eventDispatcher))->withCore($core); |
36 | 36 | |
37 | - foreach ($interceptors as $interceptor) { |
|
37 | + foreach ($interceptors as $interceptor){ |
|
38 | 38 | $interceptableCore->addInterceptor($this->container->get($interceptor)); |
39 | 39 | } |
40 | 40 | $interceptableCore->addInterceptor($this->container->get(AttributeInterceptor::class)); |
@@ -34,7 +34,8 @@ |
||
34 | 34 | |
35 | 35 | $interceptableCore = (new InterceptorPipeline($eventDispatcher))->withCore($core); |
36 | 36 | |
37 | - foreach ($interceptors as $interceptor) { |
|
37 | + foreach ($interceptors as $interceptor) |
|
38 | + { |
|
38 | 39 | $interceptableCore->addInterceptor($this->container->get($interceptor)); |
39 | 40 | } |
40 | 41 | $interceptableCore->addInterceptor($this->container->get(AttributeInterceptor::class)); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | public function __construct( |
43 | 43 | private readonly ConfiguratorInterface $config |
44 | - ) { |
|
44 | + ){ |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | public function init(AbstractKernel $kernel, BinderInterface $binder): void |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | public function addConfigureSequence( |
103 | - string|array|\Closure $sequence, |
|
103 | + string | array | \Closure $sequence, |
|
104 | 104 | string $header, |
105 | 105 | string $footer = '', |
106 | 106 | array $options = [] |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | public function addUpdateSequence( |
112 | - string|array|\Closure $sequence, |
|
112 | + string | array | \Closure $sequence, |
|
113 | 113 | string $header, |
114 | 114 | string $footer = '', |
115 | 115 | array $options = [] |
@@ -119,12 +119,12 @@ discard block |
||
119 | 119 | |
120 | 120 | public function addSequence( |
121 | 121 | string $name, |
122 | - string|array|\Closure $sequence, |
|
122 | + string | array | \Closure $sequence, |
|
123 | 123 | string $header, |
124 | 124 | string $footer = '', |
125 | 125 | array $options = [] |
126 | 126 | ): void { |
127 | - if (!isset($this->config->getConfig(ConsoleConfig::CONFIG)['sequences'][$name])) { |
|
127 | + if (!isset($this->config->getConfig(ConsoleConfig::CONFIG)['sequences'][$name])){ |
|
128 | 128 | $this->config->modify( |
129 | 129 | ConsoleConfig::CONFIG, |
130 | 130 | new Append('sequences', $name, []) |
@@ -133,13 +133,13 @@ discard block |
||
133 | 133 | |
134 | 134 | $this->config->modify( |
135 | 135 | ConsoleConfig::CONFIG, |
136 | - $this->sequence('sequences.' . $name, $sequence, $header, $footer, $options) |
|
136 | + $this->sequence('sequences.'.$name, $sequence, $header, $footer, $options) |
|
137 | 137 | ); |
138 | 138 | } |
139 | 139 | |
140 | 140 | private function sequence( |
141 | 141 | string $target, |
142 | - string|array|callable $sequence, |
|
142 | + string | array | callable $sequence, |
|
143 | 143 | string $header, |
144 | 144 | string $footer, |
145 | 145 | array $options |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | #[Proxy] private readonly ContainerInterface $container = new Container(), |
39 | 39 | private readonly ScopeInterface $scope = new Container(), |
40 | 40 | private readonly ?EventDispatcherInterface $dispatcher = null, |
41 | - ) { |
|
41 | + ){ |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function run( |
65 | 65 | ?string $command, |
66 | - array|InputInterface $input = [], |
|
66 | + array | InputInterface $input = [], |
|
67 | 67 | OutputInterface $output = new BufferedOutput(), |
68 | 68 | ): CommandOutput { |
69 | 69 | $input = \is_array($input) ? new ArrayInput($input) : $input; |
70 | 70 | |
71 | 71 | $this->configureIO($input, $output); |
72 | 72 | |
73 | - if ($command !== null) { |
|
73 | + if ($command !== null){ |
|
74 | 74 | $input = new InputProxy($input, ['firstArgument' => $command]); |
75 | 75 | } |
76 | 76 | |
@@ -97,18 +97,18 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function getApplication(): Application |
99 | 99 | { |
100 | - if ($this->application !== null) { |
|
100 | + if ($this->application !== null){ |
|
101 | 101 | return $this->application; |
102 | 102 | } |
103 | 103 | |
104 | 104 | $this->application = new Application($this->config->getName(), $this->config->getVersion()); |
105 | 105 | $this->application->setCatchExceptions(false); |
106 | 106 | $this->application->setAutoExit(false); |
107 | - if ($this->dispatcher instanceof SymfonyEventDispatcherInterface) { |
|
107 | + if ($this->dispatcher instanceof SymfonyEventDispatcherInterface){ |
|
108 | 108 | $this->application->setDispatcher($this->dispatcher); |
109 | 109 | } |
110 | 110 | |
111 | - if ($this->locator !== null) { |
|
111 | + if ($this->locator !== null){ |
|
112 | 112 | $this->addCommands($this->locator->locateCommands()); |
113 | 113 | } |
114 | 114 | |
@@ -128,13 +128,13 @@ discard block |
||
128 | 128 | { |
129 | 129 | $interceptors = $this->config->getInterceptors(); |
130 | 130 | |
131 | - foreach ($commands as $command) { |
|
132 | - if ($command instanceof Command) { |
|
131 | + foreach ($commands as $command){ |
|
132 | + if ($command instanceof Command){ |
|
133 | 133 | $command->setContainer($this->container); |
134 | 134 | $command->setInterceptors($interceptors); |
135 | 135 | } |
136 | 136 | |
137 | - if ($this->dispatcher !== null && $command instanceof EventDispatcherAwareInterface) { |
|
137 | + if ($this->dispatcher !== null && $command instanceof EventDispatcherAwareInterface){ |
|
138 | 138 | $command->setEventDispatcher($this->dispatcher); |
139 | 139 | } |
140 | 140 | |
@@ -149,22 +149,22 @@ discard block |
||
149 | 149 | */ |
150 | 150 | private function configureIO(InputInterface $input, OutputInterface $output): void |
151 | 151 | { |
152 | - if ($input->hasParameterOption(['--ansi'], true)) { |
|
152 | + if ($input->hasParameterOption(['--ansi'], true)){ |
|
153 | 153 | $output->setDecorated(true); |
154 | - } elseif ($input->hasParameterOption(['--no-ansi'], true)) { |
|
154 | + } elseif ($input->hasParameterOption(['--no-ansi'], true)){ |
|
155 | 155 | $output->setDecorated(false); |
156 | 156 | } |
157 | 157 | |
158 | - if ($input->hasParameterOption(['--no-interaction', '-n'], true)) { |
|
158 | + if ($input->hasParameterOption(['--no-interaction', '-n'], true)){ |
|
159 | 159 | $input->setInteractive(false); |
160 | - } elseif (\function_exists('posix_isatty')) { |
|
160 | + } elseif (\function_exists('posix_isatty')){ |
|
161 | 161 | $inputStream = null; |
162 | 162 | |
163 | - if ($input instanceof StreamableInputInterface) { |
|
163 | + if ($input instanceof StreamableInputInterface){ |
|
164 | 164 | $inputStream = $input->getStream(); |
165 | 165 | } |
166 | 166 | |
167 | - if ($inputStream !== null && !@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) { |
|
167 | + if ($inputStream !== null && !@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')){ |
|
168 | 168 | $input->setInteractive(false); |
169 | 169 | } |
170 | 170 | } |
@@ -177,22 +177,22 @@ discard block |
||
177 | 177 | default => $shellVerbosity = 0 |
178 | 178 | }; |
179 | 179 | |
180 | - if ($input->hasParameterOption(['--quiet', '-q'], true)) { |
|
180 | + if ($input->hasParameterOption(['--quiet', '-q'], true)){ |
|
181 | 181 | $output->setVerbosity(OutputInterface::VERBOSITY_QUIET); |
182 | 182 | $shellVerbosity = -1; |
183 | - } else { |
|
183 | + }else{ |
|
184 | 184 | if ( |
185 | 185 | $input->hasParameterOption('-vvv', true) |
186 | 186 | || $input->hasParameterOption('--verbose=3', true) |
187 | 187 | || 3 === $input->getParameterOption('--verbose', false, true) |
188 | - ) { |
|
188 | + ){ |
|
189 | 189 | $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG); |
190 | 190 | $shellVerbosity = 3; |
191 | 191 | } elseif ( |
192 | 192 | $input->hasParameterOption('-vv', true) |
193 | 193 | || $input->hasParameterOption('--verbose=2', true) |
194 | 194 | || 2 === $input->getParameterOption('--verbose', false, true) |
195 | - ) { |
|
195 | + ){ |
|
196 | 196 | $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE); |
197 | 197 | $shellVerbosity = 2; |
198 | 198 | } elseif ( |
@@ -200,17 +200,17 @@ discard block |
||
200 | 200 | || $input->hasParameterOption('--verbose=1', true) |
201 | 201 | || $input->hasParameterOption('--verbose', true) |
202 | 202 | || $input->getParameterOption('--verbose', false, true) |
203 | - ) { |
|
203 | + ){ |
|
204 | 204 | $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE); |
205 | 205 | $shellVerbosity = 1; |
206 | 206 | } |
207 | 207 | } |
208 | 208 | |
209 | - if (-1 === $shellVerbosity) { |
|
209 | + if (-1 === $shellVerbosity){ |
|
210 | 210 | $input->setInteractive(false); |
211 | 211 | } |
212 | 212 | |
213 | - \putenv('SHELL_VERBOSITY=' . $shellVerbosity); |
|
213 | + \putenv('SHELL_VERBOSITY='.$shellVerbosity); |
|
214 | 214 | $_ENV['SHELL_VERBOSITY'] = $shellVerbosity; |
215 | 215 | $_SERVER['SHELL_VERBOSITY'] = $shellVerbosity; |
216 | 216 | } |