checkIfItemEvaluatesRemainingMatches($item)) { $this->itemNotMatching = true; $success = false; break; } } //we have remaining matches? if (!$this->itemNotMatching && count($this->matches) !== 0) { $success = false; $this->hasLeftoverItems = true; } if ($returnResult) { return $success; } if (!$success) { $this->fail($other, $description); } return null; } protected function getStubForToString(): string { return $this->itemNotMatching ? parent::getStubForToString() : " contained only the given items, the following items were left over:\n"; } }