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

Default for nullable_type_declaration_for_default_null_value #235

Closed
otsch opened this issue Dec 1, 2023 · 4 comments
Closed

Default for nullable_type_declaration_for_default_null_value #235

otsch opened this issue Dec 1, 2023 · 4 comments

Comments

@otsch
Copy link
Contributor

otsch commented Dec 1, 2023

After updating pint I noticed, that it changed a lot of method signatures like:

- public function foo(?string $arg = null): string
+ public function foo(string $arg = null): string

I later posted on Twitter, because I thought that's maybe not an ideal default. And I just got responses from @kocsismate and @Girgias (https://twitter.com/kocsismate90/status/1730711133042958637), saying that support for implicit nullability exists only for backwards compatibility reasons and that it will be deprecated and removed from PHP sooner or later. So, I would suggest changing the default in pint, introduced with #192.

otsch added a commit to otsch/pint that referenced this issue Dec 1, 2023
Because support for implicit support for implicit nullability exists
only for backwards compatibility reasons and will be removed in the
future. See laravel#235.
@driesvints
Copy link
Member

Thanks, seems you already sent in a PR for it 👍

taylorotwell pushed a commit that referenced this issue Dec 4, 2023
…236)

Because support for implicit support for implicit nullability exists
only for backwards compatibility reasons and will be removed in the
future. See #235.
@morrisonlevi
Copy link

👋 Just chiming in as the nullable types RFC author: yes, implicit nullability was required for backward compatibility with PHP 5. Remember, this landed in PHP 7.1, so this was important at the time. It is not important now. I also suggest using the explicit version for any code which doesn't need PHP 5 compatibility. I wish I had put that recommendation in the RFC.

@dennisvandalen
Copy link

I also suggest using the explicit version for any code which doesn't need PHP 5 compatibility. I wish I had put that recommendation in the RFC.

As per @morrisonlevi's suggestion. I think a lot of people would prefer the explicity?

@kocsismate
Copy link

P.S.: I have already filed the implementation for deprecating the implicitly nullable parameter types: php/php-src#12959 the RFC is underway.

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

5 participants