-
Notifications
You must be signed in to change notification settings - Fork 46
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
Support PHPCompatibility testVersion config #206
Support PHPCompatibility testVersion config #206
Conversation
05a3a3d
to
257b6aa
Compare
Codecov Report
@@ Coverage Diff @@
## master #206 +/- ##
============================================
- Coverage 82.99% 82.96% -0.03%
- Complexity 673 675 +2
============================================
Files 74 74
Lines 2099 2108 +9
============================================
+ Hits 1742 1749 +7
- Misses 357 359 +2
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
If you are happy with this change, it would be good to update the sample GitHub action file. Here's an example testVersion value for testing from PHP 7.1 through PHP 99.0: |
Hi @jrchamp, many thanks for the contribution! Coincidentally... recently I was thinking about which could be the best way to implement the very same in
What do you think about that extra point 2 behaviour? Then, regarding your current patch, that implements point 1 above, few comments...
Let's discuss about this a little bit... ciao :-) Edited: Grrr... too many wiki/markdown/confluence flavours for my brain. Sorry for the typos. |
Hi again, just sharing a better and simpler idea that @andrewnicols came with while we were discussing about this. Can you try if just setting this into the
It seems to be working ok here and, depending of the range I use... I get different PHPCompatibility reports. If it works as expected... it's really the ideal place, because every moodle branch can come with the correct range specified in that existing file (since Moodle 3.11). I think that could replace the point 2 in my proposal above perfectly. Of course, still, I think that we should create the new option (point 1) like your patch does so, if anybody want to use a custom range for any reason (say old branches, or only want to test against one php version each run, or ...) it can be done. What do you think? |
https://tracker.moodle.org/browse/MDL-77458 Note: These can co-exist. We shoudl do the .phpcs.xml change but being able to override it per run is very useful still. |
It's cool if we get it working by default everywhere by the grace of MDL-77458 , yay! And yes, still this PR makes sense, for anybody wanting to explicitly check for other ranges different from the "default" ones coming from core. So I just would suggest to consider/amend the four points commented above (maybe we don't need the 4th as far as, by default, it will "just work", @jrchamp and this can land too. Yay^2 , ciao :-) |
257b6aa
to
ad757df
Compare
Okay, I've updated the command option to use the // Default to the current version.
$testVersion = PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION; I have removed that code, so that it does not overwrite the values that are being added by MDL-77458. |
Thanks @jrchamp , I'm looking to this, specifically to check if can add some unit test to cover it. Other than that, it looks ok IMO. Will comment soon... |
Hi @jrchamp . I've added a commit to your branch, adding a few test to verify the new
Ciao :-) |
Ok, the "codecov-project" job above is failing, but it's because of some recent changes to PostgreSQL connection, required by Travis. So we can safely ignore it. The important point is that the "codecov-patch" job is telling us that we have covered 100% of the code modified by the PR. So, so far, all good, coverage-wise. |
For the records, this has been backported to the 3.x branch... will make a release soon... ciao :-) |
After reading through the PHPCompatibility documentation, it seems that without setting the testVersion value, we are not getting the errors for backward-incompatible functionality. Specifically, functions, constants, syntaxes and classes that were added in newer versions were not being reported. It was only reporting forward-incompatible changes (functionality that had been removed in newer versions of PHP).
Fixes #205