Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for PHP 8.4 #3

Merged
merged 2 commits into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ jobs:
- "8.0"
- "8.1"
- "8.2"
- "8.3"
- "8.4"

steps:
- name: Checkout.
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
- "8.0"
- "8.1"
- "8.2"
- "8.3"

steps:
- name: Checkout.
Expand Down
7 changes: 4 additions & 3 deletions src/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public function match(ServerRequestInterface $request): bool
* @param array $parameters parameter-value set.
* @return string URL path generated.
* @throws InvalidRouteParameterException if the value does not match its regexp or the required parameter is null.
* @psalm-suppress MixedAssignment
* @psalm-suppress MixedAssignment, RiskyTruthyFalsyComparison
*/
public function path(array $parameters = []): string
{
Expand Down Expand Up @@ -335,9 +335,9 @@ public function path(array $parameters = []): string
* @param bool|null $secure if `true`, then `https`. If `false`, then `http`. If `null`, then without the protocol.
* @return string URL generated.
* @throws InvalidRouteParameterException If the host or the parameter value does not match its regexp.
* @psalm-suppress PossiblyNullArgument
* @psalm-suppress PossiblyNullArgument, RiskyTruthyFalsyComparison
*/
public function url(array $parameters = [], string $host = null, bool $secure = null): string
public function url(array $parameters = [], ?string $host = null, ?bool $secure = null): string
{
$path = $this->path($parameters);
$host = $host ? trim($host, '/') : null;
Expand Down Expand Up @@ -435,6 +435,7 @@ private function normalizeParameter($value, string $name, string $pattern, bool
*
* @param string $host
* @return bool
* @psalm-suppress RiskyTruthyFalsyComparison
*/
private function isMatchedHost(string $host): bool
{
Expand Down
2 changes: 1 addition & 1 deletion src/RouteCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function path(string $name, array $parameters = []): string
/**
* {@inheritDoc}
*/
public function url(string $name, array $parameters = [], string $host = null, bool $secure = null): string
public function url(string $name, array $parameters = [], ?string $host = null, ?bool $secure = null): string
{
$route = $this->get($name);
return $route->url($parameters, $host, $secure);
Expand Down
2 changes: 1 addition & 1 deletion src/RouteCollectionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,5 @@ public function path(string $name, array $parameters = []): string;
* @return string URL generated.
* @throws RouteNotFoundException if the route does not exist.
*/
public function url(string $name, array $parameters = [], string $host = null, bool $secure = null): string;
public function url(string $name, array $parameters = [], ?string $host = null, ?bool $secure = null): string;
}
2 changes: 1 addition & 1 deletion src/RouteCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final class RouteCollector
/**
* @param RouteCollectionInterface|null $routes
*/
public function __construct(RouteCollectionInterface $routes = null)
public function __construct(?RouteCollectionInterface $routes = null)
{
$this->routes = $routes ?? new RouteCollection();
}
Expand Down
Loading