diff --git a/tests/App/Components/SimpleShowValue.php b/tests/App/Components/SimpleShowValue.php index d5378f8a4..8abbf62bb 100644 --- a/tests/App/Components/SimpleShowValue.php +++ b/tests/App/Components/SimpleShowValue.php @@ -9,19 +9,11 @@ class SimpleShowValue extends Component { - /** - * @var User - */ - public $value; - /** * Create a new component instance. - * - * @param mixed $value */ - public function __construct($value) + public function __construct(public mixed $value) { - $this->value = $value; } /** diff --git a/tests/App/Components/SimpleShowValueWithArguments.php b/tests/App/Components/SimpleShowValueWithArguments.php index 94c6d4f94..1ffc99641 100644 --- a/tests/App/Components/SimpleShowValueWithArguments.php +++ b/tests/App/Components/SimpleShowValueWithArguments.php @@ -9,31 +9,12 @@ class SimpleShowValueWithArguments extends Component { - /** - * @var mixed - */ - public $value; - - /** - * @var Application - */ - public $application; - - /** - * @var string - */ - public $from; - /** * Create a new component instance. - * - * @param mixed $value */ - public function __construct(Application $application, $value, string $from = 'Alexandr') + public function __construct(public Application $application, public mixed $value, public string $from = 'Alexandr') { - $this->value = $value; - $this->application = $application; - $this->from = $from; + } /** diff --git a/tests/App/Layouts/DependentSumListener.php b/tests/App/Layouts/DependentSumListener.php index 0c1129f85..be1317b63 100644 --- a/tests/App/Layouts/DependentSumListener.php +++ b/tests/App/Layouts/DependentSumListener.php @@ -57,7 +57,7 @@ protected function layouts(): array */ public function getSlug(): string { - return sha1($this->slug); + return sha1((string) $this->slug); } /** diff --git a/tests/App/Notifications/TaskCompleted.php b/tests/App/Notifications/TaskCompleted.php index 716e672d8..66d71aed3 100644 --- a/tests/App/Notifications/TaskCompleted.php +++ b/tests/App/Notifications/TaskCompleted.php @@ -16,10 +16,8 @@ class TaskCompleted extends Notification /** * Get the notification's delivery channels. - * - * @param mixed $notifiable */ - public function via($notifiable): array + public function via(mixed $notifiable): array { return [DashboardChannel::class]; } @@ -35,10 +33,8 @@ public function toDashboard($notifiable): DashboardMessage /** * Get the array representation of the notification. - * - * @param mixed $notifiable */ - public function toArray($notifiable): array + public function toArray(mixed $notifiable): array { return [ // diff --git a/tests/App/RouteSolving.php b/tests/App/RouteSolving.php index a7e68bd01..5455eaf1b 100644 --- a/tests/App/RouteSolving.php +++ b/tests/App/RouteSolving.php @@ -30,7 +30,7 @@ public function resolveChildRouteBinding($childType, $value, $field) /** * @return string */ - public function __toString() + public function __toString(): string { return 'Hello Word'; } diff --git a/tests/App/Screens/SerializeRetrievableScreen.php b/tests/App/Screens/SerializeRetrievableScreen.php index 0865ff7f6..7296c91a4 100644 --- a/tests/App/Screens/SerializeRetrievableScreen.php +++ b/tests/App/Screens/SerializeRetrievableScreen.php @@ -19,9 +19,7 @@ public function __construct( private readonly string $private = 'Private', public $user = null ) { - $this->middleware(function ($request, $next) { - return $next($request); - }); + $this->middleware(fn($request, $next) => $next($request)); } /** diff --git a/tests/App/Screens/SerializeScreen.php b/tests/App/Screens/SerializeScreen.php index 40439fdff..917366a38 100644 --- a/tests/App/Screens/SerializeScreen.php +++ b/tests/App/Screens/SerializeScreen.php @@ -16,9 +16,7 @@ public function __construct( private readonly string $private = 'Private', public $user = null ) { - $this->middleware(function ($request, $next) { - return $next($request); - }); + $this->middleware(fn($request, $next) => $next($request)); } /** diff --git a/tests/Feature/App/RouteResolveScreenTest.php b/tests/Feature/App/RouteResolveScreenTest.php index 161144f35..874063893 100644 --- a/tests/Feature/App/RouteResolveScreenTest.php +++ b/tests/Feature/App/RouteResolveScreenTest.php @@ -95,9 +95,7 @@ public function testExplicitBinding(): void public function testResolutionLogic(): void { - Route::bind('user', function ($value) { - return User::where('email', $value)->firstOrFail(); - }); + Route::bind('user', fn($value) => User::where('email', $value)->firstOrFail()); Route::screen('bind/users/{user}', ModelRouteBindScreen::class) ->middleware(config('platform.middleware.private')) diff --git a/tests/Feature/Platform/RelationsTest.php b/tests/Feature/Platform/RelationsTest.php index 328216e6f..c8ebd4957 100644 --- a/tests/Feature/Platform/RelationsTest.php +++ b/tests/Feature/Platform/RelationsTest.php @@ -44,12 +44,10 @@ public function testScopeModel(array $scope): void { $response = $this->getScope($scope); - $json = $this->users->map(function ($user) { - return [ - 'value' => $user->id, - 'label' => $user->email, - ]; - })->toArray(); + $json = $this->users->map(fn($user) => [ + 'value' => $user->id, + 'label' => $user->email, + ])->toArray(); $response->assertJson($json); } @@ -63,12 +61,10 @@ public function testAppendModel(array $scope): void { $response = $this->getScope($scope, 'full'); - $json = $this->users->map(function ($user) { - return [ - 'value' => $user->id, - 'label' => $user->name.' ('.$user->email.')', - ]; - })->toArray(); + $json = $this->users->map(fn($user) => [ + 'value' => $user->id, + 'label' => $user->name.' ('.$user->email.')', + ])->toArray(); $response->assertJson($json); } diff --git a/tests/Unit/FieldTest.php b/tests/Unit/FieldTest.php index c7ad14d2c..18a2fabd8 100644 --- a/tests/Unit/FieldTest.php +++ b/tests/Unit/FieldTest.php @@ -113,13 +113,11 @@ public static function exampleFields(): ?\Generator } /** - * @param mixed $options * * @dataProvider exampleFields - * * @throws \Throwable */ - public function testHasCorrectInstance(string $field, $options): void + public function testHasCorrectInstance(string $field, mixed $options): void { /** @var \Orchid\Screen\Field $field */ $field = $field::make(); diff --git a/tests/Unit/Screen/Fields/RelationTest.php b/tests/Unit/Screen/Fields/RelationTest.php index 3efb837ba..c9d5a4b6a 100644 --- a/tests/Unit/Screen/Fields/RelationTest.php +++ b/tests/Unit/Screen/Fields/RelationTest.php @@ -80,7 +80,7 @@ public function testInstanceArrayWithStringPrimary(): void $select = Relation::make('role') ->title('Select roles') - ->fromModel(get_class(new $stringPrimaryClass), 'name') + ->fromModel($stringPrimaryClass::class, 'name') ->value($current->getRoleSlug()); $view = self::renderField($select); diff --git a/tests/Unit/Screen/Fields/RelationWithEnumTest.php b/tests/Unit/Screen/Fields/RelationWithEnumTest.php index 8dae58cf4..64e72d0db 100644 --- a/tests/Unit/Screen/Fields/RelationWithEnumTest.php +++ b/tests/Unit/Screen/Fields/RelationWithEnumTest.php @@ -84,7 +84,7 @@ public function testInstanceArrayWithStringPrimary(): void $select = Relation::make('role') ->title('Select roles') - ->fromModel(get_class(new $stringPrimaryClass), 'name') + ->fromModel($stringPrimaryClass::class, 'name') ->value($current->getRoleSlug()); $view = self::renderField($select);