-
Notifications
You must be signed in to change notification settings - Fork 11
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
Support for nullable type notation #349
Comments
The following sniffs do not support nullable type notation: * Spryker.Commenting.DocBlockParamAllowDefaultValue.Default * Spryker.Commenting.DocBlockReturnNullableType.ReturnNullableMissing See spryker/code-sniffer#349.
That is an interesting one. I wonder if that normalization overhead makes sense now that we have the verbose way of using |
The RFC for union types (https://wiki.php.net/rfc/union_types_v2) has a section on nullable types that explicitly addresses this issue. Specifically, it notes:
Therefore, only Personally, I prefer to use the Though I'm not involved in the development of PHP, I think it'd be more likely that the shorthand syntax gets expanded to union types in the future, rather than being replaced by the longhand syntax, as Nikita goes on to say:
|
We could do the following
This would keep the behavior while allowing a project (yours e.g.) to use your preferred way of documentation. Would you be interested in providing a PR? |
I was wondering if it would be possible to support nullable type notation (e.g.
?type
) instead of requiringtype|null
. The benefit of supporting nullable type notation is that it would help improve parity between inline PHP typehints and docblock typehints.I have found that the following sniffs do not support nullable types, though there may be more:
Here is a specific example:
Thanks for your time!
The text was updated successfully, but these errors were encountered: