phpspec / prophecy

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

PHP 8.3 compatibility checks. #608

Closed rajeshreeputra closed 7 months ago

glo71317 commented 8 months ago

@stof Any plan to merge this PR because we are blocked due to this dependency in our code base.

stof commented 8 months ago

@glo71317 my previous review comments are still relevant. We won't be releasing a version saying PHP 8.3 works right now. To try RC versions, the way to go is to use --ignore-platform-req=php+

kylekatarnls commented 7 months ago

It's released for a week now, this package is the only one still blocking to upgrade PHP without work-around at the moment some of the projects I work on. 🙏

kylekatarnls commented 7 months ago

On another note, waiting for a PHP version to be stable-release to support it in a library sounds ultra-drastic to me. Most of the libraries just test in advance coming versions to ensure they are compatible, most of them also use range such as ^8.1 that just allow whatever <9 and depending on how deprecation are anticipated (for instance adding 8.4 to Github Actions now allow to test with the dev branch of PHP and detect incompatibility ahead before it can impact users of the library), updating can be actually smoother with a major range compatibility.

I don't say it's the only way, just raising alternatives in case it were not investigated in details.

stof commented 7 months ago

@kylekatarnls See my previous comment in https://github.com/phpspec/prophecy/pull/608#discussion_r1400702168 about why using ^8.1 is not an option for Prophecy.

And for testing the dev branch of PHP, I already highlighted multiple times the --ignore-platform-req=php+ option of composer which is precisely about allowing such testing. Note that for a mocking library, running our existing testsuite on a new version of PHP is not enough to know that we support the new version (this generally goes well). The complex part is figuring out whether mocking classes that use the new features of the language works well.

Wirone commented 7 months ago

@kylekatarnls PHP is not SemVer, so using open constraints like ^8.1 is discouraged, especially for mocking library that needs to be up-to-date with language's syntax and features.

@stof but wouldn't it be possible to prepare internal test cases that just utilise PHP 8.3 features and verify if everything works? In Fixer we also don't use PHP 8.3 features (code is 7.4-compatible), but we have integration test that verifies if fixer properly fixes files with 8.3 syntax. Is it possible in Prophecy to prepare such tests?

stof commented 7 months ago

@Wirone The issue is that since months that we said that this is the kind of checks that are needed to be able to know whether PHP 8.3 works fine (see https://github.com/phpspec/prophecy/issues/607), nobody in the community made such tests (or at least nobody reported the result to the repo if they tried it in separate codebase). It is not that it is not possible to do it. The issue is that it is not done.

maxhelias commented 7 months ago

I use the --ignore-platform-req=php+ option on phone-number-bundle to get the tests on the development version : https://github.com/odolbeau/phone-number-bundle/blob/master/.github/workflows/tests.yml#L27 Of course, there aren't many tests, but we have nothing to report on prophesize.