From dff3d622fe5dd1f0a55f5c548abdfa072a7b6327 Mon Sep 17 00:00:00 2001 From: Dustin Wilson Date: Sat, 12 Jun 2021 07:29:26 -0500 Subject: [PATCH] Typing fixes in scope matchers --- lib/Scope/Matchers/AndMatcher.php | 10 +++++----- lib/Scope/Matchers/CompositeMatcher.php | 8 ++++---- lib/Scope/Matchers/GroupMatcher.php | 8 ++++---- lib/Scope/Matchers/NegateMatcher.php | 6 +++--- lib/Scope/Matchers/OrMatcher.php | 8 ++++---- lib/Scope/Matchers/PathMatcher.php | 4 ++-- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/Scope/Matchers/AndMatcher.php b/lib/Scope/Matchers/AndMatcher.php index c7ae5b1..ffc3e98 100644 --- a/lib/Scope/Matchers/AndMatcher.php +++ b/lib/Scope/Matchers/AndMatcher.php @@ -15,13 +15,13 @@ class AndMatcher extends Matcher { $this->right = $right; } - public function matches(array $scopes): bool { - return ($this->left->matches($scopes) && $this->right->matches($scopes)); + public function matches(string ...$scopes): bool { + return ($this->left->matches(...$scopes) && $this->right->matches(...$scopes)); } - public function getPrefix(array $scopes): string|null|false { - if ($this->left->matches($scopes) && $this->right->matches($scopes)) { - return $this->left->getPrefix($scopes); + public function getPrefix(string ...$scopes): string|null|false { + if ($this->left->matches(...$scopes) && $this->right->matches(...$scopes)) { + return $this->left->getPrefix(...$scopes); } } } diff --git a/lib/Scope/Matchers/CompositeMatcher.php b/lib/Scope/Matchers/CompositeMatcher.php index 48cfbc4..bc86e7b 100644 --- a/lib/Scope/Matchers/CompositeMatcher.php +++ b/lib/Scope/Matchers/CompositeMatcher.php @@ -23,11 +23,11 @@ class CompositeMatcher extends Matcher { } } - public function matches(array $scopes): bool { - return $this->matcher->matches($scopes); + public function matches(string ...$scopes): bool { + return $this->matcher->matches(...$scopes); } - public function getPrefix(array $scopes): string|null|false { - return $this->matcher->getPrefix($scopes); + public function getPrefix(string ...$scopes): string|null|false { + return $this->matcher->getPrefix(...$scopes); } } diff --git a/lib/Scope/Matchers/GroupMatcher.php b/lib/Scope/Matchers/GroupMatcher.php index c00b2b2..5e28e83 100644 --- a/lib/Scope/Matchers/GroupMatcher.php +++ b/lib/Scope/Matchers/GroupMatcher.php @@ -15,12 +15,12 @@ class GroupMatcher extends Matcher { $this->selector = $selector; } - public function matches(array $scopes): bool { - return $this->selector->matches($scopes); + public function matches(string ...$scopes): bool { + return $this->selector->matches(...$scopes); } - public function getPrefix(array $scopes): string|null|false { - if ($this->selector->matches($scopes)) { + public function getPrefix(string ...$scopes): string|null|false { + if ($this->selector->matches(...$scopes)) { return $this->prefix; } } diff --git a/lib/Scope/Matchers/NegateMatcher.php b/lib/Scope/Matchers/NegateMatcher.php index d478054..dfe28b9 100644 --- a/lib/Scope/Matchers/NegateMatcher.php +++ b/lib/Scope/Matchers/NegateMatcher.php @@ -13,11 +13,11 @@ class NegateMatcher extends Matcher { $this->matcher = $matcher; } - public function matches(array $scopes): bool { - return !($this->matcher->matches($scopes)); + public function matches(string ...$scopes): bool { + return !($this->matcher->matches(...$scopes)); } - public function getPrefix(array $scopes) { + public function getPrefix(string ...$scopes) { return null; } } diff --git a/lib/Scope/Matchers/OrMatcher.php b/lib/Scope/Matchers/OrMatcher.php index 98d5f02..32758aa 100644 --- a/lib/Scope/Matchers/OrMatcher.php +++ b/lib/Scope/Matchers/OrMatcher.php @@ -15,11 +15,11 @@ class OrMatcher extends Matcher { $this->right = $right; } - public function matches(array $scopes): bool { - return ($this->left->matches($scopes) || $this->right->matches($scopes)); + public function matches(string ...$scopes): bool { + return ($this->left->matches(...$scopes) || $this->right->matches(...$scopes)); } - public function getPrefix(array $scopes): string|null|false { - return $this->left->getPrefix($scopes) || $this->right->getPrefix($scopes); + public function getPrefix(string ...$scopes): string|null|false { + return $this->left->getPrefix(...$scopes) || $this->right->getPrefix(...$scopes); } } diff --git a/lib/Scope/Matchers/PathMatcher.php b/lib/Scope/Matchers/PathMatcher.php index 9c70160..ac57c8d 100644 --- a/lib/Scope/Matchers/PathMatcher.php +++ b/lib/Scope/Matchers/PathMatcher.php @@ -15,7 +15,7 @@ class PathMatcher extends Matcher { $this->matchers = $matchers; } - public function matches(array $scopes): bool { + public function matches(string ...$scopes): bool { $count = 0; $matcher = $this->matchers[$count]; foreach ($scopes as $scope) { @@ -29,7 +29,7 @@ class PathMatcher extends Matcher { return false; } - public function getPrefix(array $scopes): string|null|false { + public function getPrefix(string ...$scopes): string|null|false { if ($this->matches($scopes)) { return $this->prefix; }