Skip to content

Commit a7b3cbc

Browse files
committed
style: apply fixes from qa
1 parent 2aefd86 commit a7b3cbc

File tree

6 files changed

+6
-10
lines changed

6 files changed

+6
-10
lines changed

packages/core/src/functions.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@
77
use Stringable;
88
use Tempest\Core\Composer;
99
use Tempest\Core\DeferredTasks;
10-
use Tempest\Core\Exceptions\ExceptionProcessor;
1110
use Tempest\Core\Kernel;
1211
use Tempest\Support\Namespace\PathCouldNotBeMappedToNamespace;
13-
use Throwable;
1412

1513
use function Tempest\Support\Namespace\to_psr4_namespace;
1614
use function Tempest\Support\Path\to_absolute_path;

packages/router/src/ExceptionRendererDiscovery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function discover(DiscoveryLocation $location, ClassReflector $class): vo
2525
return;
2626
}
2727

28-
$priority = $class->getAttribute(Priority::class)?->priority ?? Priority::NORMAL;
28+
$priority = $class->getAttribute(Priority::class)->priority ?? Priority::NORMAL;
2929

3030
$this->discoveryItems->add($location, [$class->getName(), $priority]);
3131
}

packages/router/src/Exceptions/HtmlExceptionRenderer.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use Tempest\Container\Container;
77
use Tempest\Core\AppConfig;
88
use Tempest\Core\Priority;
9-
use Tempest\Discovery\SkipDiscovery;
109
use Tempest\Http\ContentType;
1110
use Tempest\Http\GenericResponse;
1211
use Tempest\Http\HttpRequestFailed;

src/Tempest/Framework/Testing/Http/HttpRouterTester.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ private function createHeaders(array $headers = []): array
183183
callback: fn (mixed $_, string $headerKey): bool => strcasecmp($headerKey, 'accept') === 0,
184184
);
185185

186-
if ($this->contentType) {
186+
if ($this->contentType !== null) {
187187
$headers[$key ?? 'accept'] = $this->contentType->value;
188188
}
189189

src/Tempest/Framework/Testing/Http/TestResponseHelper.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
use Tempest\Support\Arr;
2121
use Tempest\Support\Json;
2222
use Tempest\Validation\Rule;
23-
use Tempest\Validation\Validator;
2423
use Tempest\View\View;
2524
use Tempest\View\ViewRenderer;
2625

tests/Integration/Router/ExceptionRendererTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function custom_json_exception_renderer(): void
9393
fn () => new GenericRequest(Method::GET, '/test', headers: ['Accept' => 'application/json']),
9494
);
9595

96-
$this->callExceptionHandler(function () {
96+
$this->callExceptionHandler(function (): void {
9797
$handler = $this->container->get(HttpExceptionHandler::class);
9898
$handler->handle(new CustomValidationException('Custom validation failed'));
9999
});
@@ -117,7 +117,7 @@ public function custom_html_exception_renderer(): void
117117
fn () => new GenericRequest(Method::GET, '/test', headers: ['Accept' => 'text/html']),
118118
);
119119

120-
$this->callExceptionHandler(function () {
120+
$this->callExceptionHandler(function (): void {
121121
$handler = $this->container->get(HttpExceptionHandler::class);
122122
$handler->handle(new CustomValidationException('Custom validation failed'));
123123
});
@@ -138,7 +138,7 @@ public function falls_back_to_default_renderer_when_no_custom_match(): void
138138
fn () => new GenericRequest(Method::GET, '/test', headers: ['Accept' => 'application/json']),
139139
);
140140

141-
$this->callExceptionHandler(function () {
141+
$this->callExceptionHandler(function (): void {
142142
$handler = $this->container->get(HttpExceptionHandler::class);
143143
$handler->handle(new Exception('Regular exception'));
144144
});
@@ -160,7 +160,7 @@ public function priority_ordering(): void
160160
fn () => new GenericRequest(Method::GET, '/test', headers: ['Accept' => 'application/json']),
161161
);
162162

163-
$this->callExceptionHandler(function () {
163+
$this->callExceptionHandler(function (): void {
164164
$handler = $this->container->get(HttpExceptionHandler::class);
165165
$handler->handle(new CustomValidationException('Test'));
166166
});

0 commit comments

Comments
 (0)