core
core copied to clipboard
Incompatibility with PHP 8.1 in v4.0.0
API Platform version(s) affected: 4.0.0
Description
According to the requirement at Packagist, 4.0.0 is supposed to be compatible with PHP 8.1.0+. However, the use of a language feature (https://wiki.php.net/rfc/readonly_classes) supported in PHP 8.2+ introduced in https://github.com/api-platform/core/commit/7110dc665bde47b15dcfe8b1e3198427f8a78938 seems to have broken this, because I get the following error when trying to execute on top of PHP 8.1.29:
Parse error: syntax error, unexpected token "readonly", expecting "abstract" or "final" or "class" in vendor/api-platform/core/src/Hydra/Serializer/HydraPrefixNameConverter.php on line 20
How to reproduce
I'll follow-up with a simple reproduction shortly.
My bad, we wanted to support php 8.2 only for v4.0.
@soyuka thank you very much for your quick response! I see that you've also pulled the release, which is great.
@soyuka the v4.0.0 release seems to be back on Packagist. Was this intentional by any chance?
If one was using PHP 8.1, running composer install api-platform/core would install this incompatible version.
It also results in renovate to suggest an update, which fails with an error.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
It seems that v4.0.0 on Packagist now requires PHP 8.2 as originally intended, so we can definitely close this one.
Thanks for addressing the issue!