Skip to content

Commit

Permalink
Fix for PHP 8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
devanych committed Dec 29, 2024
1 parent 00ddc62 commit 30137a0
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 5 deletions.
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
2 changes: 1 addition & 1 deletion src/MiddlewarePipeline.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class MiddlewarePipeline implements MiddlewarePipelineInterface
/**
* {@inheritDoc}
*/
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);

Check failure on line 29 in src/MiddlewarePipeline.php

View workflow job for this annotation

GitHub Actions / PHP 7.4-ubuntu-latest

RiskyTruthyFalsyComparison

src/MiddlewarePipeline.php:29:30: RiskyTruthyFalsyComparison: Operand of type null|string contains type string, which can be falsy and truthy. This can cause possibly unexpected behavior. Use strict comparison instead. (see https://psalm.dev/356)

Check failure on line 29 in src/MiddlewarePipeline.php

View workflow job for this annotation

GitHub Actions / PHP 8.3-ubuntu-latest

RiskyTruthyFalsyComparison

src/MiddlewarePipeline.php:29:30: RiskyTruthyFalsyComparison: Operand of type null|string contains type string, which can be falsy and truthy. This can cause possibly unexpected behavior. Use strict comparison instead. (see https://psalm.dev/356)

Check failure on line 29 in src/MiddlewarePipeline.php

View workflow job for this annotation

GitHub Actions / PHP 8.0-ubuntu-latest

RiskyTruthyFalsyComparison

src/MiddlewarePipeline.php:29:30: RiskyTruthyFalsyComparison: Operand of type null|string contains type string, which can be falsy and truthy. This can cause possibly unexpected behavior. Use strict comparison instead. (see https://psalm.dev/356)

Check failure on line 29 in src/MiddlewarePipeline.php

View workflow job for this annotation

GitHub Actions / PHP 8.1-ubuntu-latest

RiskyTruthyFalsyComparison

src/MiddlewarePipeline.php:29:30: RiskyTruthyFalsyComparison: Operand of type null|string contains type string, which can be falsy and truthy. This can cause possibly unexpected behavior. Use strict comparison instead. (see https://psalm.dev/356)

Check failure on line 29 in src/MiddlewarePipeline.php

View workflow job for this annotation

GitHub Actions / PHP 8.2-ubuntu-latest

RiskyTruthyFalsyComparison

src/MiddlewarePipeline.php:29:30: RiskyTruthyFalsyComparison: Operand of type null|string contains type string, which can be falsy and truthy. This can cause possibly unexpected behavior. Use strict comparison instead. (see https://psalm.dev/356)

Check failure on line 29 in src/MiddlewarePipeline.php

View workflow job for this annotation

GitHub Actions / PHP 8.3-ubuntu-latest

RiskyTruthyFalsyComparison

src/MiddlewarePipeline.php:29:30: RiskyTruthyFalsyComparison: Operand of type null|string contains type string, which can be falsy and truthy. This can cause possibly unexpected behavior. Use strict comparison instead. (see https://psalm.dev/356)
}
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

0 comments on commit 30137a0

Please sign in to comment.