Skip to content

Commit 6caced5

Browse files
committed
Throwing exceptions if Valinor can't return an object.
1 parent 85cb9bc commit 6caced5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Response/Base.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
abstract class Base
88
{
9+
/**
10+
* @throws Valinor\Mapper\MappingError
11+
*/
912
public static function fromArray(mixed $data): static
1013
{
1114
try {
1215
return (new Valinor\MapperBuilder())
13-
->enableFlexibleCasting()
14-
->allowSuperfluousKeys()
15-
->allowPermissiveTypes()
1616
->mapper()
1717
->map(
1818
static::class,
@@ -28,6 +28,8 @@ public static function fromArray(mixed $data): static
2828
foreach ($errorMessages as $message) {
2929
echo $message . PHP_EOL;
3030
}
31+
32+
throw $error;
3133
}
3234
}
3335
}

0 commit comments

Comments
 (0)