Skip to content

Commit

Permalink
chore: phpstan and deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
soyuka committed Nov 14, 2023
1 parent b788c78 commit 6a127fc
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
1 change: 0 additions & 1 deletion features/main/not_exposed.feature
Expand Up @@ -171,7 +171,6 @@ Feature: Expose only a collection of objects
When I send a "GET" request to "<uri>"
Then the response status code should be 404
And the response should be in JSON
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
And the JSON node "hydra:description" should be equal to "<hydra:description>"
Examples:
| uri | hydra:description |
Expand Down
4 changes: 2 additions & 2 deletions src/ApiResource/Error.php
Expand Up @@ -65,9 +65,9 @@ public function __construct(
private ?string $instance = null,
private string $type = 'about:blank',
private array $headers = [],
private ?\Exception $previous = null
\Throwable $previous = null
) {
parent::__construct();
parent::__construct($title, $status, $previous);

if (!$originalTrace) {
return;
Expand Down
5 changes: 3 additions & 2 deletions src/Symfony/EventListener/ErrorListener.php
Expand Up @@ -142,7 +142,8 @@ protected function duplicateRequest(\Throwable $exception, Request $request): Re
$operation = $operation->withProvider([self::class, 'provide']);
}

if (!$this->debug && $operation->getStatus() >= 500) {
/** @var HttpOperation $operation */
if (!$this->debug && $operation->getStatus() >= 500 && $errorResource instanceof Error) {
$errorResource->setDetail('Internal Server Error');
}

Expand All @@ -159,7 +160,7 @@ protected function duplicateRequest(\Throwable $exception, Request $request): Re
]);
}

if ($apiOperation && 'jsonld' === $format && !($apiOperation?->getExtraProperties()['rfc_7807_compliant_errors'] ?? false)) {
if ($apiOperation && 'jsonld' === $format && !($apiOperation->getExtraProperties()['rfc_7807_compliant_errors'] ?? false)) {
$operation = $operation->withOutputFormats(['jsonld' => ['application/ld+json']])
->withLinks([])
->withExtraProperties(['rfc_7807_compliant_errors' => false] + $operation->getExtraProperties());
Expand Down
1 change: 0 additions & 1 deletion tests/Fixtures/TestBundle/Serializer/ErrorNormalizer.php
Expand Up @@ -46,7 +46,6 @@ public function hasCacheableSupportsMethod(): bool

public function getSupportedTypes(?string $format): array
{
// @phpstan-ignore-next-line
return $this->decorated->getSupportedTypes($format);
}
}
1 change: 1 addition & 0 deletions tests/Fixtures/app/AppKernel.php
Expand Up @@ -248,6 +248,7 @@ class_exists(NativePasswordHasher::class) ? 'password_hashers' : 'encoders' => [
$c->prependExtensionConfig('doctrine', [
'orm' => [
'report_fields_where_declared' => true,
'enable_lazy_ghost_objects' => true,
],
]);
}
Expand Down

0 comments on commit 6a127fc

Please sign in to comment.