You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class Foo {
publicfunctiondoSomething(\stdClass$a = null, $b) {
}
}
$factory = new \ProxyManager\Factory\LazyLoadingValueHolderFactory();
$proxy = $factory->createProxy(
Foo::class,
function (& $wrappedObject, $proxy, $method, $parameters, & $initializer) {
$wrappedObject = newFoo(); // instantiation logic here$initializer = null; // turning off further lazy initialization
}
);
$proxy->doSomething(null, 'hi');
Executing the code fails with the following message:
PHP Fatal error: Uncaught TypeError: Argument 1 passed to ProxyManagerGeneratedProxy__PM__\Foo\Generated8c05591d466b1fbc8b27e31e8bbeac21::doSomething() must be an instance of stdClass, null given, called in [...]
The function in the proxy is generated with the following code:
It looks like the parameter's default value (null) is skipped, if the parameter is not optional. This prevents me from passing null to the function instead of an object.
This happens with version 1 and 2.
The text was updated successfully, but these errors were encountered:
Consider the following code:
Executing the code fails with the following message:
The function in the proxy is generated with the following code:
It looks like the parameter's default value (null) is skipped, if the parameter is not optional. This prevents me from passing null to the function instead of an object.
This happens with version 1 and 2.
The text was updated successfully, but these errors were encountered: