expectException(MappingError::class); $this->expectExceptionCode(1617193185); $this->expectExceptionMessage("Could not map type `string`. An error occurred at path *root*: Value array{0: 'foo'} does not match type `string`."); (new MapperBuilder())->mapper()->map('string', ['foo']); } public function test_several_errors_count_are_reported_in_exception_message(): void { $this->expectException(MappingError::class); $this->expectExceptionCode(1617193185); $this->expectExceptionMessage("Could not map type `array{foo: string, bar: int}` with value array{foo: 42, bar: 'some string'}. A total of 2 errors were encountered."); (new MapperBuilder())->mapper()->map( 'array{foo: string, bar: int}', ['foo' => 42, 'bar' => 'some string'] ); } }