@@ -273,7 +273,8 @@ |
||
273 | 273 | { |
274 | 274 | $result = []; |
275 | 275 | |
276 | - foreach ($response->getHeaders() as $line) { |
|
276 | + foreach ($response->getHeaders() as $line) |
|
277 | + { |
|
277 | 278 | $cookie = explode('=', implode('', $line)); |
278 | 279 | $result[$cookie[0]] = rawurldecode(substr( |
279 | 280 | $cookie[1], |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $core = $this->httpCore([CookiesMiddleware::class]); |
128 | 128 | $core->setHandler(fn(ServerRequestInterface $r) => $r->getCookieParams()['name']); |
129 | 129 | |
130 | - $value = $this->container->get(EncrypterInterface::class)->encrypt('cookie-value') . 'BROKEN'; |
|
130 | + $value = $this->container->get(EncrypterInterface::class)->encrypt('cookie-value').'BROKEN'; |
|
131 | 131 | |
132 | 132 | $response = $this->get($core, '/', [], [], ['name' => $value]); |
133 | 133 | self::assertSame(200, $response->getStatusCode()); |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | { |
271 | 271 | $result = []; |
272 | 272 | |
273 | - foreach ($response->getHeaders() as $line) { |
|
273 | + foreach ($response->getHeaders() as $line){ |
|
274 | 274 | $cookie = explode('=', implode('', $line)); |
275 | 275 | $result[$cookie[0]] = rawurldecode(substr( |
276 | 276 | $cookie[1], |
@@ -48,7 +48,7 @@ |
||
48 | 48 | static function (DistributionConfig $config): DistributionInterface { |
49 | 49 | $manager = new Manager($config->getDefaultDriver()); |
50 | 50 | |
51 | - foreach ($config->getResolvers() as $name => $resolver) { |
|
51 | + foreach ($config->getResolvers() as $name => $resolver){ |
|
52 | 52 | $manager->add($name, $resolver); |
53 | 53 | } |
54 | 54 |
@@ -48,7 +48,8 @@ |
||
48 | 48 | static function (DistributionConfig $config): DistributionInterface { |
49 | 49 | $manager = new Manager($config->getDefaultDriver()); |
50 | 50 | |
51 | - foreach ($config->getResolvers() as $name => $resolver) { |
|
51 | + foreach ($config->getResolvers() as $name => $resolver) |
|
52 | + { |
|
52 | 53 | $manager->add($name, $resolver); |
53 | 54 | } |
54 | 55 |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | private readonly ContainerInterface $container, |
53 | 53 | private readonly ?EventDispatcherInterface $eventDispatcher = null, |
54 | 54 | ?TracerInterface $tracer = null, |
55 | - ) { |
|
55 | + ){ |
|
56 | 56 | $this->tracer = $tracer ?? new NullTracer(); |
57 | - $this->basePath = '/' . \ltrim($basePath, '/'); |
|
57 | + $this->basePath = '/'.\ltrim($basePath, '/'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -68,13 +68,13 @@ discard block |
||
68 | 68 | return $this->tracer->trace( |
69 | 69 | name: 'Routing', |
70 | 70 | callback: function (SpanInterface $span) use ($request): ResponseInterface { |
71 | - try { |
|
71 | + try{ |
|
72 | 72 | $route = $this->matchRoute($request, $routeName); |
73 | - } catch (RouteException $e) { |
|
73 | + }catch (RouteException $e){ |
|
74 | 74 | throw new RouterException('Invalid route definition', $e->getCode(), $e); |
75 | 75 | } |
76 | 76 | |
77 | - if ($route === null) { |
|
77 | + if ($route === null){ |
|
78 | 78 | $this->eventDispatcher?->dispatch(new RouteNotFound($request)); |
79 | 79 | throw new RouteNotFoundException($request->getUri()); |
80 | 80 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | public function getRoute(string $name): RouteInterface |
111 | 111 | { |
112 | - if (isset($this->routes[$name])) { |
|
112 | + if (isset($this->routes[$name])){ |
|
113 | 113 | return $this->routes[$name]; |
114 | 114 | } |
115 | 115 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | public function getRoutes(): array |
120 | 120 | { |
121 | - if (!empty($this->default)) { |
|
121 | + if (!empty($this->default)){ |
|
122 | 122 | return $this->routes + [null => $this->default]; |
123 | 123 | } |
124 | 124 | |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | |
128 | 128 | public function uri(string $route, iterable $parameters = []): UriInterface |
129 | 129 | { |
130 | - try { |
|
130 | + try{ |
|
131 | 131 | return $this->getRoute($route)->uri($parameters); |
132 | - } catch (UndefinedRouteException) { |
|
132 | + }catch (UndefinedRouteException){ |
|
133 | 133 | //In some cases route name can be provided as controller:action pair, we can try to |
134 | 134 | //generate such route automatically based on our default/fallback route |
135 | 135 | return $this->castRoute($route)->uri($parameters); |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | /** @var GroupRegistry $groups */ |
142 | 142 | $groups = $this->container->get(GroupRegistry::class); |
143 | 143 | |
144 | - foreach ($routes->getCollection() as $name => $configurator) { |
|
144 | + foreach ($routes->getCollection() as $name => $configurator){ |
|
145 | 145 | $target = $configurator->target; |
146 | - if ($configurator->core !== null && $target instanceof AbstractTarget) { |
|
146 | + if ($configurator->core !== null && $target instanceof AbstractTarget){ |
|
147 | 147 | $target = $target->withCore($configurator->core); |
148 | 148 | } |
149 | 149 | |
@@ -152,21 +152,21 @@ discard block |
||
152 | 152 | : \ltrim($configurator->pattern, '/'); |
153 | 153 | $route = new Route($pattern, $target, $configurator->defaults); |
154 | 154 | |
155 | - if ($configurator->middleware !== null) { |
|
155 | + if ($configurator->middleware !== null){ |
|
156 | 156 | $route = $route->withMiddleware(...$configurator->middleware); |
157 | 157 | } |
158 | 158 | |
159 | - if ($configurator->methods !== null) { |
|
159 | + if ($configurator->methods !== null){ |
|
160 | 160 | $route = $route->withVerbs(...$configurator->methods); |
161 | 161 | } |
162 | 162 | |
163 | - if (!isset($this->routes[$name]) && $name !== RoutingConfigurator::DEFAULT_ROUTE_NAME) { |
|
163 | + if (!isset($this->routes[$name]) && $name !== RoutingConfigurator::DEFAULT_ROUTE_NAME){ |
|
164 | 164 | $group = $groups->getGroup($configurator->group ?? $groups->getDefaultGroup()); |
165 | 165 | $group->setPrefix($configurator->prefix); |
166 | 166 | $group->addRoute($name, $route); |
167 | 167 | } |
168 | 168 | |
169 | - if ($name === RoutingConfigurator::DEFAULT_ROUTE_NAME) { |
|
169 | + if ($name === RoutingConfigurator::DEFAULT_ROUTE_NAME){ |
|
170 | 170 | $this->setDefault($route); |
171 | 171 | } |
172 | 172 | } |
@@ -177,17 +177,17 @@ discard block |
||
177 | 177 | */ |
178 | 178 | protected function matchRoute(ServerRequestInterface $request, ?string &$routeName = null): ?RouteInterface |
179 | 179 | { |
180 | - foreach ($this->routes as $name => $route) { |
|
180 | + foreach ($this->routes as $name => $route){ |
|
181 | 181 | // Matched route will return new route instance with matched parameters |
182 | 182 | $matched = $route->match($request); |
183 | 183 | |
184 | - if ($matched !== null) { |
|
184 | + if ($matched !== null){ |
|
185 | 185 | $routeName = $name; |
186 | 186 | return $matched; |
187 | 187 | } |
188 | 188 | } |
189 | 189 | |
190 | - if ($this->default !== null) { |
|
190 | + if ($this->default !== null){ |
|
191 | 191 | return $this->default->match($request); |
192 | 192 | } |
193 | 193 | |
@@ -200,14 +200,14 @@ discard block |
||
200 | 200 | */ |
201 | 201 | protected function configure(RouteInterface $route): RouteInterface |
202 | 202 | { |
203 | - if ($route instanceof ContainerizedInterface && !$route->hasContainer()) { |
|
203 | + if ($route instanceof ContainerizedInterface && !$route->hasContainer()){ |
|
204 | 204 | // isolating route in a given container |
205 | 205 | $route = $route->withContainer($this->container); |
206 | 206 | } |
207 | 207 | |
208 | - try { |
|
208 | + try{ |
|
209 | 209 | $uriHandler = $route->getUriHandler(); |
210 | - } catch (\Throwable) { |
|
210 | + }catch (\Throwable){ |
|
211 | 211 | $uriHandler = $this->uriHandler; |
212 | 212 | } |
213 | 213 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | $route, |
231 | 231 | $matches |
232 | 232 | ) |
233 | - ) { |
|
233 | + ){ |
|
234 | 234 | throw new UndefinedRouteException( |
235 | 235 | "Unable to locate route or use default route with 'name/controller:action' pattern" |
236 | 236 | ); |
@@ -239,11 +239,11 @@ discard block |
||
239 | 239 | /** |
240 | 240 | * @var Matches $matches |
241 | 241 | */ |
242 | - if (!empty($matches['name'])) { |
|
242 | + if (!empty($matches['name'])){ |
|
243 | 243 | $routeObject = $this->getRoute($matches['name']); |
244 | - } elseif ($this->default !== null) { |
|
244 | + } elseif ($this->default !== null){ |
|
245 | 245 | $routeObject = $this->default; |
246 | - } else { |
|
246 | + }else{ |
|
247 | 247 | throw new UndefinedRouteException(\sprintf('Unable to locate route candidate for `%s`', $route)); |
248 | 248 | } |
249 | 249 |
@@ -68,13 +68,17 @@ discard block |
||
68 | 68 | return $this->tracer->trace( |
69 | 69 | name: 'Routing', |
70 | 70 | callback: function (SpanInterface $span) use ($request): ResponseInterface { |
71 | - try { |
|
71 | + try |
|
72 | + { |
|
72 | 73 | $route = $this->matchRoute($request, $routeName); |
73 | - } catch (RouteException $e) { |
|
74 | + } |
|
75 | + catch (RouteException $e) |
|
76 | + { |
|
74 | 77 | throw new RouterException('Invalid route definition', $e->getCode(), $e); |
75 | 78 | } |
76 | 79 | |
77 | - if ($route === null) { |
|
80 | + if ($route === null) |
|
81 | + { |
|
78 | 82 | $this->eventDispatcher?->dispatch(new RouteNotFound($request)); |
79 | 83 | throw new RouteNotFoundException($request->getUri()); |
80 | 84 | } |
@@ -109,7 +113,8 @@ discard block |
||
109 | 113 | |
110 | 114 | public function getRoute(string $name): RouteInterface |
111 | 115 | { |
112 | - if (isset($this->routes[$name])) { |
|
116 | + if (isset($this->routes[$name])) |
|
117 | + { |
|
113 | 118 | return $this->routes[$name]; |
114 | 119 | } |
115 | 120 | |
@@ -118,7 +123,8 @@ discard block |
||
118 | 123 | |
119 | 124 | public function getRoutes(): array |
120 | 125 | { |
121 | - if (!empty($this->default)) { |
|
126 | + if (!empty($this->default)) |
|
127 | + { |
|
122 | 128 | return $this->routes + [null => $this->default]; |
123 | 129 | } |
124 | 130 | |
@@ -127,9 +133,12 @@ discard block |
||
127 | 133 | |
128 | 134 | public function uri(string $route, iterable $parameters = []): UriInterface |
129 | 135 | { |
130 | - try { |
|
136 | + try |
|
137 | + { |
|
131 | 138 | return $this->getRoute($route)->uri($parameters); |
132 | - } catch (UndefinedRouteException) { |
|
139 | + } |
|
140 | + catch (UndefinedRouteException) |
|
141 | + { |
|
133 | 142 | //In some cases route name can be provided as controller:action pair, we can try to |
134 | 143 | //generate such route automatically based on our default/fallback route |
135 | 144 | return $this->castRoute($route)->uri($parameters); |
@@ -141,9 +150,11 @@ discard block |
||
141 | 150 | /** @var GroupRegistry $groups */ |
142 | 151 | $groups = $this->container->get(GroupRegistry::class); |
143 | 152 | |
144 | - foreach ($routes->getCollection() as $name => $configurator) { |
|
153 | + foreach ($routes->getCollection() as $name => $configurator) |
|
154 | + { |
|
145 | 155 | $target = $configurator->target; |
146 | - if ($configurator->core !== null && $target instanceof AbstractTarget) { |
|
156 | + if ($configurator->core !== null && $target instanceof AbstractTarget) |
|
157 | + { |
|
147 | 158 | $target = $target->withCore($configurator->core); |
148 | 159 | } |
149 | 160 | |
@@ -152,21 +163,25 @@ discard block |
||
152 | 163 | : \ltrim($configurator->pattern, '/'); |
153 | 164 | $route = new Route($pattern, $target, $configurator->defaults); |
154 | 165 | |
155 | - if ($configurator->middleware !== null) { |
|
166 | + if ($configurator->middleware !== null) |
|
167 | + { |
|
156 | 168 | $route = $route->withMiddleware(...$configurator->middleware); |
157 | 169 | } |
158 | 170 | |
159 | - if ($configurator->methods !== null) { |
|
171 | + if ($configurator->methods !== null) |
|
172 | + { |
|
160 | 173 | $route = $route->withVerbs(...$configurator->methods); |
161 | 174 | } |
162 | 175 | |
163 | - if (!isset($this->routes[$name]) && $name !== RoutingConfigurator::DEFAULT_ROUTE_NAME) { |
|
176 | + if (!isset($this->routes[$name]) && $name !== RoutingConfigurator::DEFAULT_ROUTE_NAME) |
|
177 | + { |
|
164 | 178 | $group = $groups->getGroup($configurator->group ?? $groups->getDefaultGroup()); |
165 | 179 | $group->setPrefix($configurator->prefix); |
166 | 180 | $group->addRoute($name, $route); |
167 | 181 | } |
168 | 182 | |
169 | - if ($name === RoutingConfigurator::DEFAULT_ROUTE_NAME) { |
|
183 | + if ($name === RoutingConfigurator::DEFAULT_ROUTE_NAME) |
|
184 | + { |
|
170 | 185 | $this->setDefault($route); |
171 | 186 | } |
172 | 187 | } |
@@ -177,17 +192,20 @@ discard block |
||
177 | 192 | */ |
178 | 193 | protected function matchRoute(ServerRequestInterface $request, ?string &$routeName = null): ?RouteInterface |
179 | 194 | { |
180 | - foreach ($this->routes as $name => $route) { |
|
195 | + foreach ($this->routes as $name => $route) |
|
196 | + { |
|
181 | 197 | // Matched route will return new route instance with matched parameters |
182 | 198 | $matched = $route->match($request); |
183 | 199 | |
184 | - if ($matched !== null) { |
|
200 | + if ($matched !== null) |
|
201 | + { |
|
185 | 202 | $routeName = $name; |
186 | 203 | return $matched; |
187 | 204 | } |
188 | 205 | } |
189 | 206 | |
190 | - if ($this->default !== null) { |
|
207 | + if ($this->default !== null) |
|
208 | + { |
|
191 | 209 | return $this->default->match($request); |
192 | 210 | } |
193 | 211 | |
@@ -200,14 +218,18 @@ discard block |
||
200 | 218 | */ |
201 | 219 | protected function configure(RouteInterface $route): RouteInterface |
202 | 220 | { |
203 | - if ($route instanceof ContainerizedInterface && !$route->hasContainer()) { |
|
221 | + if ($route instanceof ContainerizedInterface && !$route->hasContainer()) |
|
222 | + { |
|
204 | 223 | // isolating route in a given container |
205 | 224 | $route = $route->withContainer($this->container); |
206 | 225 | } |
207 | 226 | |
208 | - try { |
|
227 | + try |
|
228 | + { |
|
209 | 229 | $uriHandler = $route->getUriHandler(); |
210 | - } catch (\Throwable) { |
|
230 | + } |
|
231 | + catch (\Throwable) |
|
232 | + { |
|
211 | 233 | $uriHandler = $this->uriHandler; |
212 | 234 | } |
213 | 235 | |
@@ -239,11 +261,16 @@ discard block |
||
239 | 261 | /** |
240 | 262 | * @var Matches $matches |
241 | 263 | */ |
242 | - if (!empty($matches['name'])) { |
|
264 | + if (!empty($matches['name'])) |
|
265 | + { |
|
243 | 266 | $routeObject = $this->getRoute($matches['name']); |
244 | - } elseif ($this->default !== null) { |
|
267 | + } |
|
268 | + elseif ($this->default !== null) |
|
269 | + { |
|
245 | 270 | $routeObject = $this->default; |
246 | - } else { |
|
271 | + } |
|
272 | + else |
|
273 | + { |
|
247 | 274 | throw new UndefinedRouteException(\sprintf('Unable to locate route candidate for `%s`', $route)); |
248 | 275 | } |
249 | 276 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | public function __construct( |
32 | 32 | private readonly ConfiguratorInterface $config |
33 | - ) { |
|
33 | + ){ |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | public function init(BinderInterface $binder, EnvironmentInterface $env): void |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | $manager = new Storage($config->getDefaultBucket()); |
50 | 50 | $distributions = $config->getDistributions(); |
51 | 51 | |
52 | - foreach ($config->getAdapters() as $name => $adapter) { |
|
52 | + foreach ($config->getAdapters() as $name => $adapter){ |
|
53 | 53 | $resolver = null; |
54 | 54 | |
55 | - if (isset($distributions[$name])) { |
|
56 | - try { |
|
55 | + if (isset($distributions[$name])){ |
|
56 | + try{ |
|
57 | 57 | $cdn = $factory->make(CdnInterface::class); |
58 | - } catch (NotFoundException $e) { |
|
58 | + }catch (NotFoundException $e){ |
|
59 | 59 | $message = 'Unable to create distribution for bucket "%s". ' |
60 | 60 | . 'Please make sure that bootloader %s is added in your application'; |
61 | 61 | $message = \sprintf($message, $name, DistributionBootloader::class); |
@@ -49,13 +49,18 @@ |
||
49 | 49 | $manager = new Storage($config->getDefaultBucket()); |
50 | 50 | $distributions = $config->getDistributions(); |
51 | 51 | |
52 | - foreach ($config->getAdapters() as $name => $adapter) { |
|
52 | + foreach ($config->getAdapters() as $name => $adapter) |
|
53 | + { |
|
53 | 54 | $resolver = null; |
54 | 55 | |
55 | - if (isset($distributions[$name])) { |
|
56 | - try { |
|
56 | + if (isset($distributions[$name])) |
|
57 | + { |
|
58 | + try |
|
59 | + { |
|
57 | 60 | $cdn = $factory->make(CdnInterface::class); |
58 | - } catch (NotFoundException $e) { |
|
61 | + } |
|
62 | + catch (NotFoundException $e) |
|
63 | + { |
|
59 | 64 | $message = 'Unable to create distribution for bucket "%s". ' |
60 | 65 | . 'Please make sure that bootloader %s is added in your application'; |
61 | 66 | $message = \sprintf($message, $name, DistributionBootloader::class); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | public function setUp(): void |
31 | 31 | { |
32 | - if (!\class_exists(Kernel::class)) { |
|
32 | + if (!\class_exists(Kernel::class)){ |
|
33 | 33 | $this->markTestSkipped('A "spiral/framework" dependency is required to run these tests'); |
34 | 34 | } |
35 | 35 | |
@@ -40,16 +40,16 @@ discard block |
||
40 | 40 | 'cache' => sys_get_temp_dir() |
41 | 41 | ], false)->run(); |
42 | 42 | |
43 | - $this->storage = new Storage($this->dir() . '/Fixtures/'); |
|
43 | + $this->storage = new Storage($this->dir().'/Fixtures/'); |
|
44 | 44 | |
45 | - foreach (static::STORE as $name) { |
|
45 | + foreach (static::STORE as $name){ |
|
46 | 46 | $this->storage->store($name); |
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
50 | 50 | public function tearDown(): void |
51 | 51 | { |
52 | - foreach (static::STORE as $name) { |
|
52 | + foreach (static::STORE as $name){ |
|
53 | 53 | $this->storage->restore($name); |
54 | 54 | } |
55 | 55 | } |
@@ -29,7 +29,8 @@ discard block |
||
29 | 29 | |
30 | 30 | public function setUp(): void |
31 | 31 | { |
32 | - if (!\class_exists(Kernel::class)) { |
|
32 | + if (!\class_exists(Kernel::class)) |
|
33 | + { |
|
33 | 34 | $this->markTestSkipped('A "spiral/framework" dependency is required to run these tests'); |
34 | 35 | } |
35 | 36 | |
@@ -42,14 +43,16 @@ discard block |
||
42 | 43 | |
43 | 44 | $this->storage = new Storage($this->dir() . '/Fixtures/'); |
44 | 45 | |
45 | - foreach (static::STORE as $name) { |
|
46 | + foreach (static::STORE as $name) |
|
47 | + { |
|
46 | 48 | $this->storage->store($name); |
47 | 49 | } |
48 | 50 | } |
49 | 51 | |
50 | 52 | public function tearDown(): void |
51 | 53 | { |
52 | - foreach (static::STORE as $name) { |
|
54 | + foreach (static::STORE as $name) |
|
55 | + { |
|
53 | 56 | $this->storage->restore($name); |
54 | 57 | } |
55 | 58 | } |
@@ -27,59 +27,59 @@ discard block |
||
27 | 27 | |
28 | 28 | return RectorConfig::configure() |
29 | 29 | ->withPaths([ |
30 | - __DIR__ . '/src/*/src', |
|
31 | - __DIR__ . '/src/*/tests', |
|
32 | - __DIR__ . '/tests', |
|
30 | + __DIR__.'/src/*/src', |
|
31 | + __DIR__.'/src/*/tests', |
|
32 | + __DIR__.'/tests', |
|
33 | 33 | ]) |
34 | 34 | ->withParallel() |
35 | 35 | ->withSkip([ |
36 | 36 | IfIssetToCoalescingRector::class, |
37 | 37 | RemoveUnusedPrivatePropertyRector::class => [ |
38 | - __DIR__ . '/src/Scaffolder/src/Command/BootloaderCommand.php', |
|
39 | - __DIR__ . '/src/Scaffolder/src/Command/CommandCommand.php', |
|
40 | - __DIR__ . '/src/Scaffolder/src/Command/ConfigCommand.php', |
|
41 | - __DIR__ . '/src/Scaffolder/src/Command/ControllerCommand.php', |
|
42 | - __DIR__ . '/src/Scaffolder/src/Command/FilterCommand.php', |
|
43 | - __DIR__ . '/src/Scaffolder/src/Command/JobHandlerCommand.php', |
|
44 | - __DIR__ . '/src/Scaffolder/src/Command/MiddlewareCommand.php', |
|
45 | - __DIR__ . '/src/Console/tests/PromptArgumentsTest.php', |
|
38 | + __DIR__.'/src/Scaffolder/src/Command/BootloaderCommand.php', |
|
39 | + __DIR__.'/src/Scaffolder/src/Command/CommandCommand.php', |
|
40 | + __DIR__.'/src/Scaffolder/src/Command/ConfigCommand.php', |
|
41 | + __DIR__.'/src/Scaffolder/src/Command/ControllerCommand.php', |
|
42 | + __DIR__.'/src/Scaffolder/src/Command/FilterCommand.php', |
|
43 | + __DIR__.'/src/Scaffolder/src/Command/JobHandlerCommand.php', |
|
44 | + __DIR__.'/src/Scaffolder/src/Command/MiddlewareCommand.php', |
|
45 | + __DIR__.'/src/Console/tests/PromptArgumentsTest.php', |
|
46 | 46 | ], |
47 | 47 | RemoveUnusedPrivateMethodRector::class => [ |
48 | - __DIR__ . '/src/Boot/src/Bootloader/ConfigurationBootloader.php', |
|
49 | - __DIR__ . '/src/Broadcasting/src/Bootloader/BroadcastingBootloader.php', |
|
50 | - __DIR__ . '/src/Cache/src/Bootloader/CacheBootloader.php', |
|
51 | - __DIR__ . '/src/Serializer/src/Bootloader/SerializerBootloader.php', |
|
52 | - __DIR__ . '/src/Validation/src/Bootloader/ValidationBootloader.php', |
|
53 | - __DIR__ . '/src/Translator/tests/IndexerTest.php', |
|
54 | - __DIR__ . '/src/Tokenizer/tests/ReflectionFileTest.php', |
|
55 | - __DIR__ . '/src/Core/tests/SingletonsTest.php', |
|
48 | + __DIR__.'/src/Boot/src/Bootloader/ConfigurationBootloader.php', |
|
49 | + __DIR__.'/src/Broadcasting/src/Bootloader/BroadcastingBootloader.php', |
|
50 | + __DIR__.'/src/Cache/src/Bootloader/CacheBootloader.php', |
|
51 | + __DIR__.'/src/Serializer/src/Bootloader/SerializerBootloader.php', |
|
52 | + __DIR__.'/src/Validation/src/Bootloader/ValidationBootloader.php', |
|
53 | + __DIR__.'/src/Translator/tests/IndexerTest.php', |
|
54 | + __DIR__.'/src/Tokenizer/tests/ReflectionFileTest.php', |
|
55 | + __DIR__.'/src/Core/tests/SingletonsTest.php', |
|
56 | 56 | ], |
57 | 57 | RemoveUselessVarTagRector::class => [ |
58 | - __DIR__ . '/src/Console/src/Traits/HelpersTrait.php', |
|
58 | + __DIR__.'/src/Console/src/Traits/HelpersTrait.php', |
|
59 | 59 | ], |
60 | 60 | RemoveAlwaysTrueIfConditionRector::class => [ |
61 | - __DIR__ . '/src/Boot/src/BootloadManager/Initializer.php', |
|
62 | - __DIR__ . '/src/Stempler/src/Traverser.php', |
|
63 | - __DIR__ . '/src/Prototype/src/NodeVisitors/LocateProperties.php', |
|
64 | - __DIR__ . '/src/Prototype/src/NodeVisitors/RemoveTrait.php', |
|
65 | - __DIR__ . '/src/Logger/src/ListenerRegistry.php', |
|
66 | - __DIR__ . '/src/Stempler/src/Transform/Merge/ExtendsParent.php', |
|
61 | + __DIR__.'/src/Boot/src/BootloadManager/Initializer.php', |
|
62 | + __DIR__.'/src/Stempler/src/Traverser.php', |
|
63 | + __DIR__.'/src/Prototype/src/NodeVisitors/LocateProperties.php', |
|
64 | + __DIR__.'/src/Prototype/src/NodeVisitors/RemoveTrait.php', |
|
65 | + __DIR__.'/src/Logger/src/ListenerRegistry.php', |
|
66 | + __DIR__.'/src/Stempler/src/Transform/Merge/ExtendsParent.php', |
|
67 | 67 | ], |
68 | 68 | RemoveExtraParametersRector::class => [ |
69 | - __DIR__ . '/src/Boot/src/BootloadManager/AbstractBootloadManager.php', |
|
69 | + __DIR__.'/src/Boot/src/BootloadManager/AbstractBootloadManager.php', |
|
70 | 70 | ], |
71 | 71 | RemoveUnusedPrivateMethodParameterRector::class => [ |
72 | - __DIR__ . '/src/Core/src/Internal/Factory.php', |
|
73 | - __DIR__ . '/src/Core/tests/InjectableTest.php', |
|
72 | + __DIR__.'/src/Core/src/Internal/Factory.php', |
|
73 | + __DIR__.'/src/Core/tests/InjectableTest.php', |
|
74 | 74 | ], |
75 | 75 | RemoveDoubleAssignRector::class => [ |
76 | - __DIR__ . '/src/Core/tests/Scope/FinalizeAttributeTest.php', |
|
76 | + __DIR__.'/src/Core/tests/Scope/FinalizeAttributeTest.php', |
|
77 | 77 | ], |
78 | 78 | RemoveUnusedVariableAssignRector::class => [ |
79 | - __DIR__ . '/src/Core/tests/ExceptionsTest.php', |
|
79 | + __DIR__.'/src/Core/tests/ExceptionsTest.php', |
|
80 | 80 | ], |
81 | 81 | RemoveDeadStmtRector::class => [ |
82 | - __DIR__ . '/src/Core/tests/ExceptionsTest.php', |
|
82 | + __DIR__.'/src/Core/tests/ExceptionsTest.php', |
|
83 | 83 | ], |
84 | 84 | |
85 | 85 | // to be enabled later for bc break 4.x |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | NewInInitializerRector::class, |
90 | 90 | |
91 | 91 | // start with short open tag |
92 | - __DIR__ . '/src/Views/tests/fixtures/other/var.php', |
|
93 | - __DIR__ . '/tests/app/views/native.php', |
|
92 | + __DIR__.'/src/Views/tests/fixtures/other/var.php', |
|
93 | + __DIR__.'/tests/app/views/native.php', |
|
94 | 94 | |
95 | 95 | // example code for test |
96 | 96 | '*/Fixture/*', |
@@ -100,18 +100,18 @@ discard block |
||
100 | 100 | '*/Stubs/*', |
101 | 101 | '*/tests/Classes/*', |
102 | 102 | '*/tests/Internal/*', |
103 | - __DIR__ . '/src/Console/tests/Configurator', |
|
103 | + __DIR__.'/src/Console/tests/Configurator', |
|
104 | 104 | |
105 | 105 | // cache |
106 | 106 | '*/runtime/cache/*', |
107 | 107 | |
108 | 108 | ReadOnlyPropertyRector::class => [ |
109 | 109 | // used by Configurator |
110 | - __DIR__ . '/src/Scaffolder/src/Command', |
|
110 | + __DIR__.'/src/Scaffolder/src/Command', |
|
111 | 111 | ], |
112 | 112 | |
113 | 113 | FirstClassCallableRector::class => [ |
114 | - __DIR__ . '/src/Core/tests/Scope/UseCaseTest.php', |
|
114 | + __DIR__.'/src/Core/tests/Scope/UseCaseTest.php', |
|
115 | 115 | ], |
116 | 116 | |
117 | 117 | PreferPHPUnitThisCallRector::class, |
@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | { |
136 | 136 | $container = new Container(); |
137 | 137 | |
138 | - try { |
|
138 | + try{ |
|
139 | 139 | $container->get('invalid'); |
140 | - } catch (ContainerException $e) { |
|
140 | + }catch (ContainerException $e){ |
|
141 | 141 | self::assertSame(<<<MARKDOWN |
142 | 142 | Can't resolve `invalid`: undefined class or binding `invalid`. |
143 | 143 | Container trace list: |
@@ -166,9 +166,9 @@ discard block |
||
166 | 166 | { |
167 | 167 | $this->expectException(ContainerException::class); |
168 | 168 | |
169 | - try { |
|
169 | + try{ |
|
170 | 170 | $container->get(ClassWithUndefinedDependency::class); |
171 | - } catch (ContainerException $e) { |
|
171 | + }catch (ContainerException $e){ |
|
172 | 172 | self::assertSame($message, $e->getMessage()); |
173 | 173 | |
174 | 174 | throw $e; |
@@ -135,9 +135,12 @@ discard block |
||
135 | 135 | { |
136 | 136 | $container = new Container(); |
137 | 137 | |
138 | - try { |
|
138 | + try |
|
139 | + { |
|
139 | 140 | $container->get('invalid'); |
140 | - } catch (ContainerException $e) { |
|
141 | + } |
|
142 | + catch (ContainerException $e) |
|
143 | + { |
|
141 | 144 | self::assertSame(<<<MARKDOWN |
142 | 145 | Can't resolve `invalid`: undefined class or binding `invalid`. |
143 | 146 | Container trace list: |
@@ -166,9 +169,12 @@ discard block |
||
166 | 169 | { |
167 | 170 | $this->expectException(ContainerException::class); |
168 | 171 | |
169 | - try { |
|
172 | + try |
|
173 | + { |
|
170 | 174 | $container->get(ClassWithUndefinedDependency::class); |
171 | - } catch (ContainerException $e) { |
|
175 | + } |
|
176 | + catch (ContainerException $e) |
|
177 | + { |
|
172 | 178 | self::assertSame($message, $e->getMessage()); |
173 | 179 | |
174 | 180 | throw $e; |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | |
33 | 33 | self::assertNull(ContainerScope::getContainer()); |
34 | 34 | |
35 | - try { |
|
35 | + try{ |
|
36 | 36 | self::assertTrue(ContainerScope::runScope($container, static function (): never { |
37 | 37 | throw new RuntimeException('exception'); |
38 | 38 | })); |
39 | - } catch (\Throwable $e) { |
|
39 | + }catch (\Throwable $e){ |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | self::assertInstanceOf(RuntimeException::class, $e); |
@@ -83,14 +83,14 @@ discard block |
||
83 | 83 | return $c->get('bucket')->getName() == 'b' && $c->has('other'); |
84 | 84 | })); |
85 | 85 | |
86 | - try { |
|
86 | + try{ |
|
87 | 87 | self::assertTrue($c->runScope([ |
88 | 88 | 'bucket' => new Bucket('b'), |
89 | 89 | 'other' => new SampleClass() |
90 | 90 | ], function () use ($c): void { |
91 | 91 | throw new RuntimeException('exception'); |
92 | 92 | })); |
93 | - } catch (\Throwable) { |
|
93 | + }catch (\Throwable){ |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | self::assertSame('a', $c->get('bucket')->getName()); |
@@ -32,11 +32,14 @@ discard block |
||
32 | 32 | |
33 | 33 | self::assertNull(ContainerScope::getContainer()); |
34 | 34 | |
35 | - try { |
|
35 | + try |
|
36 | + { |
|
36 | 37 | self::assertTrue(ContainerScope::runScope($container, static function (): never { |
37 | 38 | throw new RuntimeException('exception'); |
38 | 39 | })); |
39 | - } catch (\Throwable $e) { |
|
40 | + } |
|
41 | + catch (\Throwable $e) |
|
42 | + { |
|
40 | 43 | } |
41 | 44 | |
42 | 45 | self::assertInstanceOf(RuntimeException::class, $e); |
@@ -83,14 +86,17 @@ discard block |
||
83 | 86 | return $c->get('bucket')->getName() == 'b' && $c->has('other'); |
84 | 87 | })); |
85 | 88 | |
86 | - try { |
|
89 | + try |
|
90 | + { |
|
87 | 91 | self::assertTrue($c->runScope([ |
88 | 92 | 'bucket' => new Bucket('b'), |
89 | 93 | 'other' => new SampleClass() |
90 | 94 | ], function () use ($c): void { |
91 | 95 | throw new RuntimeException('exception'); |
92 | 96 | })); |
93 | - } catch (\Throwable) { |
|
97 | + } |
|
98 | + catch (\Throwable) |
|
99 | + { |
|
94 | 100 | } |
95 | 101 | |
96 | 102 | self::assertSame('a', $c->get('bucket')->getName()); |
@@ -135,7 +141,9 @@ discard block |
||
135 | 141 | public function testHasInstanceAfterMakeWithoutAliasInScope(): void |
136 | 142 | { |
137 | 143 | $container = new Container(); |
138 | - $container->bindSingleton('test', new #[Singleton] class {}); |
|
144 | + $container->bindSingleton('test', new #[Singleton] class |
|
145 | + { |
|
146 | +}); |
|
139 | 147 | $container->make('test'); |
140 | 148 | |
141 | 149 | $container->runScoped(function (Container $container): void { |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | $logger = $root->runScope( |
63 | 63 | new Scope('test'), |
64 | - static fn(?ScopeIndicatorLogger $logger): ?ScopeIndicatorLogger => $logger, |
|
64 | + static fn(?ScopeIndicatorLogger $logger) : ?ScopeIndicatorLogger => $logger, |
|
65 | 65 | ); |
66 | 66 | |
67 | 67 | self::assertNotNull($logger); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | $logger = $root->runScope( |
79 | 79 | new Scope('test'), |
80 | - static fn(?ScopeIndicatorLogger $logger): ?ScopeIndicatorLogger => $logger, |
|
80 | + static fn(?ScopeIndicatorLogger $logger) : ?ScopeIndicatorLogger => $logger, |
|
81 | 81 | ); |
82 | 82 | |
83 | 83 | self::assertNotNull($logger); |