From 2b180e967c34269c37368d37befd355adfd1e7e7 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 31 Oct 2024 12:00:00 +0000 Subject: [PATCH] Files to generate should be a Collection --- src/Command/RemoveIgnoredFilesCommand.php | 4 ++-- tests/Kernel/Command/RemoveIgnoredFilesCommandTest.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Command/RemoveIgnoredFilesCommand.php b/src/Command/RemoveIgnoredFilesCommand.php index 08bb72e..6c2eea6 100644 --- a/src/Command/RemoveIgnoredFilesCommand.php +++ b/src/Command/RemoveIgnoredFilesCommand.php @@ -19,13 +19,13 @@ final class RemoveIgnoredFilesCommand public function execute(array $filesToGenerateAndConfigurationData, \Closure $next) { /** - * @var array $filesToGenerate + * @var Collection $filesToGenerate * @var ConfigDto $configurationDataDto, * @var array $configurationData */ [$configurationData, $configurationDataDto, $filesToGenerate] = $filesToGenerateAndConfigurationData; - $filesToGenerate = array_filter($filesToGenerate, function (TemplateFile $templateFile): bool { + $filesToGenerate = $filesToGenerate->filter(function (TemplateFile $templateFile): bool { return !collect($this->filenames)->contains($templateFile->name); }); diff --git a/tests/Kernel/Command/RemoveIgnoredFilesCommandTest.php b/tests/Kernel/Command/RemoveIgnoredFilesCommandTest.php index 00e8c01..3a51f39 100644 --- a/tests/Kernel/Command/RemoveIgnoredFilesCommandTest.php +++ b/tests/Kernel/Command/RemoveIgnoredFilesCommandTest.php @@ -8,10 +8,10 @@ class RemoveIgnoredFilesCommandTest extends KernelTestCase { public function test_it_removes_any_ignored_files(): void { - $filenamesToGenerate = [ + $filenamesToGenerate = collect([ new TemplateFile(data: '', name: 'phpcs.xml.dist'), new TemplateFile(data: '', name: 'phpstan.neon.dist'), - ]; + ]); $filenamesToIgnore = ['phpstan.neon.dist'];