phpspec / prophecy

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

PHP 8.3 support #607

Closed vishalkhode1 closed 11 months ago

vishalkhode1 commented 1 year ago

What's the plan to provide support for PHP 8.3, which is scheduled for release on November 23, 2023, with the first RC version set to be release on August 31, 2023.

stof commented 1 year ago

It will depend on community contributions to identify which new features of PHP 8.3 are requiring changes in Prophecy to allow doubling them. If you find incompatibilities, please report them as issues in the issue tracker (one issue per problem please, not a generic one mixing all compat issues as it makes it harder to track resolution). And then, if you have time to contribute a fix, it is even better.

To test things, you can use the --ignore-platform-req=php+ flag of composer to allow ignoring the upper bound of the PHP requirement to allow installing it on PHP 8.3 (that's exactly what this flag is about).

rajeshreeputra commented 1 year ago

Created PR attaching results:

Screenshot 2023-08-24 at 12 34 16 PM

Also Created PR for phpspec/phpspec plugin for the same.

Screenshot 2023-08-24 at 12 59 11 PM
stof commented 1 year ago

@rajeshreeputra having a green CI does not mean that we support PHP 8.3 though. It means we support code using older features when running on 8.3. Support for language features added in PHP 8.3 is not covered by the existing testsuite.

Ocramius commented 1 year ago

I think #[\Override] may need some codegen adjustments here:

Selection_461

https://wiki.php.net/rfc

stof commented 1 year ago

Given that the Override attribute is not required when overriding a method (even when the parent method is itself using the attribute), I don't think it requires any code gen change.

Wirone commented 1 year ago

From my perspective, what could be interesting from mocking library's perspective is:

All of them (at least first 2) in terms of optimising generated code. But it's a wild guess only, I don't know about Prophecy's internal much.

stof commented 1 year ago

Prophecy does not rely on anonymous classes (and currently does not support mocking readonly classes anyway as its internal implementation currently requires a mutable property in the mock class)

stof commented 1 year ago

typed class constants should not affect us as the generated mock class does not redefine constants.

Jean85 commented 11 months ago

Ok, so the conclusion is that we don't need any additional work to support PHP 8.3, right?

soyuka commented 11 months ago

let's just bump the supported version then?

andypost commented 11 months ago

Drupal also awaiting of new release with PHP 8.3.* support https://www.drupal.org/project/drupal/issues/3406622

stof commented 11 months ago

1.18.0 has been released and includes it.