diff --git a/src/PhpPact/Consumer/Matcher/Matcher.php b/src/PhpPact/Consumer/Matcher/Matcher.php index b2feea73..0ddcf475 100644 --- a/src/PhpPact/Consumer/Matcher/Matcher.php +++ b/src/PhpPact/Consumer/Matcher/Matcher.php @@ -466,9 +466,9 @@ public function matchingField(string $fieldName): MatcherInterface return $this->withFormatter(new MatchingField($fieldName)); } - private function withFormatter(MatcherInterface $matcher): MatcherInterface + private function withFormatter(MatcherInterface&FormatterAwareInterface $matcher): MatcherInterface { - if ($matcher instanceof FormatterAwareInterface && $this->formatter) { + if ($this->formatter) { $matcher->setFormatter($this->formatter); }