-
Notifications
You must be signed in to change notification settings - Fork 187
Remove illegal annotation #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The `@expectedException` is deprecated, and removed in PHPUnit 9. https://thephp.cc/articles/migrating-to-phpunit-9
|
This is why we should split this stuff outside in an @Seldaek we could do that with the new versioning flow for PSR, and @Crell already invited you to proceed with that: https://groups.google.com/g/php-fig/c/Ms_iGZuUP6Y |
|
Yeah I'm not against doing this, i just don't have time.. If someone does feel free to take over. |
|
Would it make sense to merge this while the more long-term solution is being considered? 😃 |
|
IMHO no because it would break for anyone with old PHPUnit versions. |
|
I have PRs up now for typed v2 and v2 versions that remove the test classes entirely, as they have no business being in this package to begin with. See: php-fig/fig-standards#1231 If someone wants the test classes, they belong in a util package instead. |
|
I see. I guess I am coming more from the following point of view. Right now, otherwise legal tests are failing due to the deprecated annotation. The fix is to remove the annotation, in favour of what is suggested, reasonable, and practical: explicit method call. If someone has not migrated their tests to PHPUnit 9, and they want to build on PHP 8, then it's not possible - some things just aren't - and it's their choice what they want to sacrifice (probably in terms of PHP version support). Of course, migrating your tests would mean probably dropping support for PHP version for which there isn't a PHPUnit that supports that annotation. That decision, as well as how to overcome the problem, is of course entirely up to you. I just hope it is made sooner rather than later. 😊 |
|
According to https://packagist.org/packages/psr/log/php-stats, PHP 5 usage is around 3%. 7.2 and up accounts for the vast majority of uses. I'm not sure how that corresponds to PHPUnit versions, though. Depending on the version matching it's possible we could switch the tests to use the updated PHPUnit approach in a 1.2 release, and then let them get dropped entirely in the 2.0/3.0 releases. However, that could also be a BC break for someone using these tests, depending on their PHPunit version. We also have no idea how many people even use these test classes to begin with. I still think just killing them ASAP is the best approach. |
|
PHPUnit 4 is the latest version that supports PHP 5 and not PHP 7. PHPUnit 5 is the latest that supports PHP 5 at all. Since then, there have been many deprecations and BC breaks. I know that BC break is an important concern, especially for an interop package. However, working for a WP agency, I know that even in WP, which is probably the area with most legacy code of all, only 14% of sites are on PHP 5, and those are speculated to probably be mostly abandoned installations. Besides this, although this change might break builds for a small percentage of users, BC breaks in dependencies do not constitute a BC break in dependants, strictly speaking. But I'm sure none of this is news for any of you 🙂; it's just my 5c. Also, |
|
So, I tried it in annotation-and-call branch. The build reveals the following:
Since point 2 prevents builds on PHP 5.3 and 5.4 anyway due to incompatible syntax (although it can be fixed, but there are more occurrences), this suggests that dropping support for those versions of PHP is not that bad of a break. |
This also addresses php-fig/log#75.
|
I think this is no longer relevant with the v2 and v3 releases, especially as there's now a util package for the tests instead. Let's continue the test discussion over there. |
The
@expectedExceptionannotation is deprecated, and removed in PHPUnit 9. When testing with PHPUnit 8, the following warning appears for every time a logger test is run:With PHPUnit 9.5.4, the tests fail with the following error: