Skip to content

Conversation

theodorejb
Copy link
Contributor

This must have been a typo, since it's the only instance where the non-standard syntax is used.

This must have been a typo, since it's the only instance where the non-standard syntax is used.
@WyriHaximus WyriHaximus added this to the v3.3.0 milestone Nov 15, 2024
@WyriHaximus
Copy link
Member

Hey, thanks @theodorejb for taking the time to file this PR. There are two things that bother me with this:

  • We have 10+ pairs of eyes on this and none of them spotted this across two PR, how did you find it? Did you ran into some kind of issue?
  • Why didn't our tests catch this 😅

@theodorejb
Copy link
Contributor Author

@WyriHaximus I ran a script across the top Composer packages to find any that were using the alternate switch case syntax, since I'm considering writing an RFC to deprecate it. In the top 1000 packages, this was one of only two where I found it used. All usages appeared to be typos (randomly mixed in with case statements using the standard syntax).

PHP-CS-Fixer will automatically find/fix these issues when using the @PER-CS ruleset (or even the old @PSR2 ruleset).

@WyriHaximus
Copy link
Member

WyriHaximus commented Nov 15, 2024

@theodorejb Ahh cool thanks, and tbh been doing PHP for 20+ years and only learned today this is valid syntax 🤦 . And honestly that RFC makes sense.

@clue clue added maintenance and removed bug labels Nov 19, 2024
Copy link
Member

@clue clue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@theodorejb TIL! Thanks for looking into this and best of luck with that RFC 👍

(I've marked this as maintenance to emphasize this shouldn't otherwise affect how this code functions.)

@clue clue merged commit 5f80055 into reactphp:3.x Nov 19, 2024
15 checks passed
@jrfnl
Copy link

jrfnl commented Aug 12, 2025

Could this fix please be released with due haste ?

The PHP 8.5 deprecation has been merged into PHP core and the nightly build for setup-php has been updated (at least the Windows image, the Linux one seems to still lag behind).

This effectively means that the deprecation notice for the code in the 3.2.0 version is currently causing composer installs to fail on PHP 8.5, which means other projects can no longer test against PHP 8.5 to assess their own readiness.

@jrfnl
Copy link

jrfnl commented Aug 12, 2025

For the record, this is the error I'm seeing:

image

@lolli42
Copy link

lolli42 commented Aug 13, 2025

Yeah. Release would be great due to the "global" composer usage.

We added PHP 8.5 to our CI matrix just yesterday, and decided to greenify our pipeline with a composer-patch: TYPO3/Fluid#1189 (just mentioning in case you need something, too).

@jrfnl
Copy link

jrfnl commented Aug 13, 2025

We added PHP 8.5 to our CI matrix just yesterday, and decided to greenify our pipeline with a composer-patch: TYPO3/Fluid#1189 (just mentioning in case you need something, too).

Just in case anyone desperately needs it - for most CIs, another work-around is to first setup-php with PHP 8.4, run composer install, then switch to PHP 8.5 to run the tests. (yes, setup-php allows you to switch PHP version midway a workflow 😍 )

A new release would be nicer, but ☝🏻 can unblock people if needs be, without needing to patch the package.

@jrfnl
Copy link

jrfnl commented Aug 13, 2025

@WyriHaximus @clue Just a heads-up: the PHP 8.5 Linux nightly image used by setup-php was updated a few hours ago, so you can expect the pressure related to this issue to grow exponentially soonish...
Also, please know, this comment is absolutely not meant as a complaint. I'm just the lighthouse watchperson trying to warn you there's a storm coming.... ❤️

WyriHaximus added a commit to WyriHaximus-labs/promise that referenced this pull request Aug 13, 2025
This builds on top of reactphp#264 porting that change to v2.
@WyriHaximus
Copy link
Member

Also, please know, this comment is absolutely not meant as a complaint. I'm just the lighthouse watchperson trying to warn you there's a storm coming.... ❤️

We know <3, but a few things.

This effectively means that the deprecation notice for the code in the 3.2.0 version is currently causing composer installs to fail on PHP 8.5, which means other projects can no longer test against PHP 8.5 to assess their own readiness.

Unless I misunderstood how composer builds its bins. It takes the lowest targeted version in range. Which is v2 of this package: https://github.com/composer/composer/blob/main/composer.json#L40 and that version still contains this issue:

case $type instanceof \ReflectionUnionType;
Filed #269 to resolve it in that version as well.

Could this fix please be released with due haste ?

We should.

@jrfnl
Copy link

jrfnl commented Aug 13, 2025

This effectively means that the deprecation notice for the code in the 3.2.0 version is currently causing composer installs to fail on PHP 8.5, which means other projects can no longer test against PHP 8.5 to assess their own readiness.

Unless I misunderstood how composer builds its bins. It takes the lowest targeted version in range. Which is v2 of this package: https://github.com/composer/composer/blob/main/composer.json#L40 and that version still contains this issue:

case $type instanceof \ReflectionUnionType;

Filed #269 to resolve it in that version as well.

@WyriHaximus Thanks for setting that up!

I've just read through the build scripts from Composer and from what I can see, the PHAR file should be using 3.2.0 at this moment.

