Ocramius/ProxyManager

Bug in psalm annotation or in readme

vjik opened this issue · 6 comments

vjik commented

Here returned boolean value:

@psalm-param Closure(
  RealObjectType|null=,
  RealObjectType&ValueHolderInterface<RealObjectType>&VirtualProxyInterface=,
  string=,
  array<string, mixed>=,
  ?Closure=
) : bool $initializer

In readme $initializer doesn't return anything:

$factory = new \ProxyManager\Factory\LazyLoadingValueHolderFactory();

$proxy = $factory->createProxy(
    \MyApp\HeavyComplexObject::class,
    function (& $wrappedObject, $proxy, $method, $parameters, & $initializer) {
        $wrappedObject = new \MyApp\HeavyComplexObject(); // instantiation logic here
        $initializer   = null; // turning off further lazy initialization
    }
);

@vjik indeed, can we adjust the readme?

vjik commented

@vjik indeed, can we adjust the readme?

In docs in example returned true.

vjik commented

I don't know how to right :(
Need with return or need w/o return.

vjik commented