Skip to content

Commit 68d2974

Browse files
committed
Replace typed deprecated contract usages with Kernel implementation
1 parent 517bc06 commit 68d2974

File tree

8 files changed

+29
-27
lines changed

8 files changed

+29
-27
lines changed

app/bootstrap.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
);
5353

5454
$app->singleton(
55-
Hyde\Framework\Contracts\HydeKernelContract::class, function () {
55+
Hyde\Framework\HydeKernel::class, function () {
5656
return Hyde\Framework\HydeKernel::getInstance();
5757
}
5858
);

packages/framework/src/Contracts/HydeKernelContract.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Hyde\Framework\Contracts;
44

5+
use Hyde\Framework\HydeKernel;
6+
57
/**
68
* The HydeKernel encapsulates a HydePHP project,
79
* providing helpful methods for interacting with it.
@@ -18,7 +20,7 @@
1820
* @example \Hyde\Framework\Hyde::foo()
1921
*
2022
* - You can also use Dependency Injection to inject the Kernel into your own classes:
21-
* @example `__construct(HydeKernelContract $hyde)`
23+
* @example `__construct(HydeKernel $hyde)`
2224
*
2325
* - Or, you can use the hyde() function to get the Kernel:
2426
* @example `$hyde = hyde();
@@ -30,9 +32,9 @@ interface HydeKernelContract
3032
{
3133
public function boot(): void;
3234

33-
public static function setInstance(HydeKernelContract $instance): void;
35+
public static function setInstance(HydeKernel $instance): void;
3436

35-
public static function getInstance(): HydeKernelContract;
37+
public static function getInstance(): HydeKernel;
3638

3739
public function getBasePath(): string;
3840

packages/framework/src/Foundation/BaseSystemCollection.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Hyde\Framework\Foundation;
44

5-
use Hyde\Framework\Contracts\HydeKernelContract;
5+
use Hyde\Framework\HydeKernel;
66
use Illuminate\Support\Collection;
77

88
/**
@@ -14,11 +14,11 @@
1414
*/
1515
abstract class BaseSystemCollection extends Collection
1616
{
17-
protected HydeKernelContract $kernel;
17+
protected HydeKernel $kernel;
1818

1919
abstract protected function runDiscovery(): self;
2020

21-
public static function boot(HydeKernelContract $kernel): static
21+
public static function boot(HydeKernel $kernel): static
2222
{
2323
return (new static())->setKernel($kernel)->runDiscovery();
2424
}
@@ -28,7 +28,7 @@ protected function __construct($items = [])
2828
parent::__construct($items);
2929
}
3030

31-
protected function setKernel(HydeKernelContract $kernel): static
31+
protected function setKernel(HydeKernel $kernel): static
3232
{
3333
$this->kernel = $kernel;
3434

packages/framework/src/Foundation/Filesystem.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Hyde\Framework\Foundation;
44

5-
use Hyde\Framework\Contracts\HydeKernelContract;
5+
use Hyde\Framework\HydeKernel;
66
use Hyde\Framework\Models\Pages\BladePage;
77
use Hyde\Framework\Models\Pages\DocumentationPage;
88
use Hyde\Framework\Models\Pages\MarkdownPage;
@@ -19,9 +19,9 @@
1919
*/
2020
class Filesystem
2121
{
22-
protected HydeKernelContract $kernel;
22+
protected HydeKernel $kernel;
2323

24-
public function __construct(HydeKernelContract $kernel)
24+
public function __construct(HydeKernel $kernel)
2525
{
2626
$this->kernel = $kernel;
2727
}

packages/framework/src/Hyde.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Hyde\Framework;
44

5-
use Hyde\Framework\Contracts\HydeKernelContract;
5+
use Hyde\Framework\HydeKernel;
66
use Hyde\Framework\Contracts\RouteContract;
77
use Hyde\Framework\Foundation\FileCollection;
88
use Hyde\Framework\Foundation\PageCollection;
@@ -46,9 +46,9 @@
4646
* @method static string makeTitle(string $slug)
4747
* @method static array toArray()
4848
* @method static bool hasSiteUrl()
49-
* @method static void setInstance(HydeKernelContract $instance)
49+
* @method static void setInstance(HydeKernel $instance)
5050
* @method static string getBasePath()
51-
* @method static HydeKernelContract getInstance()
51+
* @method static HydeKernel getInstance()
5252
* @method static string getDocumentationPagePath(string $path = '')
5353
*/
5454
class Hyde extends Facade

packages/framework/src/HydeKernel.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class HydeKernel implements HydeKernelContract, Arrayable, \JsonSerializable
3333
use Macroable;
3434
use JsonSerializesArrayable;
3535

36-
protected static HydeKernelContract $instance;
36+
protected static HydeKernel $instance;
3737

3838
protected string $basePath;
3939

@@ -62,12 +62,12 @@ public function boot(): void
6262
$this->routes = RouteCollection::boot($this);
6363
}
6464

65-
public static function setInstance(HydeKernelContract $instance): void
65+
public static function setInstance(HydeKernel $instance): void
6666
{
6767
static::$instance = $instance;
6868
}
6969

70-
public static function getInstance(): HydeKernelContract
70+
public static function getInstance(): HydeKernel
7171
{
7272
return static::$instance;
7373
}

packages/framework/src/helpers.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<?php
22

3-
use Hyde\Framework\Contracts\HydeKernelContract;
3+
use Hyde\Framework\HydeKernel;
44
use Illuminate\Contracts\Support\Arrayable;
55

66
if (! function_exists('hyde')) {
77
/**
88
* Get the available HydeKernel instance.
99
*
10-
* @return \Hyde\Framework\Contracts\HydeKernelContract
10+
* @return \Hyde\Framework\HydeKernel
1111
*/
12-
function hyde(): HydeKernelContract
12+
function hyde(): HydeKernel
1313
{
14-
return app(HydeKernelContract::class);
14+
return app(HydeKernel::class);
1515
}
1616
}
1717

packages/framework/tests/Feature/HydeKernelTest.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Hyde\Framework\Testing\Feature;
44

5-
use Hyde\Framework\Contracts\HydeKernelContract;
5+
use Hyde\Framework\HydeKernel;
66
use Hyde\Framework\Contracts\RouteContract;
77
use Hyde\Framework\Helpers\Features;
88
use Hyde\Framework\Hyde;
@@ -29,22 +29,22 @@ class HydeKernelTest extends TestCase
2929
{
3030
public function test_kernel_singleton_can_be_accessed_by_service_container()
3131
{
32-
$this->assertSame(app(HydeKernelContract::class), app(HydeKernelContract::class));
32+
$this->assertSame(app(HydeKernel::class), app(HydeKernel::class));
3333
}
3434

3535
public function test_kernel_singleton_can_be_accessed_by_kernel_static_method()
3636
{
37-
$this->assertSame(app(HydeKernelContract::class), HydeKernel::getInstance());
37+
$this->assertSame(app(HydeKernel::class), HydeKernel::getInstance());
3838
}
3939

4040
public function test_kernel_singleton_can_be_accessed_by_hyde_facade_method()
4141
{
42-
$this->assertSame(app(HydeKernelContract::class), Hyde::getInstance());
42+
$this->assertSame(app(HydeKernel::class), Hyde::getInstance());
4343
}
4444

4545
public function test_kernel_singleton_can_be_accessed_by_helper_function()
4646
{
47-
$this->assertSame(app(HydeKernelContract::class), hyde());
47+
$this->assertSame(app(HydeKernel::class), hyde());
4848
}
4949

5050
public function test_hyde_facade_version_method_returns_kernel_version()
@@ -54,7 +54,7 @@ public function test_hyde_facade_version_method_returns_kernel_version()
5454

5555
public function test_hyde_facade_get_facade_root_method_returns_kernel_singleton()
5656
{
57-
$this->assertSame(app(HydeKernelContract::class), Hyde::getFacadeRoot());
57+
$this->assertSame(app(HydeKernel::class), Hyde::getFacadeRoot());
5858
$this->assertSame(HydeKernel::getInstance(), Hyde::getFacadeRoot());
5959
$this->assertSame(Hyde::getInstance(), Hyde::getFacadeRoot());
6060
}

0 commit comments

Comments
 (0)