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

Add nullable type to types that will throw deprecation errors in PHP 8.4 #12023

Open
wants to merge 3 commits into
base: 9.2.x
Choose a base branch
from

Conversation

KorvinSzanto
Copy link
Member

@KorvinSzanto KorvinSzanto commented Apr 11, 2024

This PR prevents the upcoming php 8.4 deprecation errors caused by nullable parameters being typed without a nullable type.

Interestingly, this also uncovered a couple places where constructors had parameters with default values before parameters without default variables, which is also deprectated. See eb938a6 and c1a6a57 for the specific backwards-compatible fixes for that

Fixer can be seen here: https://gist.github.com/KorvinSzanto/13eed5210561f6d090b159eae65b93a6
See https://wiki.php.net/rfc/deprecate-implicitly-nullable-types for more info

@KorvinSzanto KorvinSzanto marked this pull request as draft April 11, 2024 16:37
@mlocati
Copy link
Contributor

mlocati commented Apr 11, 2024

Against 9.2.x? If so, will the minimum requirement of 9.2 be raised to PHP 8?
Otherwise we could use ?something instead of something|null

@KorvinSzanto
Copy link
Member Author

Otherwise we could use ?something instead of something|null

That's fair, I've updated the PR

@KorvinSzanto KorvinSzanto changed the title Add null union type to types that will throw deprecation errors in PHP 8.4 Add nullable type to types that will throw deprecation errors in PHP 8.4 Apr 12, 2024
@aembler
Copy link
Member

aembler commented May 7, 2024

This is going to be an absolute nightmare to get into 10.x and 9.3.x as it is. I honestly don't know how we're going to do it. I'd strongly recommend this going into 9.3.

@aembler
Copy link
Member

aembler commented May 7, 2024

Never mind, I see that you have a separate PR for 10. Thank you!

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

Successfully merging this pull request may close these issues.

None yet

3 participants