From c07bae5e1b8bb067549305420043ba175f59b018 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Wed, 25 Oct 2023 17:40:50 +0800 Subject: [PATCH 01/14] wip --- src/Console/Commander.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Console/Commander.php b/src/Console/Commander.php index 12c09ea6..96ac26dc 100644 --- a/src/Console/Commander.php +++ b/src/Console/Commander.php @@ -27,7 +27,7 @@ class Commander extends \Orchestra\Testbench\Console\Commander */ protected function resolveApplicationCallback() { - return function ($app) { + return static function ($app) { $app->register(CanvasServiceProvider::class); }; } From a5f580cf5742bbdb78d419cb8168d2831f5e0824 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Wed, 25 Oct 2023 17:41:28 +0800 Subject: [PATCH 02/14] wip --- src/Console/Commander.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Console/Commander.php b/src/Console/Commander.php index 96ac26dc..af3e10c0 100644 --- a/src/Console/Commander.php +++ b/src/Console/Commander.php @@ -47,9 +47,9 @@ public function laravel() $app->register(LaravelServiceProvider::class); Collection::make($kernel->all()) - ->reject(function (SymfonyCommand $command, string $name) { - return Str::startsWith('make:', $name) || $command instanceof GeneratorCommand; - })->each(function (SymfonyCommand $command) { + ->reject(static function (SymfonyCommand $command, string $name) { + return str_starts_with('make:', $name) || $command instanceof GeneratorCommand; + })->each(static function (SymfonyCommand $command) { $command->setHidden(true); }); } From 0624550ef56685a29c65c32c34925c51ecca7468 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 26 Oct 2023 06:39:11 +0800 Subject: [PATCH 03/14] wip Signed-off-by: Mior Muhammad Zaki --- src/Console/Commander.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Console/Commander.php b/src/Console/Commander.php index af3e10c0..03524ca6 100644 --- a/src/Console/Commander.php +++ b/src/Console/Commander.php @@ -6,7 +6,6 @@ use Illuminate\Contracts\Console\Kernel as ConsoleKernel; use Illuminate\Foundation\Application as LaravelApplication; use Illuminate\Support\Collection; -use Illuminate\Support\Str; use Orchestra\Canvas\CanvasServiceProvider; use Orchestra\Canvas\LaravelServiceProvider; use Symfony\Component\Console\Command\Command as SymfonyCommand; From 8f28029c79f5c5931f9eb093c5851a8d179472b8 Mon Sep 17 00:00:00 2001 From: Eder Soares Date: Thu, 26 Oct 2023 18:58:40 -0300 Subject: [PATCH 04/14] Adds missing preset option (#29) * Add missing preset option to factory * Add missing preset option to request --- src/Console/ControllerMakeCommand.php | 27 +++++++++++++++++++++++++++ src/Console/ModelMakeCommand.php | 1 + 2 files changed, 28 insertions(+) diff --git a/src/Console/ControllerMakeCommand.php b/src/Console/ControllerMakeCommand.php index f5b4790e..d4ff3722 100644 --- a/src/Console/ControllerMakeCommand.php +++ b/src/Console/ControllerMakeCommand.php @@ -139,4 +139,31 @@ protected function possibleModels() { return $this->possibleModelsUsingCanvas(); } + + /** + * Generate the form requests for the given model and classes. + * + * @param string $modelClass + * @param string $storeRequestClass + * @param string $updateRequestClass + * @return array + */ + protected function generateFormRequests($modelClass, $storeRequestClass, $updateRequestClass) + { + $storeRequestClass = 'Store'.class_basename($modelClass).'Request'; + + $this->call('make:request', [ + 'name' => $storeRequestClass, + '--preset' => $this->option('preset'), + ]); + + $updateRequestClass = 'Update'.class_basename($modelClass).'Request'; + + $this->call('make:request', [ + 'name' => $updateRequestClass, + '--preset' => $this->option('preset'), + ]); + + return [$storeRequestClass, $updateRequestClass]; + } } diff --git a/src/Console/ModelMakeCommand.php b/src/Console/ModelMakeCommand.php index 342cef1b..17452ff6 100644 --- a/src/Console/ModelMakeCommand.php +++ b/src/Console/ModelMakeCommand.php @@ -87,6 +87,7 @@ protected function createFactory() $this->call('make:factory', [ 'name' => "{$factory}Factory", '--model' => $this->qualifyClass($this->getNameInput()), + '--preset' => $this->option('preset'), ]); } From 5038b630e2306a8e7486d69628d84fa2d1764cb1 Mon Sep 17 00:00:00 2001 From: Eder Soares Date: Thu, 26 Oct 2023 18:59:54 -0300 Subject: [PATCH 05/14] Replaces requests namespace correctly (#28) * Adds test to `--requests` option * Adds test to `--requests` option with custom preset * Replaces requests namespace correctly --- src/Console/ControllerMakeCommand.php | 6 ++ .../Console/ControllerMakeCommandTest.php | 58 +++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/src/Console/ControllerMakeCommand.php b/src/Console/ControllerMakeCommand.php index d4ff3722..4ec1b0a6 100644 --- a/src/Console/ControllerMakeCommand.php +++ b/src/Console/ControllerMakeCommand.php @@ -96,6 +96,12 @@ protected function buildModelReplacements(array $replace) $replace = $this->buildFormRequestReplacements($replace, $modelClass); + if ($this->option('requests')) { + $namespace = $this->rootNamespace(); + $replace['{{ namespacedRequests }}'] = str_replace('App\\', $namespace, $replace['{{ namespacedRequests }}']); + $replace['{{namespacedRequests}}'] = str_replace('App\\', $namespace, $replace['{{namespacedRequests}}']); + } + return array_merge($replace, [ 'DummyFullModelClass' => $modelClass, '{{ namespacedModel }}' => $modelClass, diff --git a/tests/Feature/Console/ControllerMakeCommandTest.php b/tests/Feature/Console/ControllerMakeCommandTest.php index 14e19944..5df68db6 100644 --- a/tests/Feature/Console/ControllerMakeCommandTest.php +++ b/tests/Feature/Console/ControllerMakeCommandTest.php @@ -10,6 +10,8 @@ class ControllerMakeCommandTest extends TestCase { protected $files = [ 'app/Http/Controllers/FooController.php', + 'app/Http/Requests/StoreFooRequest.php', + 'app/Http/Requests/UpdateFooRequest.php', 'tests/Feature/Http/Controllers/FooControllerTest.php', ]; @@ -227,4 +229,60 @@ public function it_can_generate_controller_file_with_tests() $this->assertFilenameExists('app/Http/Controllers/FooController.php'); $this->assertFilenameExists('tests/Feature/Http/Controllers/FooControllerTest.php'); } + + /** @test */ + public function it_can_generate_controller_with_model_and_requests() + { + $this->artisan('make:controller', ['name' => 'FooController', '--model' => 'Foo', '--requests' => true, '--preset' => 'canvas']) + ->expectsQuestion('A App\Models\Foo model does not exist. Do you want to generate it?', false) + ->assertSuccessful(); + + $this->assertFileContains([ + 'namespace App\Http\Controllers;', + 'use App\Models\Foo;', + 'use App\Http\Requests\StoreFooRequest;', + 'use App\Http\Requests\UpdateFooRequest;', + 'public function index()', + 'public function create()', + 'public function store(StoreFooRequest $request)', + 'public function show(Foo $foo)', + 'public function edit(Foo $foo)', + 'public function update(UpdateFooRequest $request, Foo $foo)', + 'public function destroy(Foo $foo)', + ], 'app/Http/Controllers/FooController.php'); + + $this->assertFilenameExists('app/Http/Controllers/FooController.php'); + $this->assertFilenameExists('app/Http/Requests/StoreFooRequest.php'); + $this->assertFilenameExists('app/Http/Requests/UpdateFooRequest.php'); + } + + /** @test */ + public function it_can_generate_controller_with_model_and_requests_with_custom_preset() + { + $this->instance('orchestra.canvas', new Laravel( + ['namespace' => 'Acme', 'model' => ['namespace' => 'Acme\Models']], $this->app->basePath() + )); + + $this->artisan('make:controller', ['name' => 'FooController', '--model' => 'Foo', '--requests' => true, '--preset' => 'canvas']) + ->expectsQuestion('A Acme\Models\Foo model does not exist. Do you want to generate it?', false) + ->assertSuccessful(); + + $this->assertFileContains([ + 'namespace Acme\Http\Controllers;', + 'use Acme\Models\Foo;', + 'use Acme\Http\Requests\StoreFooRequest;', + 'use Acme\Http\Requests\UpdateFooRequest;', + 'public function index()', + 'public function create()', + 'public function store(StoreFooRequest $request)', + 'public function show(Foo $foo)', + 'public function edit(Foo $foo)', + 'public function update(UpdateFooRequest $request, Foo $foo)', + 'public function destroy(Foo $foo)', + ], 'app/Http/Controllers/FooController.php'); + + $this->assertFilenameExists('app/Http/Controllers/FooController.php'); + $this->assertFilenameExists('app/Http/Requests/StoreFooRequest.php'); + $this->assertFilenameExists('app/Http/Requests/UpdateFooRequest.php'); + } } From d336a5a5b14a3dbcb2c12888c314d6ea34a8545c Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Mon, 6 Nov 2023 14:10:13 +0800 Subject: [PATCH 06/14] wip Signed-off-by: Mior Muhammad Zaki --- src/Console/stubs/user-factory.stub | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Console/stubs/user-factory.stub b/src/Console/stubs/user-factory.stub index 0ed2cdac..1caebfe6 100644 --- a/src/Console/stubs/user-factory.stub +++ b/src/Console/stubs/user-factory.stub @@ -3,6 +3,7 @@ namespace {{ factoryNamespace }}; use Illuminate\Database\Eloquent\Factories\Factory; +use Illuminate\Support\Facades\Hash; use Illuminate\Support\Str; use {{ namespacedModel }}; @@ -11,6 +12,8 @@ use {{ namespacedModel }}; */ class UserFactory extends Factory { + protected static ?string $password; + /** * The name of the factory's corresponding model. * @@ -29,7 +32,7 @@ class UserFactory extends Factory 'name' => fake()->name(), 'email' => fake()->unique()->safeEmail(), 'email_verified_at' => now(), - 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password + 'password' => static::$password ??= Hash::make('password'), 'remember_token' => Str::random(10), ]; } From c54352e84930654b6884b14d7fe91ed278d696ef Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 16 Nov 2023 14:34:04 +0800 Subject: [PATCH 07/14] wip --- .github/workflows/tests.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index aeab4cab..1a0e864a 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -3,6 +3,7 @@ name: tests on: push: pull_request: + workflow_dispatch: schedule: - cron: '0 0 * * 4' From 77cb7071fa563e74724cd051b4acd0504204540e Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 23 Nov 2023 19:18:49 +0800 Subject: [PATCH 08/14] wip Signed-off-by: Mior Muhammad Zaki --- composer.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 3495f9ea..8b92d973 100644 --- a/composer.json +++ b/composer.json @@ -31,15 +31,15 @@ "php": "^8.1", "composer-runtime-api": "^2.2", "composer/semver": "^3.0", - "illuminate/console": "^10.26", - "illuminate/database": "^10.26", - "illuminate/support": "^10.26", + "illuminate/console": "^10.33", + "illuminate/database": "^10.33", + "illuminate/support": "^10.33", "orchestra/canvas-core": "^8.9", "orchestra/testbench-core": "^8.11", "symfony/yaml": "^6.2" }, "require-dev": { - "laravel/framework": "^10.26", + "laravel/framework": "^10.33", "laravel/pint": "^1.6", "mockery/mockery": "^1.5.1", "phpstan/phpstan": "^1.10.5", From 48a0dc0f024bfab17db895c644a8ff050aa769a9 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 23 Nov 2023 19:19:32 +0800 Subject: [PATCH 09/14] wip Signed-off-by: Mior Muhammad Zaki --- .github/workflows/analyse.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/analyse.yaml b/.github/workflows/analyse.yaml index 41b466fc..7adbfc43 100644 --- a/.github/workflows/analyse.yaml +++ b/.github/workflows/analyse.yaml @@ -3,6 +3,7 @@ name: analyse on: push: pull_request: + workflow_dispatch: jobs: analyse: From 52b7e672b2bf4be6a0200b12785510bf160cb04b Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 23 Nov 2023 19:19:59 +0800 Subject: [PATCH 10/14] wip Signed-off-by: Mior Muhammad Zaki --- .github/workflows/analyse.yaml | 2 +- .github/workflows/audits.yaml | 1 + .github/workflows/coveralls.yaml | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/analyse.yaml b/.github/workflows/analyse.yaml index 7adbfc43..7e93ce10 100644 --- a/.github/workflows/analyse.yaml +++ b/.github/workflows/analyse.yaml @@ -14,7 +14,7 @@ jobs: os: - "ubuntu-latest" php: - - 8.1 + - 8.2 experimental: - false diff --git a/.github/workflows/audits.yaml b/.github/workflows/audits.yaml index 7c326e31..4aa480e1 100644 --- a/.github/workflows/audits.yaml +++ b/.github/workflows/audits.yaml @@ -15,6 +15,7 @@ jobs: php: - 8.1 - 8.2 + - 8.3 experimental: - true diff --git a/.github/workflows/coveralls.yaml b/.github/workflows/coveralls.yaml index da9d157f..80c23038 100644 --- a/.github/workflows/coveralls.yaml +++ b/.github/workflows/coveralls.yaml @@ -13,7 +13,7 @@ jobs: os: - "ubuntu-latest" php: - - 8.1 + - 8.2 dependencies: - "highest" experimental: From 3017b506358b53d08989432dc91e3d989ad0b47e Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Fri, 24 Nov 2023 19:14:35 +0800 Subject: [PATCH 11/14] PHP 8.3 Support Improvements (#31) * wip Signed-off-by: Mior Muhammad Zaki * wip Signed-off-by: Mior Muhammad Zaki * wip Signed-off-by: Mior Muhammad Zaki * wip Signed-off-by: Mior Muhammad Zaki * wip Signed-off-by: Mior Muhammad Zaki * wip Signed-off-by: Mior Muhammad Zaki * wip Signed-off-by: Mior Muhammad Zaki * wip Signed-off-by: Mior Muhammad Zaki * wip Signed-off-by: Mior Muhammad Zaki * wip Signed-off-by: Mior Muhammad Zaki * wip Signed-off-by: Mior Muhammad Zaki --------- Signed-off-by: Mior Muhammad Zaki --- src/Console/BatchesTableCommand.php | 2 ++ src/Console/CacheTableCommand.php | 2 ++ src/Console/CastMakeCommand.php | 3 +++ src/Console/ChannelMakeCommand.php | 3 +++ src/Console/CodeMakeCommand.php | 1 + src/Console/Commander.php | 2 ++ src/Console/ComponentMakeCommand.php | 4 ++++ src/Console/ConsoleMakeCommand.php | 4 ++++ src/Console/ControllerMakeCommand.php | 8 ++++++++ src/Console/EventMakeCommand.php | 3 +++ src/Console/ExceptionMakeCommand.php | 3 +++ src/Console/FactoryMakeCommand.php | 6 ++++++ src/Console/FailedTableCommand.php | 2 ++ src/Console/GeneratorMakeCommand.php | 4 ++++ src/Console/JobMakeCommand.php | 3 +++ src/Console/ListenerMakeCommand.php | 4 ++++ src/Console/MailMakeCommand.php | 3 +++ src/Console/MiddlewareMakeCommand.php | 3 +++ src/Console/MigrateMakeCommand.php | 1 + src/Console/ModelMakeCommand.php | 13 +++++++++++++ src/Console/NotificationMakeCommand.php | 3 +++ src/Console/NotificationTableCommand.php | 2 ++ src/Console/ObserverMakeCommand.php | 5 +++++ src/Console/PolicyMakeCommand.php | 6 ++++++ src/Console/PresetMakeCommand.php | 3 +++ src/Console/ProviderMakeCommand.php | 4 ++++ src/Console/QueueTableCommand.php | 2 ++ src/Console/RequestMakeCommand.php | 3 +++ src/Console/ResourceMakeCommand.php | 3 +++ src/Console/RuleMakeCommand.php | 3 +++ src/Console/ScopeMakeCommand.php | 4 ++++ src/Console/SeederMakeCommand.php | 3 +++ src/Console/SessionTableCommand.php | 2 ++ src/Console/TestMakeCommand.php | 1 + src/Console/UserFactoryMakeCommand.php | 4 ++++ src/Console/UserModelMakeCommand.php | 4 ++++ src/Console/ViewMakeCommand.php | 6 ++++++ 37 files changed, 132 insertions(+) diff --git a/src/Console/BatchesTableCommand.php b/src/Console/BatchesTableCommand.php index 8059f370..aa58edcd 100644 --- a/src/Console/BatchesTableCommand.php +++ b/src/Console/BatchesTableCommand.php @@ -35,6 +35,7 @@ public function __construct(Filesystem $files, Composer $composer) * @param string $table * @return string */ + #[\Override] protected function createBaseMigration($table) { return $this->createBaseMigrationUsingCanvas($table); @@ -46,6 +47,7 @@ protected function createBaseMigration($table) * @param string $table * @return bool */ + #[\Override] protected function migrationExists($table) { return $this->migrationExistsUsingCanvas($table); diff --git a/src/Console/CacheTableCommand.php b/src/Console/CacheTableCommand.php index 9e648cdc..932ca49f 100644 --- a/src/Console/CacheTableCommand.php +++ b/src/Console/CacheTableCommand.php @@ -35,6 +35,7 @@ public function __construct(Filesystem $files, Composer $composer) * @param string $table * @return string */ + #[\Override] protected function createBaseMigration($table) { return $this->createBaseMigrationUsingCanvas($table); @@ -46,6 +47,7 @@ protected function createBaseMigration($table) * @param string $table * @return bool */ + #[\Override] protected function migrationExists($table) { return $this->migrationExistsUsingCanvas($table); diff --git a/src/Console/CastMakeCommand.php b/src/Console/CastMakeCommand.php index 7b2b0b32..d6491c89 100644 --- a/src/Console/CastMakeCommand.php +++ b/src/Console/CastMakeCommand.php @@ -35,6 +35,7 @@ public function __construct(Filesystem $files) * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ + #[\Override] public function handle() { return $this->generateCode() ? self::SUCCESS : self::FAILURE; @@ -46,6 +47,7 @@ public function handle() * @param string $name * @return string */ + #[\Override] protected function getPath($name) { return $this->getPathUsingCanvas($name); @@ -56,6 +58,7 @@ protected function getPath($name) * * @return string */ + #[\Override] protected function rootNamespace() { return $this->rootNamespaceUsingCanvas(); diff --git a/src/Console/ChannelMakeCommand.php b/src/Console/ChannelMakeCommand.php index 6bcbd29c..dc5cf6f4 100644 --- a/src/Console/ChannelMakeCommand.php +++ b/src/Console/ChannelMakeCommand.php @@ -37,6 +37,7 @@ public function __construct(Filesystem $files) * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ + #[\Override] public function handle() { return $this->generateCode() ? self::SUCCESS : self::FAILURE; @@ -48,6 +49,7 @@ public function handle() * @param string $name * @return string */ + #[\Override] protected function getPath($name) { return $this->getPathUsingCanvas($name); @@ -58,6 +60,7 @@ protected function getPath($name) * * @return string */ + #[\Override] protected function rootNamespace() { return $this->rootNamespaceUsingCanvas(); diff --git a/src/Console/CodeMakeCommand.php b/src/Console/CodeMakeCommand.php index f12b0d58..32533d32 100644 --- a/src/Console/CodeMakeCommand.php +++ b/src/Console/CodeMakeCommand.php @@ -43,6 +43,7 @@ protected function resolveDefaultStubPath($stub) * * @return array */ + #[\Override] protected function getOptions() { return [ diff --git a/src/Console/Commander.php b/src/Console/Commander.php index 03524ca6..6157d572 100644 --- a/src/Console/Commander.php +++ b/src/Console/Commander.php @@ -24,6 +24,7 @@ class Commander extends \Orchestra\Testbench\Console\Commander * * @return \Closure(\Illuminate\Foundation\Application):void */ + #[\Override] protected function resolveApplicationCallback() { return static function ($app) { @@ -36,6 +37,7 @@ protected function resolveApplicationCallback() * * @return \Illuminate\Foundation\Application */ + #[\Override] public function laravel() { if (! $this->app instanceof LaravelApplication) { diff --git a/src/Console/ComponentMakeCommand.php b/src/Console/ComponentMakeCommand.php index 96ca3990..060ff1bb 100644 --- a/src/Console/ComponentMakeCommand.php +++ b/src/Console/ComponentMakeCommand.php @@ -37,6 +37,7 @@ public function __construct(Filesystem $files) * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ + #[\Override] public function handle() { return $this->generateCode() ? self::SUCCESS : self::FAILURE; @@ -60,6 +61,7 @@ public function afterCodeHasBeenGenerated(string $className, string $path): void * @param string $name * @return string */ + #[\Override] protected function getPath($name) { return $this->getPathUsingCanvas($name); @@ -70,6 +72,7 @@ protected function getPath($name) * * @return string */ + #[\Override] protected function rootNamespace() { return $this->rootNamespaceUsingCanvas(); @@ -81,6 +84,7 @@ protected function rootNamespace() * @param string $path * @return string */ + #[\Override] protected function viewPath($path = '') { return $this->viewPathUsingCanvas($path); diff --git a/src/Console/ConsoleMakeCommand.php b/src/Console/ConsoleMakeCommand.php index 9f6524da..dc005524 100644 --- a/src/Console/ConsoleMakeCommand.php +++ b/src/Console/ConsoleMakeCommand.php @@ -37,6 +37,7 @@ public function __construct(Filesystem $files) * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ + #[\Override] public function handle() { return $this->generateCode() ? self::SUCCESS : self::FAILURE; @@ -48,6 +49,7 @@ public function handle() * @param string $name * @return string */ + #[\Override] protected function getPath($name) { return $this->getPathUsingCanvas($name); @@ -58,6 +60,7 @@ protected function getPath($name) * * @return string */ + #[\Override] protected function rootNamespace() { return $this->rootNamespaceUsingCanvas(); @@ -69,6 +72,7 @@ protected function rootNamespace() * @param string $rootNamespace * @return string */ + #[\Override] protected function getDefaultNamespace($rootNamespace) { return rtrim($this->generatorPreset()->commandNamespace(), '\\'); diff --git a/src/Console/ControllerMakeCommand.php b/src/Console/ControllerMakeCommand.php index 4ec1b0a6..fa8adbca 100644 --- a/src/Console/ControllerMakeCommand.php +++ b/src/Console/ControllerMakeCommand.php @@ -37,6 +37,7 @@ public function __construct(Filesystem $files) * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ + #[\Override] public function handle() { return $this->generateCode() ? self::SUCCESS : self::FAILURE; @@ -48,6 +49,7 @@ public function handle() * @param string $model * @return string */ + #[\Override] protected function qualifyModel(string $model) { return $this->qualifyModelUsingCanvas($model); @@ -58,6 +60,7 @@ protected function qualifyModel(string $model) * * @return array */ + #[\Override] protected function buildParentReplacements() { $parentModelClass = $this->parseModel($this->option('parent')); @@ -86,6 +89,7 @@ protected function buildParentReplacements() * @param array $replace * @return array */ + #[\Override] protected function buildModelReplacements(array $replace) { $modelClass = $this->parseModel($this->option('model')); @@ -121,6 +125,7 @@ protected function buildModelReplacements(array $replace) * @param string $name * @return string */ + #[\Override] protected function getPath($name) { return $this->getPathUsingCanvas($name); @@ -131,6 +136,7 @@ protected function getPath($name) * * @return string */ + #[\Override] protected function rootNamespace() { return $this->rootNamespaceUsingCanvas(); @@ -141,6 +147,7 @@ protected function rootNamespace() * * @return array */ + #[\Override] protected function possibleModels() { return $this->possibleModelsUsingCanvas(); @@ -154,6 +161,7 @@ protected function possibleModels() * @param string $updateRequestClass * @return array */ + #[\Override] protected function generateFormRequests($modelClass, $storeRequestClass, $updateRequestClass) { $storeRequestClass = 'Store'.class_basename($modelClass).'Request'; diff --git a/src/Console/EventMakeCommand.php b/src/Console/EventMakeCommand.php index d69b680a..bf44bc77 100644 --- a/src/Console/EventMakeCommand.php +++ b/src/Console/EventMakeCommand.php @@ -35,6 +35,7 @@ public function __construct(Filesystem $files) * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ + #[\Override] public function handle() { return $this->generateCode() ? self::SUCCESS : self::FAILURE; @@ -46,6 +47,7 @@ public function handle() * @param string $name * @return string */ + #[\Override] protected function getPath($name) { return $this->getPathUsingCanvas($name); @@ -56,6 +58,7 @@ protected function getPath($name) * * @return string */ + #[\Override] protected function rootNamespace() { return $this->rootNamespaceUsingCanvas(); diff --git a/src/Console/ExceptionMakeCommand.php b/src/Console/ExceptionMakeCommand.php index 1a41532b..2393af35 100644 --- a/src/Console/ExceptionMakeCommand.php +++ b/src/Console/ExceptionMakeCommand.php @@ -35,6 +35,7 @@ public function __construct(Filesystem $files) * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ + #[\Override] public function handle() { return $this->generateCode() ? self::SUCCESS : self::FAILURE; @@ -46,6 +47,7 @@ public function handle() * @param string $name * @return string */ + #[\Override] protected function getPath($name) { return $this->getPathUsingCanvas($name); @@ -56,6 +58,7 @@ protected function getPath($name) * * @return string */ + #[\Override] protected function rootNamespace() { return $this->rootNamespaceUsingCanvas(); diff --git a/src/Console/FactoryMakeCommand.php b/src/Console/FactoryMakeCommand.php index 2dcb792f..1fdc9de9 100644 --- a/src/Console/FactoryMakeCommand.php +++ b/src/Console/FactoryMakeCommand.php @@ -37,6 +37,7 @@ public function __construct(Filesystem $files) * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ + #[\Override] public function handle() { return $this->generateCode() ? self::SUCCESS : self::FAILURE; @@ -59,6 +60,7 @@ protected function resolveDefaultStubPath($stub) * @param string $name * @return string */ + #[\Override] protected function getNamespace($name) { return rtrim($this->generatorPreset()->factoryNamespace(), '\\'); @@ -78,6 +80,7 @@ protected function getGeneratorSourcePath(): string * @param string $name * @return string */ + #[\Override] protected function guessModelName($name) { if (str_ends_with($name, 'Factory')) { @@ -93,6 +96,7 @@ protected function guessModelName($name) * @param string $name * @return string */ + #[\Override] protected function getPath($name) { return $this->getPathUsingCanvas($name); @@ -103,6 +107,7 @@ protected function getPath($name) * * @return string */ + #[\Override] protected function rootNamespace() { return $this->rootNamespaceUsingCanvas(); @@ -113,6 +118,7 @@ protected function rootNamespace() * * @return string|null */ + #[\Override] protected function userProviderModel() { return $this->userProviderModelUsingCanvas(); diff --git a/src/Console/FailedTableCommand.php b/src/Console/FailedTableCommand.php index fe3438df..f34c955e 100644 --- a/src/Console/FailedTableCommand.php +++ b/src/Console/FailedTableCommand.php @@ -35,6 +35,7 @@ public function __construct(Filesystem $files, Composer $composer) * @param string $table * @return string */ + #[\Override] protected function createBaseMigration($table) { return $this->createBaseMigrationUsingCanvas($table); @@ -46,6 +47,7 @@ protected function createBaseMigration($table) * @param string $table * @return bool */ + #[\Override] protected function migrationExists($table) { return $this->migrationExistsUsingCanvas($table); diff --git a/src/Console/GeneratorMakeCommand.php b/src/Console/GeneratorMakeCommand.php index 8a3f6697..de1e2137 100644 --- a/src/Console/GeneratorMakeCommand.php +++ b/src/Console/GeneratorMakeCommand.php @@ -27,6 +27,7 @@ class GeneratorMakeCommand extends GeneratorCommand * @param string $name * @return string */ + #[\Override] protected function replaceClass($stub, $name) { $stub = parent::replaceClass($stub, $name); @@ -42,6 +43,7 @@ protected function replaceClass($stub, $name) * * @return string */ + #[\Override] protected function getStub() { return $this->resolveStubPath('/stubs/generator.stub'); @@ -64,6 +66,7 @@ protected function resolveDefaultStubPath($stub) * @param string $rootNamespace * @return string */ + #[\Override] protected function getDefaultNamespace($rootNamespace) { return rtrim($this->generatorPreset()->commandNamespace(), '\\'); @@ -74,6 +77,7 @@ protected function getDefaultNamespace($rootNamespace) * * @return array */ + #[\Override] protected function getOptions() { return [ diff --git a/src/Console/JobMakeCommand.php b/src/Console/JobMakeCommand.php index 36b9c223..186e5ad9 100644 --- a/src/Console/JobMakeCommand.php +++ b/src/Console/JobMakeCommand.php @@ -37,6 +37,7 @@ public function __construct(Filesystem $files) * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ + #[\Override] public function handle() { return $this->generateCode() ? self::SUCCESS : self::FAILURE; @@ -48,6 +49,7 @@ public function handle() * @param string $name * @return string */ + #[\Override] protected function getPath($name) { return $this->getPathUsingCanvas($name); @@ -58,6 +60,7 @@ protected function getPath($name) * * @return string */ + #[\Override] protected function rootNamespace() { return $this->rootNamespaceUsingCanvas(); diff --git a/src/Console/ListenerMakeCommand.php b/src/Console/ListenerMakeCommand.php index fada698b..c33036f7 100644 --- a/src/Console/ListenerMakeCommand.php +++ b/src/Console/ListenerMakeCommand.php @@ -37,6 +37,7 @@ public function __construct(Filesystem $files) * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ + #[\Override] public function handle() { return $this->generateCode() ? self::SUCCESS : self::FAILURE; @@ -48,6 +49,7 @@ public function handle() * @param string $name * @return string */ + #[\Override] protected function getPath($name) { return $this->getPathUsingCanvas($name); @@ -58,6 +60,7 @@ protected function getPath($name) * * @return string */ + #[\Override] protected function rootNamespace() { return $this->rootNamespaceUsingCanvas(); @@ -68,6 +71,7 @@ protected function rootNamespace() * * @return array */ + #[\Override] protected function possibleEvents() { return $this->possibleEventsUsingCanvas(); diff --git a/src/Console/MailMakeCommand.php b/src/Console/MailMakeCommand.php index 363aacb4..91d7cb9a 100644 --- a/src/Console/MailMakeCommand.php +++ b/src/Console/MailMakeCommand.php @@ -37,6 +37,7 @@ public function __construct(Filesystem $files) * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ + #[\Override] public function handle() { return $this->generateCode() ? self::SUCCESS : self::FAILURE; @@ -58,6 +59,7 @@ public function afterCodeHasBeenGenerated(string $className, string $path): void * @param string $name * @return string */ + #[\Override] protected function getPath($name) { return $this->getPathUsingCanvas($name); @@ -68,6 +70,7 @@ protected function getPath($name) * * @return string */ + #[\Override] protected function rootNamespace() { return $this->rootNamespaceUsingCanvas(); diff --git a/src/Console/MiddlewareMakeCommand.php b/src/Console/MiddlewareMakeCommand.php index f1010e4b..ec54f2f1 100644 --- a/src/Console/MiddlewareMakeCommand.php +++ b/src/Console/MiddlewareMakeCommand.php @@ -37,6 +37,7 @@ public function __construct(Filesystem $files) * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ + #[\Override] public function handle() { return $this->generateCode() ? self::SUCCESS : self::FAILURE; @@ -48,6 +49,7 @@ public function handle() * @param string $name * @return string */ + #[\Override] protected function getPath($name) { return $this->getPathUsingCanvas($name); @@ -58,6 +60,7 @@ protected function getPath($name) * * @return string */ + #[\Override] protected function rootNamespace() { return $this->rootNamespaceUsingCanvas(); diff --git a/src/Console/MigrateMakeCommand.php b/src/Console/MigrateMakeCommand.php index b5d1b81a..d11f5ef4 100644 --- a/src/Console/MigrateMakeCommand.php +++ b/src/Console/MigrateMakeCommand.php @@ -42,6 +42,7 @@ public function __construct(MigrationCreator $creator, Composer $composer) * * @return void */ + #[\Override] public function handle() { $preset = $this->generatorPreset(); diff --git a/src/Console/ModelMakeCommand.php b/src/Console/ModelMakeCommand.php index 17452ff6..06e00294 100644 --- a/src/Console/ModelMakeCommand.php +++ b/src/Console/ModelMakeCommand.php @@ -38,11 +38,15 @@ public function __construct(Filesystem $files) * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ + #[\Override] public function handle() { return $this->generateCode() ? self::SUCCESS : self::FAILURE; } + /** + * Run after code successfully generated. + */ protected function afterCodeHasBeenGenerated(): void { if ($this->option('all')) { @@ -80,6 +84,7 @@ protected function afterCodeHasBeenGenerated(): void * * @return void */ + #[\Override] protected function createFactory() { $factory = Str::studly($this->getNameInput()); @@ -96,6 +101,7 @@ protected function createFactory() * * @return void */ + #[\Override] protected function createMigration() { $table = Str::snake(Str::pluralStudly(class_basename($this->getNameInput()))); @@ -117,6 +123,7 @@ protected function createMigration() * * @return void */ + #[\Override] protected function createSeeder() { $seeder = Str::studly(class_basename($this->getNameInput())); @@ -132,6 +139,7 @@ protected function createSeeder() * * @return void */ + #[\Override] protected function createController() { $controller = Str::studly(class_basename($this->getNameInput())); @@ -152,6 +160,7 @@ protected function createController() * * @return void */ + #[\Override] protected function createPolicy() { $policy = Str::studly(class_basename($this->getNameInput())); @@ -169,6 +178,7 @@ protected function createPolicy() * @param string $rootNamespace * @return string */ + #[\Override] protected function getDefaultNamespace($rootNamespace) { return rtrim($this->generatorPreset()->modelNamespace(), '\\'); @@ -180,6 +190,7 @@ protected function getDefaultNamespace($rootNamespace) * @param string $model * @return string */ + #[\Override] protected function qualifyModel(string $model) { return $this->qualifyModelUsingCanvas($model); @@ -191,6 +202,7 @@ protected function qualifyModel(string $model) * @param string $name * @return string */ + #[\Override] protected function getPath($name) { return $this->getPathUsingCanvas($name); @@ -201,6 +213,7 @@ protected function getPath($name) * * @return string */ + #[\Override] protected function rootNamespace() { return $this->rootNamespaceUsingCanvas(); diff --git a/src/Console/NotificationMakeCommand.php b/src/Console/NotificationMakeCommand.php index 3e02b38e..d3c4bdbf 100644 --- a/src/Console/NotificationMakeCommand.php +++ b/src/Console/NotificationMakeCommand.php @@ -37,6 +37,7 @@ public function __construct(Filesystem $files) * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ + #[\Override] public function handle() { return $this->generateCode() ? self::SUCCESS : self::FAILURE; @@ -58,6 +59,7 @@ public function afterCodeHasBeenGenerated(string $className, string $path): void * @param string $name * @return string */ + #[\Override] protected function getPath($name) { return $this->getPathUsingCanvas($name); @@ -68,6 +70,7 @@ protected function getPath($name) * * @return string */ + #[\Override] protected function rootNamespace() { return $this->rootNamespaceUsingCanvas(); diff --git a/src/Console/NotificationTableCommand.php b/src/Console/NotificationTableCommand.php index ab9eee2d..45818fbc 100644 --- a/src/Console/NotificationTableCommand.php +++ b/src/Console/NotificationTableCommand.php @@ -35,6 +35,7 @@ public function __construct(Filesystem $files, Composer $composer) * @param string $table * @return string */ + #[\Override] protected function createBaseMigration($table) { return $this->createBaseMigrationUsingCanvas($table); @@ -46,6 +47,7 @@ protected function createBaseMigration($table) * @param string $table * @return bool */ + #[\Override] protected function migrationExists($table) { return $this->migrationExistsUsingCanvas($table); diff --git a/src/Console/ObserverMakeCommand.php b/src/Console/ObserverMakeCommand.php index e44bcf88..fec9e22c 100644 --- a/src/Console/ObserverMakeCommand.php +++ b/src/Console/ObserverMakeCommand.php @@ -35,6 +35,7 @@ public function __construct(Filesystem $files) * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ + #[\Override] public function handle() { return $this->generateCode() ? self::SUCCESS : self::FAILURE; @@ -46,6 +47,7 @@ public function handle() * @param string $model * @return string */ + #[\Override] protected function qualifyModel(string $model) { return $this->qualifyModelUsingCanvas($model); @@ -57,6 +59,7 @@ protected function qualifyModel(string $model) * @param string $name * @return string */ + #[\Override] protected function getPath($name) { return $this->getPathUsingCanvas($name); @@ -67,6 +70,7 @@ protected function getPath($name) * * @return string */ + #[\Override] protected function rootNamespace() { return $this->rootNamespaceUsingCanvas(); @@ -77,6 +81,7 @@ protected function rootNamespace() * * @return array */ + #[\Override] protected function possibleModels() { return $this->possibleModelsUsingCanvas(); diff --git a/src/Console/PolicyMakeCommand.php b/src/Console/PolicyMakeCommand.php index 8cce2eb5..1d44d6f5 100644 --- a/src/Console/PolicyMakeCommand.php +++ b/src/Console/PolicyMakeCommand.php @@ -35,6 +35,7 @@ public function __construct(Filesystem $files) * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ + #[\Override] public function handle() { return $this->generateCode() ? self::SUCCESS : self::FAILURE; @@ -46,6 +47,7 @@ public function handle() * @param string $model * @return string */ + #[\Override] protected function qualifyModel(string $model) { return $this->qualifyModelUsingCanvas($model); @@ -57,6 +59,7 @@ protected function qualifyModel(string $model) * @param string $name * @return string */ + #[\Override] protected function getPath($name) { return $this->getPathUsingCanvas($name); @@ -67,6 +70,7 @@ protected function getPath($name) * * @return string */ + #[\Override] protected function rootNamespace() { return $this->rootNamespaceUsingCanvas(); @@ -77,6 +81,7 @@ protected function rootNamespace() * * @return string|null */ + #[\Override] protected function userProviderModel() { /** @var string|null $guard */ @@ -90,6 +95,7 @@ protected function userProviderModel() * * @return array */ + #[\Override] protected function possibleModels() { return $this->possibleModelsUsingCanvas(); diff --git a/src/Console/PresetMakeCommand.php b/src/Console/PresetMakeCommand.php index 8a4c9209..ca953746 100644 --- a/src/Console/PresetMakeCommand.php +++ b/src/Console/PresetMakeCommand.php @@ -42,6 +42,7 @@ protected function getStub() * @param string $name * @return string */ + #[\Override] protected function getPath($name) { return $this->generatorPreset()->basePath().'/canvas.yaml'; @@ -50,6 +51,7 @@ protected function getPath($name) /** * Get the root namespace for the class. */ + #[\Override] protected function rootNamespace(): string { $namespace = transform($this->option('namespace'), function (string $namespace) { @@ -74,6 +76,7 @@ protected function rootNamespace(): string * * @return array */ + #[\Override] protected function getOptions() { return [ diff --git a/src/Console/ProviderMakeCommand.php b/src/Console/ProviderMakeCommand.php index e7a71ea8..41ba0269 100644 --- a/src/Console/ProviderMakeCommand.php +++ b/src/Console/ProviderMakeCommand.php @@ -35,6 +35,7 @@ public function __construct(Filesystem $files) * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ + #[\Override] public function handle() { return $this->generateCode() ? self::SUCCESS : self::FAILURE; @@ -46,6 +47,7 @@ public function handle() * @param string $name * @return string */ + #[\Override] protected function getPath($name) { return $this->getPathUsingCanvas($name); @@ -56,6 +58,7 @@ protected function getPath($name) * * @return string */ + #[\Override] protected function rootNamespace() { return $this->rootNamespaceUsingCanvas(); @@ -67,6 +70,7 @@ protected function rootNamespace() * @param string $rootNamespace * @return string */ + #[\Override] protected function getDefaultNamespace($rootNamespace) { return rtrim($this->generatorPreset()->providerNamespace(), '\\'); diff --git a/src/Console/QueueTableCommand.php b/src/Console/QueueTableCommand.php index 1b20e0b4..cc1551c3 100644 --- a/src/Console/QueueTableCommand.php +++ b/src/Console/QueueTableCommand.php @@ -36,6 +36,7 @@ public function __construct(Filesystem $files, Composer $composer) * @param string $table * @return string */ + #[\Override] protected function createBaseMigration($table) { return $this->createBaseMigrationUsingCanvas($table); @@ -47,6 +48,7 @@ protected function createBaseMigration($table) * @param string $table * @return bool */ + #[\Override] protected function migrationExists($table) { return $this->migrationExistsUsingCanvas($table); diff --git a/src/Console/RequestMakeCommand.php b/src/Console/RequestMakeCommand.php index 820f367b..6c4eddce 100644 --- a/src/Console/RequestMakeCommand.php +++ b/src/Console/RequestMakeCommand.php @@ -35,6 +35,7 @@ public function __construct(Filesystem $files) * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ + #[\Override] public function handle() { return $this->generateCode() ? self::SUCCESS : self::FAILURE; @@ -46,6 +47,7 @@ public function handle() * @param string $name * @return string */ + #[\Override] protected function getPath($name) { return $this->getPathUsingCanvas($name); @@ -56,6 +58,7 @@ protected function getPath($name) * * @return string */ + #[\Override] protected function rootNamespace() { return $this->rootNamespaceUsingCanvas(); diff --git a/src/Console/ResourceMakeCommand.php b/src/Console/ResourceMakeCommand.php index ab69423a..e44d634f 100644 --- a/src/Console/ResourceMakeCommand.php +++ b/src/Console/ResourceMakeCommand.php @@ -35,6 +35,7 @@ public function __construct(Filesystem $files) * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ + #[\Override] public function handle() { return $this->generateCode() ? self::SUCCESS : self::FAILURE; @@ -46,6 +47,7 @@ public function handle() * @param string $name * @return string */ + #[\Override] protected function getPath($name) { return $this->getPathUsingCanvas($name); @@ -56,6 +58,7 @@ protected function getPath($name) * * @return string */ + #[\Override] protected function rootNamespace() { return $this->rootNamespaceUsingCanvas(); diff --git a/src/Console/RuleMakeCommand.php b/src/Console/RuleMakeCommand.php index 4881c292..473db560 100644 --- a/src/Console/RuleMakeCommand.php +++ b/src/Console/RuleMakeCommand.php @@ -35,6 +35,7 @@ public function __construct(Filesystem $files) * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ + #[\Override] public function handle() { return $this->generateCode() ? self::SUCCESS : self::FAILURE; @@ -46,6 +47,7 @@ public function handle() * @param string $name * @return string */ + #[\Override] protected function getPath($name) { return $this->getPathUsingCanvas($name); @@ -56,6 +58,7 @@ protected function getPath($name) * * @return string */ + #[\Override] protected function rootNamespace() { return $this->rootNamespaceUsingCanvas(); diff --git a/src/Console/ScopeMakeCommand.php b/src/Console/ScopeMakeCommand.php index 2b30066f..88f6d3e6 100644 --- a/src/Console/ScopeMakeCommand.php +++ b/src/Console/ScopeMakeCommand.php @@ -35,6 +35,7 @@ public function __construct(Filesystem $files) * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ + #[\Override] public function handle() { return $this->generateCode() ? self::SUCCESS : self::FAILURE; @@ -46,6 +47,7 @@ public function handle() * @param string $model * @return string */ + #[\Override] protected function qualifyModel(string $model) { return $this->qualifyModelUsingCanvas($model); @@ -57,6 +59,7 @@ protected function qualifyModel(string $model) * @param string $name * @return string */ + #[\Override] protected function getPath($name) { return $this->getPathUsingCanvas($name); @@ -67,6 +70,7 @@ protected function getPath($name) * * @return string */ + #[\Override] protected function rootNamespace() { return $this->rootNamespaceUsingCanvas(); diff --git a/src/Console/SeederMakeCommand.php b/src/Console/SeederMakeCommand.php index 36a25ec4..3d3af4b0 100644 --- a/src/Console/SeederMakeCommand.php +++ b/src/Console/SeederMakeCommand.php @@ -35,6 +35,7 @@ public function __construct(Filesystem $files) * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ + #[\Override] public function handle() { return $this->generateCode() ? self::SUCCESS : self::FAILURE; @@ -54,6 +55,7 @@ protected function getGeneratorSourcePath(): string * @param string $name * @return string */ + #[\Override] protected function getPath($name) { return $this->getPathUsingCanvas($name); @@ -64,6 +66,7 @@ protected function getPath($name) * * @return string */ + #[\Override] protected function rootNamespace() { return $this->generatorPreset()->seederNamespace(); diff --git a/src/Console/SessionTableCommand.php b/src/Console/SessionTableCommand.php index 68a9f3e7..250beeb9 100644 --- a/src/Console/SessionTableCommand.php +++ b/src/Console/SessionTableCommand.php @@ -35,6 +35,7 @@ public function __construct(Filesystem $files, Composer $composer) * @param string $table * @return string */ + #[\Override] protected function createBaseMigration($table) { return $this->createBaseMigrationUsingCanvas($table); @@ -46,6 +47,7 @@ protected function createBaseMigration($table) * @param string $table * @return bool */ + #[\Override] protected function migrationExists($table) { return $this->migrationExistsUsingCanvas($table); diff --git a/src/Console/TestMakeCommand.php b/src/Console/TestMakeCommand.php index 2301cf70..c447e1d7 100644 --- a/src/Console/TestMakeCommand.php +++ b/src/Console/TestMakeCommand.php @@ -37,6 +37,7 @@ public function __construct(Filesystem $files) * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ + #[\Override] public function handle() { return $this->generateCode() ? self::SUCCESS : self::FAILURE; diff --git a/src/Console/UserFactoryMakeCommand.php b/src/Console/UserFactoryMakeCommand.php index 15785244..5ab94916 100644 --- a/src/Console/UserFactoryMakeCommand.php +++ b/src/Console/UserFactoryMakeCommand.php @@ -45,6 +45,7 @@ protected function resolveDefaultStubPath($stub) * * @return string */ + #[\Override] protected function rootNamespace() { return $this->generatorPreset()->factoryNamespace(); @@ -81,6 +82,7 @@ public function generatingCode(string $stub, string $className): string * * @return string */ + #[\Override] protected function getNameInput() { return 'UserFactory'; @@ -91,6 +93,7 @@ protected function getNameInput() * * @return array */ + #[\Override] protected function getArguments() { return []; @@ -101,6 +104,7 @@ protected function getArguments() * * @return array */ + #[\Override] protected function getOptions() { return [ diff --git a/src/Console/UserModelMakeCommand.php b/src/Console/UserModelMakeCommand.php index 105b2b68..f049c8e7 100644 --- a/src/Console/UserModelMakeCommand.php +++ b/src/Console/UserModelMakeCommand.php @@ -43,6 +43,7 @@ protected function resolveDefaultStubPath($stub) /** * Get the default namespace for the class. */ + #[\Override] public function getDefaultNamespace($rootNamespace) { return rtrim($this->generatorPreset()->modelNamespace(), '\\'); @@ -53,6 +54,7 @@ public function getDefaultNamespace($rootNamespace) * * @return string */ + #[\Override] protected function getNameInput() { return 'User'; @@ -63,6 +65,7 @@ protected function getNameInput() * * @return array */ + #[\Override] protected function getArguments() { return []; @@ -73,6 +76,7 @@ protected function getArguments() * * @return array */ + #[\Override] protected function getOptions() { return [ diff --git a/src/Console/ViewMakeCommand.php b/src/Console/ViewMakeCommand.php index edc5ea9c..fd1959a8 100644 --- a/src/Console/ViewMakeCommand.php +++ b/src/Console/ViewMakeCommand.php @@ -38,6 +38,7 @@ public function __construct(Filesystem $files) * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ + #[\Override] public function handle() { return $this->generateCode() ? self::SUCCESS : self::FAILURE; @@ -79,6 +80,7 @@ protected function resolveDefaultStubPath($stub) * @param string $name * @return string */ + #[\Override] protected function getPath($name) { /** @var string $extension */ @@ -94,6 +96,7 @@ protected function getPath($name) * * @return string */ + #[\Override] protected function getNameInput() { return transform($this->argument('name'), function (string $name) { @@ -147,6 +150,7 @@ protected function handleTestCreationUsingCanvas($path): bool * * @return string */ + #[\Override] protected function rootNamespace() { return $this->rootNamespaceUsingCanvas(); @@ -157,6 +161,7 @@ protected function rootNamespace() * * @return string */ + #[\Override] protected function getTestPath() { $preset = $this->generatorPreset(); @@ -175,6 +180,7 @@ protected function getTestPath() * * @return string */ + #[\Override] protected function getTestStub() { $stubName = 'view.'.($this->option('pest') ? 'pest' : 'test').'.stub'; From bd2ea9ae2b30e439dca19de7bbab13f153c9e576 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Mon, 27 Nov 2023 09:44:32 +0800 Subject: [PATCH 12/14] wip Signed-off-by: Mior Muhammad Zaki --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 8b92d973..93ae10b7 100644 --- a/composer.json +++ b/composer.json @@ -36,6 +36,7 @@ "illuminate/support": "^10.33", "orchestra/canvas-core": "^8.9", "orchestra/testbench-core": "^8.11", + "symfony/polyfill-php83": "^1.28", "symfony/yaml": "^6.2" }, "require-dev": { From 1c967f8a3fdffed017ec76d366fe022d2e7d88d7 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Mon, 27 Nov 2023 10:25:29 +0800 Subject: [PATCH 13/14] wip Signed-off-by: Mior Muhammad Zaki --- .github/workflows/analyse.yaml | 50 ++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/.github/workflows/analyse.yaml b/.github/workflows/analyse.yaml index 7e93ce10..743046ec 100644 --- a/.github/workflows/analyse.yaml +++ b/.github/workflows/analyse.yaml @@ -15,10 +15,12 @@ jobs: - "ubuntu-latest" php: - 8.2 + dependencies: + - "highest" experimental: - false - name: PHP${{ matrix.php }} on ${{ matrix.os }} + name: PHP${{ matrix.php }} PHPStan & Pint steps: - name: Checkout code @@ -28,20 +30,50 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, mysql, mysqli, pdo_mysql, bcmath, intl, fileinfo + extensions: dom, curl, libxml, mbstring, zip, pcntl, sqlite3, pdo_sqlite, bcmath, fileinfo coverage: none - name: Install dependencies uses: "ramsey/composer-install@v2" with: - dependency-versions: "highest" + dependency-versions: "${{ matrix.dependencies }}" composer-options: "--prefer-dist --no-cache" - - name: Installed dependencies - run: composer show -D - - - name: Execute Code Style Analysis - run: vendor/bin/pint --test - - name: Execute Static Code Analysis run: vendor/bin/phpstan analyse + + lint: + runs-on: ${{ matrix.os }} + continue-on-error: ${{ matrix.experimental }} + strategy: + matrix: + os: + - "ubuntu-latest" + php: + - 8.3 + dependencies: + - "highest" + experimental: + - false + + name: PHP${{ matrix.php }} Code Lint + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pcntl, sqlite3, pdo_sqlite, bcmath, fileinfo + coverage: none + + - name: Install dependencies + uses: "ramsey/composer-install@v2" + with: + dependency-versions: "${{ matrix.dependencies }}" + composer-options: "--prefer-dist --no-cache" + + - name: PHP Lint + run: php -l ./src From 466ed3d7c1755e49be1c8e5557b434381b8ab6d1 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Mon, 27 Nov 2023 12:47:24 +0800 Subject: [PATCH 14/14] wip Signed-off-by: Mior Muhammad Zaki --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 93ae10b7..97e67f7c 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ "illuminate/console": "^10.33", "illuminate/database": "^10.33", "illuminate/support": "^10.33", - "orchestra/canvas-core": "^8.9", + "orchestra/canvas-core": "^8.10.1", "orchestra/testbench-core": "^8.11", "symfony/polyfill-php83": "^1.28", "symfony/yaml": "^6.2"