Skip to content

Commit

Permalink
Merge pull request #34 from jsandfordhughescoop/add-types
Browse files Browse the repository at this point in the history
Adds missing return types
  • Loading branch information
Nielsvanpach authored Sep 18, 2024
2 parents 832e97a + c47a54b commit af2f371
Show file tree
Hide file tree
Showing 11 changed files with 78 additions and 15 deletions.
2 changes: 1 addition & 1 deletion stubs/console.stub
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class {{ class }} extends Command

protected $description = 'Command description';

public function handle()
public function handle(): void
{
//
}
Expand Down
2 changes: 1 addition & 1 deletion stubs/factory.stub
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Factories\Factory;

class {{ model }}Factory extends Factory
{
public function definition()
public function definition(): array
{
return [
//
Expand Down
2 changes: 1 addition & 1 deletion stubs/job.queued.stub
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class {{ class }} implements ShouldQueue
{
}

public function handle()
public function handle(): void
{
}
}
2 changes: 1 addition & 1 deletion stubs/job.stub
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class {{ class }}
{
}

public function handle()
public function handle(): void
{
}
}
21 changes: 21 additions & 0 deletions stubs/listener.queued.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace {{ namespace }};

use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;

class {{ class }} implements ShouldQueue
{
use InteractsWithQueue;

public function __construct()
{
//
}

public function handle(object $event): void
{
//
}
}
22 changes: 22 additions & 0 deletions stubs/listener.typed.queued.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace {{ namespace }};

use {{ eventNamespace }};
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;

class {{ class }} implements ShouldQueue
{
use InteractsWithQueue;

public function __construct()
{
//
}

public function handle({{ event }} $event): void
{
//
}
}
20 changes: 20 additions & 0 deletions stubs/listener.typed.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace {{ namespace }};

use {{ eventNamespace }};
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;

class {{ class }}
{
public function __construct()
{
//
}

public function handle({{ event }} $event): void
{
//
}
}
14 changes: 7 additions & 7 deletions stubs/policy.stub
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,37 @@ class {{ class }}
{
use HandlesAuthorization;

public function viewAny({{ user }} $user)
public function viewAny({{ user }} $user): bool
{
//
}

public function view({{ user }} $user, {{ model }} ${{ modelVariable }})
public function view({{ user }} $user, {{ model }} ${{ modelVariable }}): bool
{
//
}

public function create({{ user }} $user)
public function create({{ user }} $user): bool
{
//
}

public function update({{ user }} $user, {{ model }} ${{ modelVariable }})
public function update({{ user }} $user, {{ model }} ${{ modelVariable }}): bool
{
//
}

public function delete({{ user }} $user, {{ model }} ${{ modelVariable }})
public function delete({{ user }} $user, {{ model }} ${{ modelVariable }}): bool
{
//
}

public function restore({{ user }} $user, {{ model }} ${{ modelVariable }})
public function restore({{ user }} $user, {{ model }} ${{ modelVariable }}): bool
{
//
}

public function forceDelete({{ user }} $user, {{ model }} ${{ modelVariable }})
public function forceDelete({{ user }} $user, {{ model }} ${{ modelVariable }}): bool
{
//
}
Expand Down
4 changes: 2 additions & 2 deletions stubs/provider.stub
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use Illuminate\Support\ServiceProvider;

class {{ class }} extends ServiceProvider
{
public function register()
public function register(): void
{
}

public function boot()
public function boot(): void
{
}
}
2 changes: 1 addition & 1 deletion stubs/resource-collection.stub
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use Illuminate\Http\Resources\Json\ResourceCollection;

class {{ class }} extends ResourceCollection
{
public function toArray($request)
public function toArray($request): array
{
return parent::toArray($request);
}
Expand Down
2 changes: 1 addition & 1 deletion stubs/resource.stub
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use Illuminate\Http\Resources\Json\JsonResource;

class {{ class }} extends JsonResource
{
public function toArray($request)
public function toArray($request): array
{
return parent::toArray($request);
}
Expand Down

0 comments on commit af2f371

Please sign in to comment.