diff --git a/pint.json b/pint.json index 628bd22..cca4ed9 100644 --- a/pint.json +++ b/pint.json @@ -6,7 +6,7 @@ "scope": "namespaced", "strict": true }, - "no_superfluous_phpdoc_tags": false, + "no_superfluous_phpdoc_tags": true, "php_unit_method_casing": false, "nullable_type_declaration_for_default_null_value": { "use_nullable_type_declaration": true diff --git a/src/CodeGenerator.php b/src/CodeGenerator.php index 73a2379..f48279e 100644 --- a/src/CodeGenerator.php +++ b/src/CodeGenerator.php @@ -14,7 +14,6 @@ trait CodeGenerator /** * Set Preset for generator. * - * @param \Orchestra\Canvas\Core\Presets\Preset $preset * @return $this */ public function setPreset(Presets\Preset $preset) diff --git a/src/Commands/Generator.php b/src/Commands/Generator.php index f10681b..96d3690 100644 --- a/src/Commands/Generator.php +++ b/src/Commands/Generator.php @@ -91,9 +91,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } /** - * Code successfully generated. - * - * @return string + * Handle generating code. */ public function generatingCode(string $stub, string $className): string { diff --git a/src/CommandsProvider.php b/src/CommandsProvider.php index 43583d5..314c504 100644 --- a/src/CommandsProvider.php +++ b/src/CommandsProvider.php @@ -8,8 +8,6 @@ trait CommandsProvider { /** * Setup preset for laravel. - * - * @return \Orchestra\Canvas\Core\Presets\Preset */ protected function presetForLaravel(Container $app): Presets\Preset { diff --git a/src/Contracts/GeneratesCodeListener.php b/src/Contracts/GeneratesCodeListener.php index 29c330c..b808675 100644 --- a/src/Contracts/GeneratesCodeListener.php +++ b/src/Contracts/GeneratesCodeListener.php @@ -12,9 +12,7 @@ interface GeneratesCodeListener public function codeAlreadyExists(string $className); /** - * Code successfully generated. - * - * @return string + * Handle generating code. */ public function generatingCode(string $stub, string $className): string; diff --git a/src/GeneratesCode.php b/src/GeneratesCode.php index bda99ae..10afd79 100644 --- a/src/GeneratesCode.php +++ b/src/GeneratesCode.php @@ -129,8 +129,16 @@ protected function makeDirectory(string $path): string */ protected function buildClass(string $name): string { - $stub = $this->files->get($this->getListenerStubFile()); + return $this->generatingCode( + $this->files->get($this->getListenerStubFile()), $name + ); + } + /** + * Handle generating code. + */ + protected function generatingCode(string $stub, string $name): string + { return $this->listener->generatingCode( $this->replaceClass( $this->replaceNamespace($stub, $name), $name diff --git a/src/GeneratesCodeWithComponent.php b/src/GeneratesCodeWithComponent.php index dac5d09..d467832 100644 --- a/src/GeneratesCodeWithComponent.php +++ b/src/GeneratesCodeWithComponent.php @@ -11,11 +11,11 @@ class GeneratesCodeWithComponent extends GeneratesCode { /** - * Replace the namespace for the given stub. + * Handle generating code. */ - protected function replaceNamespace(string $stub, string $name): string + protected function generatingCode(string $stub, string $name): string { - $stub = parent::replaceNamespace($stub, $name); + $stub = parent::generatingCode($stub, $name); if (! empty($this->options['inline'])) { $stub = str_replace( diff --git a/src/GeneratesCodeWithEloquent.php b/src/GeneratesCodeWithEloquent.php index 19f6357..1c9e5a4 100644 --- a/src/GeneratesCodeWithEloquent.php +++ b/src/GeneratesCodeWithEloquent.php @@ -11,11 +11,11 @@ class GeneratesCodeWithEloquent extends GeneratesCode { /** - * Replace the namespace for the given stub. + * Handle generating code. */ - protected function replaceNamespace(string $stub, string $name): string + protected function generatingCode(string $stub, string $name): string { - $stub = parent::replaceNamespace($stub, $name); + $stub = parent::generatingCode($stub, $name); $model = $this->options['model']; diff --git a/src/GeneratesCodeWithMarkdown.php b/src/GeneratesCodeWithMarkdown.php index 387faac..cdbe111 100644 --- a/src/GeneratesCodeWithMarkdown.php +++ b/src/GeneratesCodeWithMarkdown.php @@ -5,11 +5,11 @@ class GeneratesCodeWithMarkdown extends GeneratesCode { /** - * Replace the namespace for the given stub. + * Handle generating code. */ - protected function replaceNamespace(string $stub, string $name): string + protected function generatingCode(string $stub, string $name): string { - $stub = parent::replaceNamespace($stub, $name); + $stub = parent::generatingCode($stub, $name); if (! empty($this->options['view'])) { $stub = str_replace(['DummyView', '{{ view }}', '{{view}}'], $this->options['view'], $stub); diff --git a/src/GeneratesCommandCode.php b/src/GeneratesCommandCode.php index b1be2c6..a648d0c 100644 --- a/src/GeneratesCommandCode.php +++ b/src/GeneratesCommandCode.php @@ -8,13 +8,11 @@ class GeneratesCommandCode extends GeneratesCode { /** - * Replace the class name for the given stub. - * - * @todo need to be updated + * Handle generating code. */ - protected function replaceClass(string $stub, string $name): string + protected function generatingCode(string $stub, string $name): string { - $stub = parent::replaceClass($stub, $name); + $stub = parent::generatingCode($stub, $name); return str_replace(['dummy:command', '{{ command }}', '{{command}}'], $this->options['command'], $stub); } diff --git a/src/Presets/Laravel.php b/src/Presets/Laravel.php index d32eb6c..ec059dc 100644 --- a/src/Presets/Laravel.php +++ b/src/Presets/Laravel.php @@ -18,7 +18,6 @@ class Laravel extends Preset * Add global command. * * @param array> $generators - * @return void */ public static function commands(array $generators): void { diff --git a/src/Presets/Package.php b/src/Presets/Package.php index a0413a5..1ca3dcc 100644 --- a/src/Presets/Package.php +++ b/src/Presets/Package.php @@ -19,7 +19,6 @@ class Package extends Preset * Add global command. * * @param array> $generators - * @return void */ public static function commands(array $generators): void {