Skip to content

Commit

Permalink
Replace array for string ...
Browse files Browse the repository at this point in the history
This provides better typing
  • Loading branch information
Herberto Graca committed Jul 29, 2023
1 parent 976c200 commit 70eb7a2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Analyzer/ClassDescription.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Rules/ArchRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Analyzer/ClassDescriptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}

public function test_should_return_true_if_is_annotated_with(): void
Expand Down

0 comments on commit 70eb7a2

Please sign in to comment.