From 3c4576c5142c9f0fdc8b22e8bc77dcd28d8d4b22 Mon Sep 17 00:00:00 2001 From: Oliver Earl Date: Tue, 3 Jan 2023 12:37:51 +0000 Subject: [PATCH 1/2] chore: PHP CS Fixer should check test files too. --- .php-cs-fixer.dist.php | 1 + 1 file changed, 1 insertion(+) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 8812447..24eacee 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -6,6 +6,7 @@ $finder = PhpCsFixer\Finder::create() ->in(__DIR__ . '/app') + ->in(__DIR__ . '/tests') ->append([ __DIR__ . '/.php-cs-fixer.dist.php', ]); From 94c516073a4131b602a9e80ade9fa31ca1c32b75 Mon Sep 17 00:00:00 2001 From: stickeeoliver Date: Tue, 3 Jan 2023 12:39:20 +0000 Subject: [PATCH 2/2] style: PHP CS Fixer --- app/Commands/InstallCommand.php | 4 +++- tests/Feature/FixCommandTest.php | 4 ++-- tests/Feature/InstallCommandTest.php | 6 +++--- tests/Pest.php | 1 - 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/Commands/InstallCommand.php b/app/Commands/InstallCommand.php index 55d94bf..013b3c3 100644 --- a/app/Commands/InstallCommand.php +++ b/app/Commands/InstallCommand.php @@ -64,6 +64,7 @@ private function tasks(): bool $this->task('Copy Larastan config', function () { $this->copyFilesFromVendorDirectory('stickee/larastan-config/dist'); + return $this->amendLarastanConfig(); }); @@ -119,8 +120,9 @@ private function amendLarastanConfig(): bool if (! $disk->exists($path)) { $this->newLine(); - $this->error("Something went wrong."); + $this->error('Something went wrong.'); $this->error("Could not amend your {$larastanConfig} file."); + return false; } diff --git a/tests/Feature/FixCommandTest.php b/tests/Feature/FixCommandTest.php index 7175bc6..d6eb60c 100755 --- a/tests/Feature/FixCommandTest.php +++ b/tests/Feature/FixCommandTest.php @@ -4,12 +4,12 @@ use Illuminate\Support\Facades\Storage; -beforeEach(function() { +beforeEach(function () { $fileName = '.php-cs-fixer.cache'; Storage::disk('cwd')->move($fileName, "{$fileName}.old"); }); -afterEach(function() { +afterEach(function () { $fileName = '.php-cs-fixer.cache'; Storage::disk('cwd')->move("{$fileName}.old", $fileName); }); diff --git a/tests/Feature/InstallCommandTest.php b/tests/Feature/InstallCommandTest.php index 834ab5d..bdfbfec 100755 --- a/tests/Feature/InstallCommandTest.php +++ b/tests/Feature/InstallCommandTest.php @@ -12,7 +12,7 @@ '.lintstagedrc.json', 'phpstan.ci.neon', 'phpstan.dist.neon', - 'rector.php' + 'rector.php', ]; beforeEach(function () use ($requiredFiles) { @@ -47,7 +47,7 @@ ); }); -it ('overwrites copied GitHub workflow with its own', function () { +it('overwrites copied GitHub workflow with its own', function () { $this->artisan('install'); $file = '.github/workflows/php.yaml'; @@ -108,7 +108,7 @@ $disk->deleteDirectory($directory); }); -it ('updates the Larastan config paths', function () { +it('updates the Larastan config paths', function () { $this->artisan('install'); $contents = Storage::disk('cwd')->get('phpstan.dist.neon'); diff --git a/tests/Pest.php b/tests/Pest.php index 35633f1..72110d4 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -3,4 +3,3 @@ use Tests\TestCase; uses(TestCase::class)->in('Feature', 'Unit'); -