Skip to content

Commit

Permalink
Merge branch '6.x' into 7.x
Browse files Browse the repository at this point in the history
  • Loading branch information
crynobone committed Sep 1, 2023
2 parents 2bd23b0 + 66420a8 commit 4ee85a2
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 27 deletions.
2 changes: 1 addition & 1 deletion pint.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/CodeGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions src/Commands/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 0 additions & 2 deletions src/CommandsProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ trait CommandsProvider
{
/**
* Setup preset for laravel.
*
* @return \Orchestra\Canvas\Core\Presets\Preset
*/
protected function presetForLaravel(Container $app): Presets\Preset
{
Expand Down
4 changes: 1 addition & 3 deletions src/Contracts/GeneratesCodeListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
10 changes: 9 additions & 1 deletion src/GeneratesCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/GeneratesCodeWithComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions src/GeneratesCodeWithEloquent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];

Expand Down
6 changes: 3 additions & 3 deletions src/GeneratesCodeWithMarkdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 3 additions & 5 deletions src/GeneratesCommandCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
1 change: 0 additions & 1 deletion src/Presets/Laravel.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class Laravel extends Preset
* Add global command.
*
* @param array<int, class-string<\Symfony\Component\Console\Command\Command>> $generators
* @return void
*/
public static function commands(array $generators): void
{
Expand Down
1 change: 0 additions & 1 deletion src/Presets/Package.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class Package extends Preset
* Add global command.
*
* @param array<int, class-string<\Symfony\Component\Console\Command\Command>> $generators
* @return void
*/
public static function commands(array $generators): void
{
Expand Down

0 comments on commit 4ee85a2

Please sign in to comment.