phpspec / prophecy

Highly opinionated mocking framework for PHP 5.3+
MIT License
8.53k stars 241 forks source link

Please allow PHP 8.2 in composer.json #556

Closed lolli42 closed 1 year ago

lolli42 commented 2 years ago

PHP 8.2 is beta now. It would be great if prophecy could unblock it in composer.json.

alecpl commented 2 years ago

Yes, please. I had to set composer platform.php to 8.1 to be able to install phpunit v9 (which depends on prophecy).

ciaranmcnulty commented 2 years ago

We can't really allow it until the new features are all supported or at least error with sensible messages; this will require someone to go through the various new features and make a list

You can use --ignore-platform-req=PHP with composer to try things out for now

sbuerk commented 2 years ago

Maybe the "<8.2" can be removed - so at least executing with PHP8.2 is possible. We are testing codebase with different php versions. Using --ignore-platform-req=PHP is a ugly workaround.

Can be said, that new PHP8.2 language features are not supported yet.

lolli42 commented 2 years ago

Agreed.

Since prophecy is a direct dependency in phpunit 9, blocking PHP 8.2 here forces quite a few repositories to go with --ignore-platform-req=PHP+ in their CI when they want to add PHP 8.2 based runs now. Even if their tests don't use prophecy at all.

It would be great if composer.json could allow PHP 8.2 already, even if prophecy did not implement all features or fixes just yet.

What do you think?

ciaranmcnulty commented 2 years ago

We can't do that, there's a high probability that 8.3 will break prophecy (there hasn't really been a PHP minor that didn't break something)

I think teams testing with pre-release versions of PHP should be ok with adding an extra composer flag to their edge builds

sbuerk commented 2 years ago

Than change to <8.3 in the constraint.

Not agreeing on that. We start to test early to get things done and look how dependencies are doing, helping or reporting it if there are problems (if reasonable doable).

So, can we hope on a change with PHP8.2.0 release than at least "please" ?

ciaranmcnulty commented 2 years ago

There are zero service guarantees about when prophecy is going to support new PHP versions; it depends on the community and maintainers doing the work

The things that need to happen would be:

  1. Open issues for all the PHP 8.2 changes that could impact prophecy
  2. Fix them with test coverage
  3. Do a release when all the issues are closed

All but 3 can be done without maintainer permissions

lolli42 commented 2 years ago

Alright. Thanks for feedback!

danon commented 2 years ago

We can't really allow it until the new features are all supported or at least error with sensible messages; this will require someone to go through the various new features and make a list

You can use --ignore-platform-req=PHP with composer to try things out for now

So that means PhpUnit (which uses phpspec/prophecy) doesn't work on PHP 8.2?

PS: --ignore-platform-req=PHP doesn't work for PhpUnit because it will try to install older PhpUnit and fail in runtime.

What works as a workaround is adding this to composer.json.

"replace": { "phpspec/prophecy": "*" },
sbuerk commented 2 years ago

@Danon that would not work if you "need/want" prophecy but also PHP8.2.

danon commented 2 years ago

@sbuerk I need PhpUnit on PHP 8.2, and it also uses phpspec/prophecy

sebastianbergmann commented 2 years ago

So that means PhpUnit (which uses phpspec/prophecy) doesn't work on PHP 8.2?

PHPUnit 8.5 and PHPUnit 9.5 work "just fine" on PHP 8.2. Until this issue is resolved, though, you need to work around it when installing PHPUnit using Composer. If you use PHPUnit from a PHP Archive (PHAR), which you should: it's the recommended best practice, then you are not affected by this issue.

More details can be found here: https://github.com/sebastianbergmann/phpunit/issues/5033#issuecomment-1221992857

danon commented 2 years ago

@sebastianbergmann When do you think PhpUnit will be installable through composer on php 8.2 without any workarounds?

sebastianbergmann commented 2 years ago

@sebastianbergmann When so you think php unit will be instalalble Through composer on php 8.2 without any work around?

When there is a Prophecy release that supports PHP 8.2.

When PHPUnit 8.5.29 and PHPUnit 9.5.23 have been released.

danon commented 1 year ago

@sebastianbergmann Cool, thank you very much.

stof commented 1 year ago

The Prophecy 1.16 version has support for PHP 8.2