Skip to content

Commit

Permalink
Update to use PHP 8.1 syntax
Browse files Browse the repository at this point in the history
Signed-off-by: Abdul Malik Ikhsan <[email protected]>
  • Loading branch information
samsonasik committed Nov 3, 2024
1 parent af45f05 commit 1fd6063
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/ProblemDetailsMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ProblemDetailsMiddleware implements MiddlewareInterface
/** @var list<callable(Throwable, RequestInterface, ResponseInterface): void> */
private array $listeners = [];

public function __construct(private ProblemDetailsResponseFactory $responseFactory)
public function __construct(private readonly ProblemDetailsResponseFactory $responseFactory)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/ProblemDetailsNotFoundHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ProblemDetailsNotFoundHandler implements MiddlewareInterface
* @param ProblemDetailsResponseFactory $responseFactory Factory to create a response to
* update and return when returning an 404 response.
*/
public function __construct(private ProblemDetailsResponseFactory $responseFactory)
public function __construct(private readonly ProblemDetailsResponseFactory $responseFactory)
{
}

Expand Down
10 changes: 5 additions & 5 deletions src/ProblemDetailsResponseFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,13 @@ class ProblemDetailsResponseFactory
* defaults to JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRESERVE_ZERO_FRACTION
* | JSON_PARTIAL_OUTPUT_ON_ERROR
*/
private int $jsonFlags;
private readonly int $jsonFlags;

/**
* Factory to use to generate prototype response used when generating a
* problem details response.
*/
private ResponseFactoryInterface $responseFactory;
private readonly ResponseFactoryInterface $responseFactory;

/**
* @param (callable():ResponseInterface)|ResponseFactoryInterface $responseFactory
Expand All @@ -191,21 +191,21 @@ public function __construct(
* and include full exception details and previous exceptions and their
* details.
*/
private bool $isDebug = self::EXCLUDE_THROWABLE_DETAILS,
private readonly bool $isDebug = self::EXCLUDE_THROWABLE_DETAILS,
?int $jsonFlags = null,
/**
* Flag to enable show exception details in detail field.
*
* Disabled by default for security reasons.
*/
private bool $exceptionDetailsInResponse = false,
private readonly bool $exceptionDetailsInResponse = false,
/**
* Default detail field value. Will be visible when
* $exceptionDetailsInResponse disabled.
*
* Empty string by default
*/
private string $defaultDetailMessage = self::DEFAULT_DETAIL_MESSAGE,
private readonly string $defaultDetailMessage = self::DEFAULT_DETAIL_MESSAGE,
/**
* A map used to infer the "type" property based on the status code.
*
Expand Down

0 comments on commit 1fd6063

Please sign in to comment.