Skip to content

Commit 2c9b189

Browse files
committed
cs
1 parent 14c466f commit 2c9b189

3 files changed

Lines changed: 6 additions & 9 deletions

File tree

src/Routing/Route.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public function match(Nette\Http\IRequest $httpRequest): ?array
176176

177177
} elseif ($this->type === self::Relative) {
178178
$basePath = $url->getBasePath();
179-
if (strncmp($url->getPath(), $basePath, strlen($basePath)) !== 0) {
179+
if (!str_starts_with($url->getPath(), $basePath)) {
180180
return null;
181181
}
182182

src/Routing/RouteList.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected function prepareRequest(Nette\Http\IRequest $httpRequest): ?Nette\Http
6868
if ($this->path) {
6969
$url = $httpRequest->getUrl();
7070
$relativePath = $url->getRelativePath();
71-
if (strncmp($relativePath, $this->path, strlen($this->path)) === 0) {
71+
if (str_starts_with($relativePath, $this->path)) {
7272
$url = $url->withPath($url->getPath(), $url->getBasePath() . $this->path);
7373
} elseif ($relativePath . '/' === $this->path) {
7474
$url = $url->withPath($url->getPath() . '/');
@@ -148,7 +148,7 @@ public function warmupCache(): void
148148
? $router->getConstantParameters()
149149
: [];
150150

151-
foreach (array_filter($params, 'is_scalar') as $name => $value) {
151+
foreach (array_filter($params, is_scalar(...)) as $name => $value) {
152152
$candidates[$name][$value] = true;
153153
}
154154

src/Routing/SimpleRouter.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,9 @@
1818
*/
1919
class SimpleRouter implements Router
2020
{
21-
private array $defaults;
22-
23-
24-
public function __construct(array $defaults = [])
25-
{
26-
$this->defaults = $defaults;
21+
public function __construct(
22+
private readonly array $defaults = [],
23+
) {
2724
}
2825

2926

0 commit comments

Comments
 (0)