Skip to content

Commit 5949729

Browse files
authored
refactor(core): remove unnecessary set hook from Kernel interface (#959)
1 parent d80bfa9 commit 5949729

File tree

8 files changed

+14
-7
lines changed

8 files changed

+14
-7
lines changed

src/Tempest/Core/src/FrameworkKernel.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ public function loadEnv(): self
105105
public function registerKernel(): self
106106
{
107107
$this->container->singleton(Kernel::class, $this);
108+
$this->container->singleton(self::class, $this);
108109

109110
return $this;
110111
}

src/Tempest/Core/src/Kernel.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ interface Kernel
2828

2929
public string $internalStorage {
3030
get;
31-
set;
3231
}
3332

3433
public array $discoveryLocations {

src/Tempest/Support/tests/Arr/ToArrayTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ public function test_regular_object_is_wrapped(): void
126126
{
127127
$object = new class () {
128128
public $foo = 'bar';
129+
129130
public $baz = 42;
130-
private $hidden = 'secret'; // @phpstan-ignore-line not used on purpose
131131
};
132132

133133
$this->assertEquals([$object], to_array($object));

src/Tempest/View/src/Renderers/TempestViewCompiler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ private function parseDom(string $template): NodeList
127127
);
128128

129129
// If we have head nodes and a head tag, we inject them back
130-
if ($headElement = $dom->getElementsByTagName('head')->item(0)) {
130+
if (($headElement = $dom->getElementsByTagName('head')->item(0)) !== null) {
131131
foreach ($headNodes as $headNode) {
132132
$headElement->appendChild($dom->importNode($headNode, deep: true));
133133
}

tests/Fixtures/Controllers/JsonController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
final class JsonController
1010
{
1111
#[Post('/json-endpoint')]
12-
public function __invoke(Request $request)
12+
public function __invoke(Request $request): \Tempest\Router\Responses\Ok
1313
{
1414
return new Ok($request->get('title'));
1515
}

tests/Integration/Auth/AuthorizerTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Tempest\Auth\Install\CreateUsersTable;
1111
use Tempest\Auth\Install\User;
1212
use Tempest\Clock\Clock;
13+
use Tempest\Core\FrameworkKernel;
1314
use Tempest\Core\Kernel;
1415
use Tempest\Database\Migrations\CreateMigrationsTable;
1516
use Tempest\Filesystem\LocalFilesystem;
@@ -27,6 +28,7 @@
2728
final class AuthorizerTest extends FrameworkIntegrationTestCase
2829
{
2930
private string $path = __DIR__ . '/Fixtures/tmp';
31+
3032
private LocalFilesystem $filesystem;
3133

3234
protected function setUp(): void
@@ -45,7 +47,7 @@ protected function setUp(): void
4547
$this->filesystem->deleteDirectory($this->path, recursive: true);
4648
$this->filesystem->ensureDirectoryExists($this->path);
4749

48-
$this->container->get(Kernel::class)->internalStorage = realpath($this->path);
50+
$this->container->get(FrameworkKernel::class)->internalStorage = realpath($this->path);
4951

5052
$this->container->config(new SessionConfig(path: 'sessions'));
5153
$this->container->singleton(

tests/Integration/Auth/SessionAuthenticatorTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Tempest\Auth\Install\User;
1313
use Tempest\Auth\SessionAuthenticator;
1414
use Tempest\Clock\Clock;
15+
use Tempest\Core\FrameworkKernel;
1516
use Tempest\Core\Kernel;
1617
use Tempest\Database\Migrations\CreateMigrationsTable;
1718
use Tempest\Filesystem\LocalFilesystem;
@@ -27,6 +28,7 @@
2728
final class SessionAuthenticatorTest extends FrameworkIntegrationTestCase
2829
{
2930
private string $path = __DIR__ . '/Fixtures/tmp';
31+
3032
private LocalFilesystem $filesystem;
3133

3234
protected function setUp(): void
@@ -38,7 +40,7 @@ protected function setUp(): void
3840
$this->filesystem->deleteDirectory($this->path, recursive: true);
3941
$this->filesystem->ensureDirectoryExists($this->path);
4042

41-
$this->container->get(Kernel::class)->internalStorage = realpath($this->path);
43+
$this->container->get(FrameworkKernel::class)->internalStorage = realpath($this->path);
4244

4345
$this->container->config(new SessionConfig(path: 'sessions'));
4446
$this->container->singleton(

tests/Integration/Http/FileSessionTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Tests\Tempest\Integration\Http;
66

77
use Tempest\Clock\Clock;
8+
use Tempest\Core\FrameworkKernel;
89
use Tempest\Core\Kernel;
910
use Tempest\Filesystem\LocalFilesystem;
1011
use Tempest\Router\Session\Managers\FileSessionManager;
@@ -22,6 +23,7 @@
2223
final class FileSessionTest extends FrameworkIntegrationTestCase
2324
{
2425
private string $path = __DIR__ . '/Fixtures/tmp';
26+
2527
private LocalFilesystem $filesystem;
2628

2729
protected function setUp(): void
@@ -31,9 +33,10 @@ protected function setUp(): void
3133
$this->filesystem = new LocalFilesystem();
3234
$this->filesystem->deleteDirectory($this->path, recursive: true);
3335
$this->filesystem->ensureDirectoryExists($this->path);
36+
3437
$this->path = realpath($this->path);
3538

36-
$this->container->get(Kernel::class)->internalStorage = realpath($this->path);
39+
$this->container->get(FrameworkKernel::class)->internalStorage = realpath($this->path);
3740

3841
$this->container->config(new SessionConfig(path: 'sessions'));
3942
$this->container->singleton(

0 commit comments

Comments
 (0)