How I got to that tentative conclusion:

This looks to be confirmed when checking the build-script from the last release: https://github.com/composer/composer/actions/runs/16201695550/job/45742084992#step:4:67

The LTS Composer 2.2 branch looks to be on react/promise v 1.3.0, but I don't think the LTS promise is about runtime compatibility with new PHP versions. IIRC, it's only for security fixes.
https://github.com/composer/composer/blob/927b1bfcf8942a3359cd290a91abcf7e6b605332/composer.lock#L573-L574

All in all, my supposition is that the "react/promise": "^2.11 || ^3.2" requirement is more about preventing conflicts for packages which have Composer as a runtime dependency and may use react/promise in their own requirements.
https://github.com/composer/composer/blob/d2a4543db8adc6b3d4b2fb652c953db629328986/composer.json#L40

This looks to be confirmed by the relevant commit and issue composer/composer#12188 which added the ^2.11.

Hope this helps!

@andypost
Copy link

Is there any expected date for patch release like 3.2.1?
It would help early adopters like Drupal

@jrfnl
Copy link

jrfnl commented Aug 15, 2025

@andypost You can use the work-around described here to continue testing against PHP 8.5 without this patch.

@andypost
Copy link

@jrfnl for Drupal it's just a part of problem so I have to patch vendor

@jrfnl
Copy link

jrfnl commented Aug 15, 2025

Just in case anyone needs some example code for the work-around I mentioned before, I'm applying it as a temporary measure to the PHPCS test workflow (as releasing a new major with red crosses on every workflow run makes me uncomfortable 😉)

Once a new version of Composer has been released, I'll revert it.

@WyriHaximus
Copy link
Member

For reference, the relevant RFC: https://wiki.php.net/rfc/deprecations_php_8_5#languagesyntax_deprecations

@clue
Copy link
Member

clue commented Aug 18, 2025

Also, please know, this comment is absolutely not meant as a complaint. I'm just the lighthouse watchperson trying to warn you there's a storm coming.... ❤️

@jrfnl Thanks for the friendly reminder. Discussed this PR earlier today in the team and will prioritize releasing this once the other maintenance PRs on this milestone are merged. Seeing this currently blocks Composer, definitely expect a release this week, hopefully in the next couple of days. If you're impatient, you can always support the project and may help speed things up by becoming a sponsor ❤️

@jrfnl
Copy link

jrfnl commented Aug 18, 2025

@clue Appreciate the update!

@clue clue changed the title Fix inconsistent switch case syntax Improve PHP 8.5+ support by avoiding deprecated switch case syntax Aug 18, 2025
@jrfnl
Copy link

jrfnl commented Aug 18, 2025

@clue P.S.: didn't mean to ignore your remark about funding, but I'm not the right audience for that. I'm only a lowly, barely paid open source maintainer myself.

So let me join you in the call for funding:
For anyone who comes across this issue and works for a company making money off open source: please fund ALL your dependencies if you want open source to survive.

@WyriHaximus
Copy link
Member

As I just merged #269 and as @clue noted on that PR, the v2 branch will need more changes to get it to work on PHP 8.4. However, as we haven't received any issues about PHP 8.4 compat, and as @jrfnl pointed out in #264 (comment) we're not considering a new v2 tag to address this, unless PHP 8.(4|5) support comes up in an (high profile) issue. Will review #271 tomorrow morning and if it's good merge and release it.

@WyriHaximus
Copy link
Member

Bit later than planned today, but v3.3.0 is here

@jrfnl
Copy link

jrfnl commented Aug 19, 2025

Thank you all for getting 3.3.0 released! Now, let's hope Composer updates and releases a new version soon ;-)

jrfnl added a commit to jrfnl/composer that referenced this pull request Aug 19, 2025
At this moment, nearly every single `composer install` on PHP 8.5 is failing on a deprecation notice coming from the `react/promise` package.

To mitigate this, the ReactPHP team has just released a new version and I'd like to suggest for Composer to update to that version and release a new version of Composer itself to unblock early adopters from testing with PHP 8.5.

Note: other than fixing the deprecation notice, the `3.3.0` release does not contain any user-facing changes.

Ref:
* reactphp/promise#264
* https://github.com/reactphp/promise/releases/tag/v3.3.0
* reactphp/promise@v3.2.0...v3.3.0
@jrfnl
Copy link

jrfnl commented Aug 19, 2025

FYI: I've opened a PR to Composer to update their dependency: composer/composer#12504

Seldaek pushed a commit to composer/composer that referenced this pull request Aug 20, 2025
At this moment, nearly every single `composer install` on PHP 8.5 is failing on a deprecation notice coming from the `react/promise` package.

To mitigate this, the ReactPHP team has just released a new version and I'd like to suggest for Composer to update to that version and release a new version of Composer itself to unblock early adopters from testing with PHP 8.5.

Note: other than fixing the deprecation notice, the `3.3.0` release does not contain any user-facing changes.

Ref:
* reactphp/promise#264
* https://github.com/reactphp/promise/releases/tag/v3.3.0
* reactphp/promise@v3.2.0...v3.3.0

Co-authored-by: jrfnl <jrfnl@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants