Since the v1.2.5 my code throws type error, because Helpers::getCastStrategy expects array or single value, but gets stdClass when using data object with constructor.
testArrayOfUsers
TypeError: RBCB\Schema\User::__construct(): Argument #1 ($xxxx) must be of type ?string, stdClass given, called in
vendor/nette/schema/src/Schema/Helpers.php on line 186
Expect::from() didn't support promoted properties, it used to work actually just because all parameters had a default value. I tried adding direct support for the constructor.
Version: v1.2.5
Bug Description
Since the v1.2.5 my code throws type error, because Helpers::getCastStrategy expects array or single value, but gets stdClass when using data object with constructor.
Steps To Reproduce
And the DTO
Expected Behavior
Im unsure if I need to cast it manually, so let me know if I use the schema correctly or not.
Possible Solution
Editing the
method_exists($type, '__construct')
for supporting stdClass.