Passed
Push — master ( f5a1ef...a14569 )
by butschster
29:16 queued 19:38
created
src/Router/src/Loader/Configurator/RouteConfigurator.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
         private readonly string $name,
36 36
         private readonly string $pattern,
37 37
         private readonly RouteCollection $collection
38
-    ) {
38
+    ){
39 39
     }
40 40
 
41 41
     public function __destruct()
42 42
     {
43
-        if ($this->target === null) {
43
+        if ($this->target === null){
44 44
             throw new TargetException(
45 45
                 \sprintf('The [%s] route has no defined target. Call one of: `controller`, `action`,
46 46
                     `namespaced`, `groupControllers`, `callable`, `handler` methods.', $this->name)
@@ -91,21 +91,21 @@  discard block
 block discarded – undo
91 91
         return $this;
92 92
     }
93 93
 
94
-    public function action(string $controller, string|array $action, int $options = 0): self
94
+    public function action(string $controller, string | array $action, int $options = 0): self
95 95
     {
96 96
         $this->target = new Action($controller, $action, $options);
97 97
 
98 98
         return $this;
99 99
     }
100 100
 
101
-    public function callable(array|\Closure $callable): self
101
+    public function callable(array | \Closure $callable): self
102 102
     {
103 103
         $this->target = $callable;
104 104
 
105 105
         return $this;
106 106
     }
107 107
 
108
-    public function handler(TargetInterface|string $target): self
108
+    public function handler(TargetInterface | string $target): self
109 109
     {
110 110
         $this->target = $target;
111 111
 
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
         return $this;
141 141
     }
142 142
 
143
-    public function middleware(MiddlewareInterface|string|array $middleware): self
143
+    public function middleware(MiddlewareInterface | string | array $middleware): self
144 144
     {
145
-        if (!\is_array($middleware)) {
145
+        if (!\is_array($middleware)){
146 146
             $middleware = [$middleware];
147 147
         }
148 148
 
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
         return $this;
152 152
     }
153 153
 
154
-    public function methods(string|array $methods): self
154
+    public function methods(string | array $methods): self
155 155
     {
156
-        $this->methods = (array) $methods;
156
+        $this->methods = (array)$methods;
157 157
 
158 158
         return $this;
159 159
     }
Please login to merge, or discard this patch.
src/Router/src/Loader/DelegatingLoader.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,12 +10,12 @@
 block discarded – undo
10 10
 {
11 11
     public function __construct(
12 12
         private readonly LoaderRegistryInterface $registry
13
-    ) {
13
+    ){
14 14
     }
15 15
 
16 16
     public function load(mixed $resource, string $type = null): mixed
17 17
     {
18
-        if (false === $loader = $this->registry->resolve($resource, $type)) {
18
+        if (false === $loader = $this->registry->resolve($resource, $type)){
19 19
             throw new LoaderLoadException(\sprintf('Loader for type [%s] not found.', $type ?? ''));
20 20
         }
21 21
 
Please login to merge, or discard this patch.
src/Router/src/AbstractRoute.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     public function __construct(
32 32
         protected string $pattern,
33 33
         array $defaults = []
34
-    ) {
34
+    ){
35 35
         $this->defaults = $defaults;
36 36
     }
37 37
 
@@ -56,12 +56,12 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function match(Request $request): ?static
58 58
     {
59
-        if (!\in_array(\strtoupper($request->getMethod()), $this->getVerbs(), true)) {
59
+        if (!\in_array(\strtoupper($request->getMethod()), $this->getVerbs(), true)){
60 60
             return null;
61 61
         }
62 62
 
63 63
         $matches = $this->uriHandler->match($request->getUri(), $this->defaults);
64
-        if ($matches === null) {
64
+        if ($matches === null){
65 65
             return null;
66 66
         }
67 67
 
Please login to merge, or discard this patch.
src/Router/src/Router.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
68 68
         return $this->tracer->trace(
69 69
             name: 'Routing',
70 70
             callback: function (SpanInterface $span) use ($request) {
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,29 +141,29 @@  discard block
 block discarded – undo
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
 
150 150
             $route = new Route(\ltrim($configurator->pattern, '/'), $target, $configurator->defaults);
151 151
 
152
-            if ($configurator->middleware !== null) {
152
+            if ($configurator->middleware !== null){
153 153
                 $route = $route->withMiddleware(...$configurator->middleware);
154 154
             }
155 155
 
156
-            if ($configurator->methods !== null) {
156
+            if ($configurator->methods !== null){
157 157
                 $route = $route->withVerbs(...$configurator->methods);
158 158
             }
159 159
 
160
-            if (!isset($this->routes[$name]) && $name !== RoutingConfigurator::DEFAULT_ROUTE_NAME) {
160
+            if (!isset($this->routes[$name]) && $name !== RoutingConfigurator::DEFAULT_ROUTE_NAME){
161 161
                 $group = $groups->getGroup($configurator->group ?? $groups->getDefaultGroup());
162 162
                 $group->setPrefix($configurator->prefix);
163 163
                 $group->addRoute($name, $route);
164 164
             }
165 165
 
166
-            if ($name === RoutingConfigurator::DEFAULT_ROUTE_NAME) {
166
+            if ($name === RoutingConfigurator::DEFAULT_ROUTE_NAME){
167 167
                 $this->setDefault($route);
168 168
             }
169 169
         }
@@ -174,17 +174,17 @@  discard block
 block discarded – undo
174 174
      */
175 175
     protected function matchRoute(ServerRequestInterface $request, string &$routeName = null): ?RouteInterface
176 176
     {
177
-        foreach ($this->routes as $name => $route) {
177
+        foreach ($this->routes as $name => $route){
178 178
             // Matched route will return new route instance with matched parameters
179 179
             $matched = $route->match($request);
180 180
 
181
-            if ($matched !== null) {
181
+            if ($matched !== null){
182 182
                 $routeName = $name;
183 183
                 return $matched;
184 184
             }
185 185
         }
186 186
 
187
-        if ($this->default !== null) {
187
+        if ($this->default !== null){
188 188
             return $this->default->match($request);
189 189
         }
190 190
 
@@ -197,14 +197,14 @@  discard block
 block discarded – undo
197 197
      */
198 198
     protected function configure(RouteInterface $route): RouteInterface
199 199
     {
200
-        if ($route instanceof ContainerizedInterface && !$route->hasContainer()) {
200
+        if ($route instanceof ContainerizedInterface && !$route->hasContainer()){
201 201
             // isolating route in a given container
202 202
             $route = $route->withContainer($this->container);
203 203
         }
204 204
 
205
-        try {
205
+        try{
206 206
             $uriHandler = $route->getUriHandler();
207
-        } catch (\Throwable) {
207
+        }catch (\Throwable){
208 208
             $uriHandler = $this->uriHandler;
209 209
         }
210 210
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
                 $route,
228 228
                 $matches
229 229
             )
230
-        ) {
230
+        ){
231 231
             throw new UndefinedRouteException(
232 232
                 "Unable to locate route or use default route with 'name/controller:action' pattern"
233 233
             );
@@ -236,11 +236,11 @@  discard block
 block discarded – undo
236 236
         /**
237 237
          * @var Matches $matches
238 238
          */
239
-        if (!empty($matches['name'])) {
239
+        if (!empty($matches['name'])){
240 240
             $routeObject = $this->getRoute($matches['name']);
241
-        } elseif ($this->default !== null) {
241
+        } elseif ($this->default !== null){
242 242
             $routeObject = $this->default;
243
-        } else {
243
+        }else{
244 244
             throw new UndefinedRouteException(\sprintf('Unable to locate route candidate for `%s`', $route));
245 245
         }
246 246
 
Please login to merge, or discard this patch.
src/Router/src/Route.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public function __construct(
52 52
         string $pattern,
53
-        string|callable|RequestHandlerInterface|TargetInterface $target,
53
+        string | callable | RequestHandlerInterface | TargetInterface $target,
54 54
         array $defaults = []
55
-    ) {
55
+    ){
56 56
         parent::__construct(
57 57
             $pattern,
58 58
             $target instanceof TargetInterface
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      */
69 69
     public function withUriHandler(UriHandler $uriHandler): static
70 70
     {
71
-        if ($this->target instanceof TargetInterface) {
71
+        if ($this->target instanceof TargetInterface){
72 72
             $uriHandler = $uriHandler->withConstrains(
73 73
                 $this->target->getConstrains(),
74 74
                 $this->defaults,
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         $route = clone $this;
87 87
         $route->container = $container;
88 88
 
89
-        if ($route->target instanceof TargetInterface) {
89
+        if ($route->target instanceof TargetInterface){
90 90
             $route->target = clone $route->target;
91 91
         }
92 92
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      */
114 114
     public function handle(ServerRequestInterface $request): ResponseInterface
115 115
     {
116
-        if (empty($this->requestHandler)) {
116
+        if (empty($this->requestHandler)){
117 117
             $this->requestHandler = $this->requestHandler();
118 118
         }
119 119
 
@@ -129,29 +129,29 @@  discard block
 block discarded – undo
129 129
      */
130 130
     protected function requestHandler(): RequestHandlerInterface
131 131
     {
132
-        if (!$this->hasContainer()) {
132
+        if (!$this->hasContainer()){
133 133
             throw new RouteException('Unable to configure route pipeline without associated container');
134 134
         }
135 135
 
136
-        if ($this->target instanceof TargetInterface) {
137
-            try {
136
+        if ($this->target instanceof TargetInterface){
137
+            try{
138 138
                 \assert($this->matches !== null);
139 139
                 return $this->target->getHandler($this->container, $this->matches);
140
-            } catch (TargetException $e) {
140
+            }catch (TargetException $e){
141 141
                 throw new RouteException('Invalid target resolution', $e->getCode(), $e);
142 142
             }
143 143
         }
144 144
 
145
-        if ($this->target instanceof RequestHandlerInterface) {
145
+        if ($this->target instanceof RequestHandlerInterface){
146 146
             return $this->target;
147 147
         }
148 148
 
149
-        try {
149
+        try{
150 150
             $target = \is_string($this->target)
151 151
                 ? $this->container->get($this->target)
152 152
                 : $this->target;
153 153
 
154
-            if ($target instanceof RequestHandlerInterface) {
154
+            if ($target instanceof RequestHandlerInterface){
155 155
                 return $target;
156 156
             }
157 157
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
                 $target,
160 160
                 $this->container->get(ResponseFactoryInterface::class)
161 161
             );
162
-        } catch (ContainerExceptionInterface $e) {
162
+        }catch (ContainerExceptionInterface $e){
163 163
             throw new RouteException($e->getMessage(), $e->getCode(), $e);
164 164
         }
165 165
     }
Please login to merge, or discard this patch.
src/Router/src/Traits/PipelineTrait.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
         $route = clone $this;
44 44
 
45 45
         // array fallback
46
-        if (\count($middleware) === 1 && \is_array($middleware[0])) {
46
+        if (\count($middleware) === 1 && \is_array($middleware[0])){
47 47
             $middleware = $middleware[0];
48 48
         }
49 49
 
50 50
         /** @var MiddlewareType[] $middleware */
51
-        foreach ($middleware as $item) {
51
+        foreach ($middleware as $item){
52 52
             $route->middleware[] = $item;
53 53
         }
54 54
 
55
-        if ($route->pipeline !== null) {
55
+        if ($route->pipeline !== null){
56 56
             $route->pipeline = $route->makePipeline();
57 57
         }
58 58
 
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
     protected function makePipeline(): Pipeline
78 78
     {
79 79
         \assert($this->container !== null);
80
-        try {
80
+        try{
81 81
             return $this->container
82 82
                 ->get(PipelineFactory::class)
83 83
                 ->createWithMiddleware($this->middleware);
84
-        } catch (ContainerExceptionInterface $e) {
84
+        }catch (ContainerExceptionInterface $e){
85 85
             throw new RouteException($e->getMessage(), $e->getCode(), $e);
86 86
         }
87 87
     }
Please login to merge, or discard this patch.
src/Router/src/Registry/DefaultPatternRegistry.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@
 block discarded – undo
17 17
      * @param non-empty-string $name
18 18
      * @param non-empty-string|\Stringable $pattern
19 19
      */
20
-    public function register(string $name, string|\Stringable $pattern): void
20
+    public function register(string $name, string | \Stringable $pattern): void
21 21
     {
22
-        $pattern = (string) $pattern;
22
+        $pattern = (string)$pattern;
23 23
         \assert($pattern !== '');
24 24
         $this->patterns[$name] = $pattern;
25 25
     }
Please login to merge, or discard this patch.
src/Router/src/RouteGroup.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     /** @var array<MiddlewareType> */
28 28
     private array $middleware = [];
29 29
 
30
-    private Autowire|CoreInterface|string|null $core = null;
30
+    private Autowire | CoreInterface | string | null $core = null;
31 31
 
32 32
     public function __construct(
33 33
         /** @deprecated since v3.3.0 */
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         private readonly ?RouterInterface $router = null,
37 37
         /** @deprecated since v3.3.0 */
38 38
         private readonly ?UriHandler $handler = null
39
-    ) {
39
+    ){
40 40
     }
41 41
 
42 42
     /**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         return $this;
68 68
     }
69 69
 
70
-    public function setCore(Autowire|CoreInterface|string $core): self
70
+    public function setCore(Autowire | CoreInterface | string $core): self
71 71
     {
72 72
         $this->core = $core;
73 73
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     /**
78 78
      * @param MiddlewareType $middleware
79 79
      */
80
-    public function addMiddleware(MiddlewareInterface|Autowire|string $middleware): self
80
+    public function addMiddleware(MiddlewareInterface | Autowire | string $middleware): self
81 81
     {
82 82
         $this->middleware[] = $middleware;
83 83
 
@@ -91,21 +91,21 @@  discard block
 block discarded – undo
91 91
      */
92 92
     public function register(RouterInterface $router, FactoryInterface $factory): void
93 93
     {
94
-        foreach ($this->routes as $name => $route) {
95
-            if ($this->core !== null) {
96
-                if (!$this->core instanceof CoreInterface) {
94
+        foreach ($this->routes as $name => $route){
95
+            if ($this->core !== null){
96
+                if (!$this->core instanceof CoreInterface){
97 97
                     $this->core = $factory->make($this->core);
98 98
                 }
99 99
 
100 100
                 $target = $route->getTarget();
101
-                if ($target instanceof AbstractTarget) {
101
+                if ($target instanceof AbstractTarget){
102 102
                     $route = $route->withTarget($target->withCore($this->core));
103 103
                 }
104 104
             }
105 105
 
106
-            try {
106
+            try{
107 107
                 $uriHandler = $route->getUriHandler();
108
-            } catch (\Throwable) {
108
+            }catch (\Throwable){
109 109
                 $uriHandler = $factory->make(UriHandler::class);
110 110
             }
111 111
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
     {
130 130
         \assert($route instanceof Route);
131 131
 
132
-        $this->routes[$this->namePrefix . $name] = $route;
132
+        $this->routes[$this->namePrefix.$name] = $route;
133 133
 
134 134
         return $this;
135 135
     }
Please login to merge, or discard this patch.
src/Router/src/UriHandler.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         private readonly UriFactoryInterface $uriFactory,
54 54
         SlugifyInterface $slugify = null,
55 55
         ?RoutePatternRegistryInterface $patternRegistry = null,
56
-    ) {
56
+    ){
57 57
         $this->patternRegistry = $patternRegistry ?? new DefaultPatternRegistry();
58 58
         $this->slugify = $slugify ?? new Slugify();
59 59
     }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      */
104 104
     public function withBasePath(string $basePath): self
105 105
     {
106
-        if (!\str_ends_with($basePath, '/')) {
106
+        if (!\str_ends_with($basePath, '/')){
107 107
             $basePath .= '/';
108 108
         }
109 109
 
@@ -154,12 +154,12 @@  discard block
 block discarded – undo
154 154
      */
155 155
     public function match(UriInterface $uri, array $defaults): ?array
156 156
     {
157
-        if (!$this->isCompiled()) {
157
+        if (!$this->isCompiled()){
158 158
             $this->compile();
159 159
         }
160 160
 
161 161
         $matches = [];
162
-        if (!\preg_match($this->compiled, $this->fetchTarget($uri), $matches)) {
162
+        if (!\preg_match($this->compiled, $this->fetchTarget($uri), $matches)){
163 163
             return null;
164 164
         }
165 165
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
      */
177 177
     public function uri(iterable $parameters = [], array $defaults = []): UriInterface
178 178
     {
179
-        if (!$this->isCompiled()) {
179
+        if (!$this->isCompiled()){
180 180
             $this->compile();
181 181
         }
182 182
 
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
             $this->fetchOptions($parameters, $query)
187 187
         );
188 188
 
189
-        foreach ($this->constrains as $key => $_) {
190
-            if (empty($parameters[$key])) {
189
+        foreach ($this->constrains as $key => $_){
190
+            if (empty($parameters[$key])){
191 191
                 throw new UriHandlerException(\sprintf('Unable to generate Uri, parameter `%s` is missing', $key));
192 192
             }
193 193
         }
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         $path = $this->interpolate($this->template, $parameters);
197 197
 
198 198
         //Uri with added base path and prefix
199
-        $uri = $this->uriFactory->createUri(($this->matchHost ? '' : $this->basePath) . \trim($path, '/'));
199
+        $uri = $this->uriFactory->createUri(($this->matchHost ? '' : $this->basePath).\trim($path, '/'));
200 200
 
201 201
         return empty($query) ? $uri : $uri->withQuery(\http_build_query($query));
202 202
     }
@@ -211,18 +211,18 @@  discard block
 block discarded – undo
211 211
         $allowed = \array_keys($this->options);
212 212
 
213 213
         $result = [];
214
-        foreach ($parameters as $key => $parameter) {
215
-            if (\is_int($key) && isset($allowed[$key])) {
214
+        foreach ($parameters as $key => $parameter){
215
+            if (\is_int($key) && isset($allowed[$key])){
216 216
                 // this segment fetched keys from given parameters either by name or by position
217 217
                 $key = $allowed[$key];
218
-            } elseif (!\array_key_exists($key, $this->options) && \is_array($parameters)) {
218
+            } elseif (!\array_key_exists($key, $this->options) && \is_array($parameters)){
219 219
                 // all additional parameters given in array form can be glued to query string
220 220
                 $query[$key] = $parameter;
221 221
                 continue;
222 222
             }
223 223
 
224 224
             //String must be normalized here
225
-            if (\is_string($parameter) && !\preg_match('/^[a-z\-_0-9]+$/i', $parameter)) {
225
+            if (\is_string($parameter) && !\preg_match('/^[a-z\-_0-9]+$/i', $parameter)){
226 226
                 $result[$key] = $this->slugify->slugify($parameter);
227 227
                 continue;
228 228
             }
@@ -240,15 +240,15 @@  discard block
 block discarded – undo
240 240
     {
241 241
         $path = $uri->getPath();
242 242
 
243
-        if (empty($path) || $path[0] !== '/') {
244
-            $path = '/' . $path;
243
+        if (empty($path) || $path[0] !== '/'){
244
+            $path = '/'.$path;
245 245
         }
246 246
 
247
-        if ($this->matchHost) {
248
-            $uriString = $uri->getHost() . $path;
249
-        } else {
247
+        if ($this->matchHost){
248
+            $uriString = $uri->getHost().$path;
249
+        }else{
250 250
             $uriString = \substr($path, \strlen($this->basePath));
251
-            if ($uriString === false) {
251
+            if ($uriString === false){
252 252
                 $uriString = '';
253 253
             }
254 254
         }
@@ -264,23 +264,23 @@  discard block
 block discarded – undo
264 264
      */
265 265
     private function compile(): void
266 266
     {
267
-        if ($this->pattern === null) {
267
+        if ($this->pattern === null){
268 268
             throw new UriHandlerException('Unable to compile UriHandler, pattern is not set');
269 269
         }
270 270
 
271 271
         $options = [];
272 272
         $replaces = [];
273
-        $pattern = \rtrim(\ltrim($this->getPrefix() . '/' . $this->pattern, ':/'), '/');
273
+        $pattern = \rtrim(\ltrim($this->getPrefix().'/'.$this->pattern, ':/'), '/');
274 274
 
275 275
         // correct [/ first occurrence]
276
-        if (\str_starts_with($pattern, '[/')) {
277
-            $pattern = '[' . \substr($pattern, 2);
276
+        if (\str_starts_with($pattern, '[/')){
277
+            $pattern = '['.\substr($pattern, 2);
278 278
         }
279 279
 
280
-        if (\preg_match_all('/<(\w+):?(.*?)?>/', $pattern, $matches)) {
280
+        if (\preg_match_all('/<(\w+):?(.*?)?>/', $pattern, $matches)){
281 281
             $variables = \array_combine($matches[1], $matches[2]);
282 282
 
283
-            foreach ($variables as $key => $segment) {
283
+            foreach ($variables as $key => $segment){
284 284
                 $segment = $this->prepareSegment($key, $segment);
285 285
                 $replaces[\sprintf('<%s>', $key)] = \sprintf('(?P<%s>%s)', $key, $segment);
286 286
                 $options[] = $key;
@@ -290,13 +290,13 @@  discard block
 block discarded – undo
290 290
         $template = \preg_replace('/<(\w+):?.*?>/', '<\1>', $pattern);
291 291
         $options = \array_fill_keys($options, null);
292 292
 
293
-        foreach ($this->constrains as $key => $value) {
294
-            if ($value instanceof Autofill) {
293
+        foreach ($this->constrains as $key => $value){
294
+            if ($value instanceof Autofill){
295 295
                 // only forces value replacement, not required to be presented as parameter
296 296
                 continue;
297 297
             }
298 298
 
299
-            if (!\array_key_exists($key, $options) && !isset($this->defaults[$key])) {
299
+            if (!\array_key_exists($key, $options) && !isset($this->defaults[$key])){
300 300
                 throw new ConstrainException(
301 301
                     \sprintf(
302 302
                         'Route `%s` does not define routing parameter `<%s>`.',
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
             }
308 308
         }
309 309
 
310
-        $this->compiled = '/^' . \strtr($template, $replaces + self::PATTERN_REPLACES) . '$/iu';
310
+        $this->compiled = '/^'.\strtr($template, $replaces + self::PATTERN_REPLACES).'$/iu';
311 311
         $this->template = \stripslashes(\str_replace('?', '', $template));
312 312
         $this->options = $options;
313 313
     }
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
     private function interpolate(string $string, array $values): string
319 319
     {
320 320
         $replaces = [];
321
-        foreach ($values as $key => $value) {
321
+        foreach ($values as $key => $value){
322 322
             $replaces[\sprintf('<%s>', $key)] = match (true) {
323 323
                 $value instanceof \Stringable || \is_scalar($value) => (string)$value,
324 324
                 default => '',
Please login to merge, or discard this patch.