Skip to content

Commit

Permalink
Merge branch '6.x'
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
  • Loading branch information
crynobone committed Nov 28, 2021
2 parents 1bd5f20 + aa572e8 commit e08339b
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -29,7 +29,7 @@
"illuminate/filesystem": "^9.0"
},
"require-dev": {
"nunomaduro/larastan": "^0.7.12",
"nunomaduro/larastan": "^1.0.1",
"orchestra/testbench": "^7.0"
},
"config": {
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon.dist
Expand Up @@ -7,7 +7,7 @@ parameters:
- src

# The level 8 is the highest level
level: 5
level: 7

checkMissingIterableValueType: false
noUnnecessaryCollectionCall: false
Expand Down
1 change: 1 addition & 0 deletions src/CodeGenerator.php
Expand Up @@ -76,6 +76,7 @@ public function generatorOptions(): array
*/
protected function resolveGeneratesCodeProcessor(): GeneratesCode
{
/** @var \Orchestra\Canvas\Core\GeneratesCode $class */
$class = property_exists($this, 'processor')
? $this->processor
: GeneratesCode::class;
Expand Down
7 changes: 6 additions & 1 deletion src/Commands/Command.php
Expand Up @@ -7,6 +7,7 @@
use Illuminate\Console\Concerns\InteractsWithIO;
use Illuminate\Console\OutputStyle;
use Orchestra\Canvas\Core\Presets\Preset;
use Symfony\Component\Console\Command\Command as SymfonyConsole;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

Expand Down Expand Up @@ -58,6 +59,10 @@ public function run(InputInterface $input, OutputInterface $output): int
*/
protected function resolveCommand($command)
{
return $this->getApplication()->find($command);
return $this->getApplication()->find(
$command instanceof SymfonyConsole
? $command->getName()
: $command
);
}
}
4 changes: 3 additions & 1 deletion src/Commands/Generator.php
Expand Up @@ -117,6 +117,8 @@ public function getPublishedStubFileName(): ?string
*/
public function generatorName(): string
{
return trim($this->argument('name'));
return transform($this->argument('name'), function (string $name) {
return trim($name);
});
}
}
4 changes: 3 additions & 1 deletion src/GeneratesCode.php
Expand Up @@ -216,7 +216,9 @@ protected function replaceClass(string $stub, string $name): string
);

return str_replace(
['DummyUser'], class_basename($this->userProviderModel()), $stub
['DummyUser', '{{ userModel }}', '{{userModel}}'],
class_basename($this->userProviderModel()),
$stub
);
}

Expand Down
3 changes: 3 additions & 0 deletions src/GeneratesCommandCode.php
Expand Up @@ -2,6 +2,9 @@

namespace Orchestra\Canvas\Core;

/**
* @see https://github.com/laravel/framework/blob/8.x/src/Illuminate/Foundation/Console/ConsoleMakeCommand.php
*/
class GeneratesCommandCode extends GeneratesCode
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Presets/Preset.php
Expand Up @@ -133,6 +133,7 @@ public function seederPath(): string
public function addAdditionalCommands(Application $app): void
{
foreach ($this->config('generators', []) as $generator) {
/** @var \Symfony\Component\Console\Command\Command $generator */
$app->add(new $generator($this));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Testing/TestCase.php
Expand Up @@ -9,7 +9,7 @@ class TestCase extends \Orchestra\Testbench\TestCase
/**
* Stubs files.
*
* @var array<int, string>
* @var array<int, string>|null
*/
protected $files = [];

Expand Down

0 comments on commit e08339b

Please sign in to comment.