/** * @inheritdoc */ public function containsKey($key) { if (!is_int($key)) { throw InvalidArgumentException::invalidType('key', 'integer', $key); } return isset($this->items[$key]); }
/** * @test */ public function it_creates_an_invalidType_exception_mentioning_the_type_of_an_object() { $exception = InvalidArgumentException::invalidType('someArgument', 'string', new stdClass()); $this->assertInstanceOf(InvalidArgumentException::class, $exception); $this->assertSame('Argument $someArgument must be of type string, stdClass given', $exception->getMessage()); }