Original Nette schema: https://github.com/nette/schema
Let's imagine following class:
class Foo
{
public function __construct(
public int $a,
public int $b,
) {
}
}
Casting to this class will result in ArgumentCountError because Schema is instantiating the class using new keyword.
I solved this with adding second argument to castTo: castTo(string $type, bool $usingReflection = false): self
- default behavior is not changed, so it's not causing BC break.