From e55c1ea6abc0843192001efa94b9cb208245cc60 Mon Sep 17 00:00:00 2001 From: Mathieu Date: Tue, 20 Aug 2024 18:04:12 +0200 Subject: [PATCH] Remove return type for make() (#287) --- src/Concerns/AsObject.php | 2 +- tests/AsActionTest.php | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Concerns/AsObject.php b/src/Concerns/AsObject.php index f304318..9108ad6 100644 --- a/src/Concerns/AsObject.php +++ b/src/Concerns/AsObject.php @@ -6,7 +6,7 @@ trait AsObject { - public static function make(): static + public static function make() { return app(static::class); } diff --git a/tests/AsActionTest.php b/tests/AsActionTest.php index e16ad7a..73258a3 100644 --- a/tests/AsActionTest.php +++ b/tests/AsActionTest.php @@ -85,6 +85,13 @@ public function asCommand(Command $command): void expect(AsActionTest::$latestResult)->toBe(42); }); +it('returns void when calling make()', function () { + // Make sure that the static function ::make() returns not a type. + $result = (new \ReflectionMethod(AsActionTest::class, 'make'))->getReturnType(); + + expect($result)->toBeEmpty(); +}); + it('runs as a controller', function () { // Given we have a route registered for that action. Route::post('compute/{operation}', AsActionTest::class);