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

Update to use PHP 8.1 syntax #48

Merged
merged 1 commit into from
Nov 3, 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: 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