Make nullable parameters explicitly nullable #1205
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For improved compatibility with PHP 8.4, and to reduce the amount of error noise we see when running under that version, this change fixes a number of method signatures where parameters are implicitly nullable. For example:
$store
must be of typeActionScheduler_Store
, but if not specified by the caller it is set tonull
. This is fine, but as of PHP 8.4 we are encouraged to be explicit about it, so we need:The problem with the above is that
?Type
is only valid from PHP 7.1 onwards, whereas we still support PHP 7.0. We also cannot yet use type unions. So, we have a decision to make: