diff --git a/src/Analyzer/ClassDescription.php b/src/Analyzer/ClassDescription.php index 0a2719f2..7d49407c 100644 --- a/src/Analyzer/ClassDescription.php +++ b/src/Analyzer/ClassDescription.php @@ -93,7 +93,7 @@ public function namespaceMatches(string $pattern): bool return $this->FQCN->matches($pattern); } - public function namespaceMatchesOneOfTheseNamespaces(array $classesToBeExcluded): bool + public function namespaceMatchesOneOfTheseNamespaces(string ...$classesToBeExcluded): bool { foreach ($classesToBeExcluded as $classToBeExcluded) { if ($this->namespaceMatches($classToBeExcluded)) { diff --git a/src/Rules/ArchRule.php b/src/Rules/ArchRule.php index 2909d417..cb29d8f3 100644 --- a/src/Rules/ArchRule.php +++ b/src/Rules/ArchRule.php @@ -38,7 +38,7 @@ public function __construct( public function check(ClassDescription $classDescription, Violations $violations): void { - if ($classDescription->namespaceMatchesOneOfTheseNamespaces($this->classesToBeExcluded)) { + if ($classDescription->namespaceMatchesOneOfTheseNamespaces(...$this->classesToBeExcluded)) { return; } diff --git a/tests/Unit/Analyzer/ClassDescriptionTest.php b/tests/Unit/Analyzer/ClassDescriptionTest.php index 4726d027..0642c3ac 100644 --- a/tests/Unit/Analyzer/ClassDescriptionTest.php +++ b/tests/Unit/Analyzer/ClassDescriptionTest.php @@ -36,7 +36,7 @@ public function test_should_return_true_if_there_class_is_in_namespace_array(): { $cd = $this->builder->build(); - $this->assertTrue($cd->namespaceMatchesOneOfTheseNamespaces(['Fruit'])); + $this->assertTrue($cd->namespaceMatchesOneOfTheseNamespaces('Fruit', 'Banana')); } public function test_should_return_true_if_is_annotated_with(): void