Skip to content

Commit

Permalink
Merge pull request #48 from samsonasik/update-php81-syntax
Browse files Browse the repository at this point in the history
Update to use PHP 8.1 syntax
  • Loading branch information
gsteel authored Nov 3, 2024
2 parents fcbdaaa + cbca935 commit 282bac6
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/ServerUrlMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class ServerUrlMiddleware implements MiddlewareInterface
{
public function __construct(private ServerUrlHelper $helper)
public function __construct(private readonly ServerUrlHelper $helper)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/UrlHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class UrlHelper implements UrlHelperInterface

private ?ServerRequestInterface $request = null;

public function __construct(private RouterInterface $router)
public function __construct(private readonly RouterInterface $router)
{
}

Expand Down
4 changes: 2 additions & 2 deletions src/UrlHelperFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public static function __set_state(array $data): self
* @param string $basePath Base path for the URL helper
*/
public function __construct(
private string $basePath = '/',
private string $routerServiceName = RouterInterface::class
private readonly string $basePath = '/',
private readonly string $routerServiceName = RouterInterface::class
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/UrlHelperMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
class UrlHelperMiddleware implements MiddlewareInterface
{
public function __construct(private UrlHelperInterface $helper)
public function __construct(private readonly UrlHelperInterface $helper)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/UrlHelperMiddlewareFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static function __set_state(array $data): self
/**
* Allow varying behavior based on URL helper service name.
*/
public function __construct(private string $urlHelperServiceName = UrlHelper::class)
public function __construct(private readonly string $urlHelperServiceName = UrlHelper::class)
{
}

Expand Down
2 changes: 1 addition & 1 deletion test/RequestHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
final class RequestHandler implements RequestHandlerInterface
{
private ?ServerRequestInterface $received = null;
private ResponseInterface $defaultResponse;
private readonly ResponseInterface $defaultResponse;

public function __construct(
ResponseInterface|null $defaultResponse = null,
Expand Down

0 comments on commit 282bac6

Please sign in to comment.