Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeHinting setters with nullable values #1462

Open
gregoclock opened this issue Feb 27, 2024 · 0 comments
Open

TypeHinting setters with nullable values #1462

gregoclock opened this issue Feb 27, 2024 · 0 comments

Comments

@gregoclock
Copy link

Hello

When creating entities with the maker, all attributes are typehinted as nullable. see this issue

It creates problems when the form component receives empty or null data.

Why not typehint the setter as nullable as well ?

To do so
In ClassSourceManipulator::createSetterNodeBuilder

        if (null !== $type) {
            // $paramBuilder->setType($isNullable ? new Node\NullableType(new Node\Identifier($type)) : $type);
            $paramBuilder->setType(new Node\NullableType(new Node\Identifier($type)));
        }

should become

       $paramBuilder->setType(new Node\NullableType(new Node\Identifier($type)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant