function Matcher::matches
Same name in this branch
- 11.1.x vendor/myclabs/deep-copy/src/DeepCopy/Matcher/Matcher.php \DeepCopy\Matcher\Matcher::matches()
Throws
MethodNameNotConfiguredException
File
-
vendor/
phpunit/ phpunit/ src/ Framework/ MockObject/ Runtime/ Matcher.php, line 134
Class
- Matcher
- @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
Namespace
PHPUnit\Framework\MockObjectCode
public function matches(Invocation $invocation) : bool {
if ($this->afterMatchBuilderId !== null) {
$matcher = $invocation->object()
->__phpunit_getInvocationHandler()
->lookupMatcher($this->afterMatchBuilderId);
if (!$matcher) {
throw new MatchBuilderNotFoundException($this->afterMatchBuilderId);
}
if (!$matcher->invocationRule
->hasBeenInvoked()) {
return false;
}
}
if ($this->methodNameRule === null) {
throw new MethodNameNotConfiguredException();
}
if (!$this->invocationRule
->matches($invocation)) {
return false;
}
try {
if (!$this->methodNameRule
->matches($invocation)) {
return false;
}
} catch (ExpectationFailedException $e) {
throw new ExpectationFailedException(sprintf("Expectation failed for %s when %s\n%s", $this->methodNameRule
->toString(), $this->invocationRule
->toString(), $e->getMessage()), $e->getComparisonFailure());
}
return true;
}