Skip to content

[VarExporter] Initializer function throws too few arguments error when using with a propertyName and propertyScope #59790

@SherinBloemendaal

Description

@SherinBloemendaal

Symfony version(s) affected

7.2.0

Description

https://symfony.com/doc/current/components/var_exporter.html#creating-lazy-objects states you can pass a $propertyName and $propertyScope to the initializer function but this results into a "Too few arguments to function" error. As far as I can see the LazyObjectState does not pass these arguments. Is this intentional?

Code:

Docs:

$processor = LazyHashProcessor::createLazyGhost(initializer: function (HashProcessor $instance, string $propertyName, ?string $propertyScope): mixed {
...

How to reproduce

Create a LazyGhost object with initializer function:

SomeLazyGhost::createLazyGhost(initializer: function (HashProcessor $instance, string $propertyName, ?string $propertyScope): mixed {
    // ...
});

Possible Solution

It seems adding them would not result into a BC.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions