I’m trying to invoke public ReflectionClass::newInstanceArgs(array $args = []): ?object
method on class which has the following constructor:
public function __construct(Option ...$options) {
$this->options = $options;
}
$args
has the following structure:
[options] => Array
(
[0] => HooDTOsOption Object
(
[value] => +370
[selected] => 1
)
[1] => HooDTOsOption Object
(
[value] => +371
[selected] =>
)
)
I’m getting the following error:
[TypeError]
HooDTOsSelect::__construct(): Argument #1 must be of type HooDTOsOption, array given (0)
I assume that $args
has to be different but I don’t really understand how it should look like.
https://www.php.net/manual/en/reflectionclass.newinstanceargs.php doesn’t give anything about it so I would appreciate any help.
1