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 #4

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
3 changes: 2 additions & 1 deletion src/MiddlewarePipeline.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ final class MiddlewarePipeline implements MiddlewarePipelineInterface

/**
* {@inheritDoc}
* @psalm-suppress RiskyTruthyFalsyComparison
*/
public function pipe(MiddlewareInterface $middleware, string $pathPrefix = null): void
public function pipe(MiddlewareInterface $middleware, ?string $pathPrefix = null): void
{
$this->pipeline[] = (!$pathPrefix || $pathPrefix === '/') ? $middleware : $this->path($pathPrefix, $middleware);
}
Expand Down
2 changes: 1 addition & 1 deletion src/MiddlewarePipelineInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ interface MiddlewarePipelineInterface extends MiddlewareInterface, RequestHandle
* @param MiddlewareInterface $middleware
* @param string|null $pathPrefix path prefix from the root to which the middleware is attached.
*/
public function pipe(MiddlewareInterface $middleware, string $pathPrefix = null): void;
public function pipe(MiddlewareInterface $middleware, ?string $pathPrefix = null): void;
}
2 changes: 1 addition & 1 deletion src/MiddlewareResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class MiddlewareResolver implements MiddlewareResolverInterface
/**
* @param ContainerInterface|null $container
*/
public function __construct(ContainerInterface $container = null)
public function __construct(?ContainerInterface $container = null)
{
$this->container = $container;
}
Expand Down
4 changes: 2 additions & 2 deletions src/ServerRequestRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class ServerRequestRunner
* @param MiddlewarePipelineInterface|null $pipeline
* @param EmitterInterface|null $emitter
*/
public function __construct(MiddlewarePipelineInterface $pipeline = null, EmitterInterface $emitter = null)
public function __construct(?MiddlewarePipelineInterface $pipeline = null, ?EmitterInterface $emitter = null)
{
$this->pipeline = $pipeline ?? new MiddlewarePipeline();
$this->emitter = $emitter ?? new SapiEmitter();
Expand All @@ -44,7 +44,7 @@ public function __construct(MiddlewarePipelineInterface $pipeline = null, Emitte
* @param RequestHandlerInterface|null $defaultHandler
* @psalm-suppress RedundantCast
*/
public function run(ServerRequestInterface $request, RequestHandlerInterface $defaultHandler = null): void
public function run(ServerRequestInterface $request, ?RequestHandlerInterface $defaultHandler = null): void
{
$response = ($defaultHandler === null)
? $this->pipeline->handle($request)
Expand Down
Loading