diff --git a/src/Commands/Concerns/HasDomainStubs.php b/src/Commands/Concerns/HasDomainStubs.php index 82876cc..591511d 100644 --- a/src/Commands/Concerns/HasDomainStubs.php +++ b/src/Commands/Concerns/HasDomainStubs.php @@ -42,7 +42,7 @@ protected function resolvePublishedDddStub($path) ->toString(); // Check if there is a user-published stub - if (file_exists($publishedPath = app()->basePath('stubs/ddd/' . $stubFilename))) { + if (file_exists($publishedPath = app()->basePath('stubs/ddd/'.$stubFilename))) { return $publishedPath; } @@ -61,10 +61,10 @@ protected function resolveDddStubPath($path) ->ltrim('/\\') ->toString(); - if($publishedPath = $this->resolvePublishedDddStub($path)) { + if ($publishedPath = $this->resolvePublishedDddStub($path)) { return $publishedPath; } - return DDD::packagePath('stubs/' . $path); + return DDD::packagePath('stubs/'.$path); } } diff --git a/src/Commands/DomainControllerMakeCommand.php b/src/Commands/DomainControllerMakeCommand.php index dfd6b76..73660cc 100644 --- a/src/Commands/DomainControllerMakeCommand.php +++ b/src/Commands/DomainControllerMakeCommand.php @@ -86,7 +86,7 @@ protected function buildClass($name) { $stub = parent::buildClass($name); - if($this->isUsingPublishedStub()){ + if ($this->isUsingPublishedStub()) { return $stub; } diff --git a/tests/Generator/ControllerMakeTest.php b/tests/Generator/ControllerMakeTest.php index 809e1bd..c6889e1 100644 --- a/tests/Generator/ControllerMakeTest.php +++ b/tests/Generator/ControllerMakeTest.php @@ -32,7 +32,7 @@ expect($output = Artisan::output())->when( Feature::IncludeFilepathInGeneratorCommandOutput->exists(), - fn($output) => $output->toContainFilepath($relativePath), + fn ($output) => $output->toContainFilepath($relativePath), ); expect(file_exists($expectedPath))->toBeTrue(); @@ -40,7 +40,7 @@ expect(file_get_contents($expectedPath)) ->toContain("namespace {$expectedNamespace};") ->toContain("use App\Http\Controllers\Controller;") - ->toContain("extends Controller"); + ->toContain('extends Controller'); })->with([ 'Invoicing:InvoiceController' => [ 'Invoicing', @@ -205,7 +205,7 @@ expect(file_get_contents($expectedPath)) ->toContain("namespace {$expectedNamespace};") ->not->toContain("use App\Http\Controllers\Controller;") - ->not->toContain("extends Controller"); + ->not->toContain('extends Controller'); // Reset the application skeleton $this->setupTestApplication(); @@ -234,7 +234,7 @@ expect(file_exists($baseControllerPath))->toBeTrue(); // Publish a custom controller.stub - $customStub = <<toContain("namespace {$expectedNamespace};") - ->toContain("use CustomControllerTrait;") + ->toContain('use CustomControllerTrait;') ->not->toContain("use App\Http\Controllers\Controller;") - ->not->toContain("extends Controller"); + ->not->toContain('extends Controller'); $this->cleanStubs(); })->with([ diff --git a/tests/TestCase.php b/tests/TestCase.php index acf1c16..df33918 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -33,7 +33,7 @@ protected function setUp(): void // ); Factory::guessFactoryNamesUsing( - fn(string $modelName) => 'Lunarstorm\\LaravelDDD\\Database\\Factories\\' . class_basename($modelName) . 'Factory' + fn (string $modelName) => 'Lunarstorm\\LaravelDDD\\Database\\Factories\\'.class_basename($modelName).'Factory' ); }); @@ -140,7 +140,7 @@ protected function composerReload() protected function cleanSlate() { - File::copy(__DIR__ . '/.skeleton/composer.json', base_path('composer.json')); + File::copy(__DIR__.'/.skeleton/composer.json', base_path('composer.json')); File::delete(base_path('config/ddd.php')); @@ -165,10 +165,10 @@ protected function cleanStubs() protected function setupTestApplication() { - File::copyDirectory(__DIR__ . '/.skeleton/app', app_path()); - File::copyDirectory(__DIR__ . '/.skeleton/database', base_path('database')); - File::copyDirectory(__DIR__ . '/.skeleton/src/Domain', base_path('src/Domain')); - File::copy(__DIR__ . '/.skeleton/bootstrap/providers.php', base_path('bootstrap/providers.php')); + File::copyDirectory(__DIR__.'/.skeleton/app', app_path()); + File::copyDirectory(__DIR__.'/.skeleton/database', base_path('database')); + File::copyDirectory(__DIR__.'/.skeleton/src/Domain', base_path('src/Domain')); + File::copy(__DIR__.'/.skeleton/bootstrap/providers.php', base_path('bootstrap/providers.php')); File::ensureDirectoryExists(app_path('Models')); $this->setDomainPathInComposer('Domain', 'src/Domain'); @@ -178,7 +178,7 @@ protected function setDomainPathInComposer($domainNamespace, $domainPath, bool $ { $this->updateComposer( set: [ - [['autoload', 'psr-4', $domainNamespace . '\\'], $domainPath], + [['autoload', 'psr-4', $domainNamespace.'\\'], $domainPath], ], );