Skip to content

Conversation

@NickDickinsonWilde
Copy link
Contributor

PHP 8.4 has deprecated implicit nullable types.. This will work as low as PHP 7.1 so no compatibility issues, but due to changed function signatures may necessitate a new major.

@bojanz
Copy link
Contributor

bojanz commented Jan 5, 2025

As mentioned in the Drupal issue, breaking BC would require us to open a v3.0.0 branch, and I am not comfortable doing that for now, since v2 is still fairly new and hasn't achieved full adoption.

Users should turn off deprecation errors if these errors bother them.

I'll re-evaluate this decision at the end of 2025.

@simoheinonen

This comment was marked as resolved.

@ekes
Copy link

ekes commented Jan 10, 2025

I don't see how this is a BC break. It's making explicit what is implicit. PHP is already interpreting it as ?type $v = NULL, when it is type $v = NULL.

To check I just run a test: Inheriting ?string with string https://3v4l.org/gas1U it's not complaining the signatures are different. In fact as this error shows https://3v4l.org/81TKa PHP (back to PHP7.1) actually interprets string $s = NULL as ?string $s = NULL.

Update from https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated#change

On class methods, changing implicit nullable parameters to explicit parameters is not a backward-compatibility break.
Parent classes and child classes can replace the implicitly nullable parameter declarations with explicit declarations independently.

@bojanz
Copy link
Contributor

bojanz commented Jan 13, 2025

I stand corrected, thank you @ekes. I just assumed PHP would complain.

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.

4 participants