expectedClass = $expectedClass; } /** * @param $other * @return bool */ public function matches($other): bool { foreach ($other as $item) { if ($item instanceof $this->expectedClass) { return true; } } return false; } /** * @return string */ public function toString(): string { return "contains at least one instance of '{$this->expectedClass}'"; } }