@@ -28,37 +28,30 @@ public function __construct(
2828 ],
2929 ], ExampleDTO::class);
3030} catch (RuntimeException $ e ) {
31- // Before
3231 var_dump ($ e ->getMessage ());
33- // - Value#1: "of {"values": 42}"
34- // - Value#2: "but 42 given"
35- // - Message: Passed value in "values" of {"values": 42} must be of type
36- // list<ExampleDTO>, but 42 given at $.values[1].values
3732
3833 // Print all values using PHP-compatible types
3934 $ e ->template ->values = new PHPValuePrinter ();
4035
41- // After#1
36+ // Before: Passed value in "values" of {"values": 42} must be of type
37+ // list<ExampleDTO>, but 42 given at $.values[1].values
38+ // After#1: Passed value in string of stdClass must be of type
39+ // list<ExampleDTO>, but int given at $.values[1].values
4240 var_dump ($ e ->getMessage ());
43- // - Value#1: "of array"
44- // - Value#2: "but int given"
45- // - Message: Passed value in "values" of array must be of type
46- // list<ExampleDTO>, but int given at $.values[1].values
4741
4842
4943 // In case of symfony/var-dumper is installed, we can use it
5044 if (\Composer \InstalledVersions::isInstalled ('symfony/var-dumper ' )) {
5145 // Print all values using SymfonyValuePrinter
5246 $ e ->template ->values = new SymfonyValuePrinter ();
5347
54- // After#2
48+ // Before: Passed value in "values" of {"values": 42} must be of type
49+ // list<ExampleDTO>, but 42 given at $.values[1].values
50+ // After#1: Passed value in string of stdClass must be of type
51+ // list<ExampleDTO>, but int given at $.values[1].values
52+ // After#2: Passed value in "values" of {#394
53+ // +"values": 42
54+ // } must be of type list<ExampleDTO>, but 42 given at $.values[1].values
5555 var_dump ($ e ->getMessage ());
56- // - Value#1: "of array:1 [
57- // "values" => 42
58- // ]"
59- // - Value#2: "but 42 given"
60- // - Message: Passed value in "values" of array:1 [
61- // "values" => 42
62- // ] must be of type list<ExampleDTO>, but 42 given at $.values[1].values
6356 }
6457}
0 commit comments