[10.x] Uses PHP Native Type Declarations 🐘 (#6010)

* Adds basic typing around method's arguments and return types

* Adds missing `closure` type

* Adds typing on tests

* Fixes `RedirectIfAuthenticated`

* Fixes `Authenticate`

* Improves `RedirectIfAuthenticated` types

* Fixes user factory `unverified` return type
This commit is contained in:
Nuno Maduro
2023-01-03 09:35:24 +00:00
committed by GitHub
parent 21b826f3d3
commit 55af5469c3
19 changed files with 34 additions and 86 deletions

View File

@@ -15,7 +15,7 @@ class UserFactory extends Factory
*
* @return array<string, mixed>
*/
public function definition()
public function definition(): array
{
return [
'name' => fake()->name(),
@@ -29,9 +29,9 @@ class UserFactory extends Factory
/**
* Indicate that the model's email address should be unverified.
*
* @return static
* @return $this
*/
public function unverified()
public function unverified(): static
{
return $this->state(fn (array $attributes) => [
'email_verified_at' => null,

View File

@@ -8,10 +8,8 @@ return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
@@ -26,10 +24,8 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
public function down(): void
{
Schema::dropIfExists('users');
}

View File

@@ -8,10 +8,8 @@ return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
public function up(): void
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
@@ -22,10 +20,8 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
public function down(): void
{
Schema::dropIfExists('password_resets');
}

View File

@@ -8,10 +8,8 @@ return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
public function up(): void
{
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
@@ -26,10 +24,8 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
public function down(): void
{
Schema::dropIfExists('failed_jobs');
}

View File

@@ -8,10 +8,8 @@ return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
public function up(): void
{
Schema::create('personal_access_tokens', function (Blueprint $table) {
$table->id();
@@ -27,10 +25,8 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
public function down(): void
{
Schema::dropIfExists('personal_access_tokens');
}

View File

@@ -9,10 +9,8 @@ class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/
public function run()
public function run(): void
{
// \App\Models\User::factory(10)->create();