Closed fredden closed 7 months ago
@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: https://github.com/squizlabs/PHP_CodeSniffer/issues/2968#issuecomment-653831324 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.
I've been down a rabbit hole today. I started with https://github.com/PHPCompatibility/PHPCompatibility/pull/1689 and ended up here setting
nullable_type
totrue
when a type is allowed to be null.