Skip to content

Commit

Permalink
Fix PHP 8.4 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
odan committed Dec 1, 2024
1 parent eed5575 commit 00dad50
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Slim/Routing/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final class Route implements MiddlewareCollectionInterface
/**
* @param array<string> $methods
*/
public function __construct(array $methods, string $pattern, callable|string $handler, RouteGroup $group = null)
public function __construct(array $methods, string $pattern, callable|string $handler, ?RouteGroup $group)
{
$this->methods = $methods;
$this->pattern = $pattern;
Expand Down
2 changes: 1 addition & 1 deletion Slim/Routing/RouteGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final class RouteGroup implements MiddlewareCollectionInterface, RouteCollection

private ?RouteGroup $group;

public function __construct(string $prefix, callable $callback, Router $router, RouteGroup $group = null)
public function __construct(string $prefix, callable $callback, Router $router, ?RouteGroup $group)
{
$this->prefix = sprintf('/%s', ltrim($prefix, '/'));
$this->callback = $callback;
Expand Down
4 changes: 2 additions & 2 deletions Slim/Routing/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function map(array $methods, string $path, callable|string $handler): Rou
}

$routePattern = $this->normalizePath($path);
$route = new Route($methods, $routePattern, $handler);
$route = new Route($methods, $routePattern, $handler, null);

$this->collector->addRoute($methods, $routePattern, $route);

Expand All @@ -42,7 +42,7 @@ public function map(array $methods, string $path, callable|string $handler): Rou
public function group(string $path, callable $handler): RouteGroup
{
$routePattern = $this->normalizePath($path);
$routeGroup = new RouteGroup($routePattern, $handler, $this);
$routeGroup = new RouteGroup($routePattern, $handler, $this, null);
$this->collector->addGroup($routePattern, $routeGroup);

return $routeGroup;
Expand Down

0 comments on commit 00dad50

Please sign in to comment.