Skip to content

Commit

Permalink
Remove return type for make() (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
Casmo authored Aug 20, 2024
1 parent 4f4847e commit e55c1ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Concerns/AsObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

trait AsObject
{
public static function make(): static
public static function make()
{
return app(static::class);
}
Expand Down
7 changes: 7 additions & 0 deletions tests/AsActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e55c1ea

Please sign in to comment.