Skip to content

Commit a0ab21b

Browse files
nunomaduroStyleCIBotdriesvints
authored
[2.x] Uses PHP Native Type Declarations 🐘 (#1175)
* Adds types to contracts and stubs * Adds remaining types to database folder * Apply fixes from StyleCI * Fixes type * Apply fixes from StyleCI * Uses fortify `dev-feat/types` branch * Minor changes on auth service provider * Improves typing on removes team members * Adds missing type on update team name * Apply fixes from StyleCI * Update composer.json Co-authored-by: StyleCI Bot <[email protected]> Co-authored-by: Dries Vints <[email protected]>
1 parent 80b1062 commit a0ab21b

File tree

73 files changed

+299
-389
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+299
-389
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"illuminate/console": "^9.21",
2020
"illuminate/support": "^9.21",
2121
"jenssegers/agent": "^2.6",
22-
"laravel/fortify": "^1.13.3"
22+
"laravel/fortify": "^1.15"
2323
},
2424
"require-dev": {
2525
"inertiajs/inertia-laravel": "^0.6.4",

database/factories/TeamFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ class TeamFactory extends Factory
1818
/**
1919
* Define the model's default state.
2020
*
21-
* @return array
21+
* @return array<string, mixed>
2222
*/
23-
public function definition()
23+
public function definition(): array
2424
{
2525
return [
2626
'name' => $this->faker->unique()->company(),

database/factories/UserFactory.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ class UserFactory extends Factory
2020
/**
2121
* Define the model's default state.
2222
*
23-
* @return array
23+
* @return array<string, mixed>
2424
*/
25-
public function definition()
25+
public function definition(): array
2626
{
2727
return [
2828
'name' => $this->faker->name(),
@@ -36,9 +36,9 @@ public function definition()
3636
/**
3737
* Indicate that the model's email address should be unverified.
3838
*
39-
* @return \Illuminate\Database\Eloquent\Factories\Factory
39+
* @return $this
4040
*/
41-
public function unverified()
41+
public function unverified(): static
4242
{
4343
return $this->state(function (array $attributes) {
4444
return [
@@ -52,7 +52,7 @@ public function unverified()
5252
*
5353
* @return $this
5454
*/
55-
public function withPersonalTeam()
55+
public function withPersonalTeam(): static
5656
{
5757
if (! Features::hasTeamFeatures()) {
5858
return $this->state([]);

database/migrations/2014_10_12_000000_create_users_table.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@
88
{
99
/**
1010
* Run the migrations.
11-
*
12-
* @return void
1311
*/
14-
public function up()
12+
public function up(): void
1513
{
1614
Schema::create('users', function (Blueprint $table) {
1715
$table->id();
@@ -28,10 +26,8 @@ public function up()
2826

2927
/**
3028
* Reverse the migrations.
31-
*
32-
* @return void
3329
*/
34-
public function down()
30+
public function down(): void
3531
{
3632
Schema::dropIfExists('users');
3733
}

database/migrations/2020_05_21_100000_create_teams_table.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@
88
{
99
/**
1010
* Run the migrations.
11-
*
12-
* @return void
1311
*/
14-
public function up()
12+
public function up(): void
1513
{
1614
Schema::create('teams', function (Blueprint $table) {
1715
$table->id();
@@ -24,10 +22,8 @@ public function up()
2422

2523
/**
2624
* Reverse the migrations.
27-
*
28-
* @return void
2925
*/
30-
public function down()
26+
public function down(): void
3127
{
3228
Schema::dropIfExists('teams');
3329
}

database/migrations/2020_05_21_200000_create_team_user_table.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@
88
{
99
/**
1010
* Run the migrations.
11-
*
12-
* @return void
1311
*/
14-
public function up()
12+
public function up(): void
1513
{
1614
Schema::create('team_user', function (Blueprint $table) {
1715
$table->id();
@@ -26,10 +24,8 @@ public function up()
2624

2725
/**
2826
* Reverse the migrations.
29-
*
30-
* @return void
3127
*/
32-
public function down()
28+
public function down(): void
3329
{
3430
Schema::dropIfExists('team_user');
3531
}

database/migrations/2020_05_21_300000_create_team_invitations_table.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@
88
{
99
/**
1010
* Run the migrations.
11-
*
12-
* @return void
1311
*/
14-
public function up()
12+
public function up(): void
1513
{
1614
Schema::create('team_invitations', function (Blueprint $table) {
1715
$table->id();
@@ -26,10 +24,8 @@ public function up()
2624

2725
/**
2826
* Reverse the migrations.
29-
*
30-
* @return void
3127
*/
32-
public function down()
28+
public function down(): void
3329
{
3430
Schema::dropIfExists('team_invitations');
3531
}

src/Contracts/AddsTeamMembers.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,10 @@
22

33
namespace Laravel\Jetstream\Contracts;
44

5+
/**
6+
* @method void add(\Illuminate\Foundation\Auth\User $user, \Illuminate\Database\Eloquent\Model $team, string $email, string $role = null)
7+
*/
58
interface AddsTeamMembers
69
{
7-
/**
8-
* Add a new team member to the given team.
9-
*
10-
* @param mixed $user
11-
* @param mixed $team
12-
* @param string $email
13-
* @return void
14-
*/
15-
public function add($user, $team, string $email, string $role = null);
10+
//
1611
}

src/Contracts/CreatesTeams.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,10 @@
22

33
namespace Laravel\Jetstream\Contracts;
44

5+
/**
6+
* @method \Illuminate\Database\Eloquent\Model create(\Illuminate\Foundation\Auth\User $user, array $input)
7+
*/
58
interface CreatesTeams
69
{
7-
/**
8-
* Validate and create a new team for the given user.
9-
*
10-
* @param mixed $user
11-
* @param array $input
12-
* @return mixed
13-
*/
14-
public function create($user, array $input);
10+
//
1511
}

src/Contracts/DeletesTeams.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22

33
namespace Laravel\Jetstream\Contracts;
44

5+
/**
6+
* @method void delete(\Illuminate\Database\Eloquent\Model $team)
7+
*/
58
interface DeletesTeams
69
{
7-
/**
8-
* Delete the given team.
9-
*
10-
* @param mixed $team
11-
* @return void
12-
*/
13-
public function delete($team);
10+
//
1411
}

0 commit comments

Comments
 (0)