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

Set nullable_type = true when type is nullable #566

Conversation

fredden
Copy link
Member

@fredden fredden commented Mar 15, 2024

I've been down a rabbit hole today. I started with PHPCompatibility/PHPCompatibility#1689 and ended up here setting nullable_type to true when a type is allowed to be null.

@jrfnl
Copy link
Member

jrfnl commented Mar 16, 2024

@fredden Sorry you went through such a rabbit hole, but this is by design.

When union types were introduced and I added support for them to the PHPCS native getMethodParameters() method, it was decided that nullable_type is only for the nullability operator. See: squizlabs/PHP_CodeSniffer#2968 (comment) and the replies to that.

The PHPCSUtils getParameters() method closely mirrors the getMethodParameters() method and should stay compatible with it, so it can be used as a one-on-one replacement.

This PR breaks that premise.

It would also be a breaking change, which can only be made in a major release.

For those reasons, I will not accept this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants