-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[Rector] Add Rector to CI for PHP upgrades code to PHP 8 #3876
Conversation
2a0b46f
to
3862956
Compare
/cc @TomasVotruba :) |
Ready to merge 👍 |
I like a lot of what this change is doing, but there definitely seems to be a problem. We don't depend on Scrutinizer as much as we did, but it still has some use, and this change seems to have broken it completely. 483 issues introduced? Issues like "The type PhpOffice\PhpSpreadsheet\Shared\Date was not found"? As a sanity test, I submitted a draft PR with a minor change, and nothing like that showed up for my PR, so it must be something in yours. I would need to see these "issues" eliminated, or at least explained, before I could consider moving this forward. |
It seems clear that Scrutinizer cannot handle some of the new syntax (e.g. underscores as group separators for large integer constants), at least not when running Php8.1. I am running another test to see if Scrutinizer does any better running Php8.3. |
Scrutinizer could not build the Php8.3 environment correctly. Trying 8.2. |
8.2 does better, but I'm not sure it's better enough. It flags the separator underscore as a syntax error, but at least it doesn't the class become unknown everywhere that it's referred to. Please try setting 8.2 as the Php version in scrutinizer.yml, and let's see the results. |
@oleibman ok, updated 👍 |
scrutinizer error error seems unrelated with underscored literal number, thats on unknown class issue, I previously exclude literal number change before squash and enable it |
8078310
to
fde5f55
Compare
Ready to merge 👍 |
I don't envy whoever chooses to review this PR. That's a lot of files changed, including style |
I have filed a bug report with Scrutinizer about the underscore separators - that's one of the changes I liked the best, and it would be a shame to not be able to use it. So far:
We'll see if anything comes of it. |
@MarkBaker @PowerKiKi I know it's a lot to review, but the changes are all fairly simple. I think it's similar in scope to other recent changes applied after eliminating support for Php7.4, e.g. moving typing from doc-blocks to code, or using MATCH in place of many-pronged IFs. Downside - a lot of changes with no real effect on functionality. Upside - a more modern-looking code base. Do either of you have any strong feelings on whether we should proceed with it if my review concludes that it ought to work? |
public function __construct(/** | ||
* Instance of the spreadsheet this Calculation Engine is using. | ||
*/ | ||
private ?Spreadsheet $spreadsheet = null | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't great. It looks ugly, even more so with multiple parameters, and it is not supported by any IDE AFAIK. Instead it should be a proper @param
annotation IMHO.
EDIT: I'd rather ignore the entire rector if it cannot produce adequate result, which is exactly what I did in the past, or fix it manually.
Rector is an awesome tool, but it also sometime produces subpar results (and rarely plain wrong). As illustrated by comment above. I am not convinced it is a good idea to integrate it into the CI as-is. I think I'd rather use it as a one-shot tool. I am wondering about the friction it would add for future contributions. Would it be acceptable ? If we decide to have it in the CI, at the very least we should apply rectors one by one per commit, like I did. So at least it is easier to review. Once we added the entire list up to PHP 8.0, then we can switch the config to be the rector for PHP 8.0. And the code would stay intact for that particular commit. That way it would be a lot easier to blame a specific rector in the future if something went awry. I am not exactly against this PR, but I am not entirely favorable either. I think it is somewhat risky, for the code, and for the workflow of future contributions. |
sure, I will try create smaller PRs when I have a chance, thank you for the review. |
This is:
Checklist:
Why this change is needed?
Hi, this PR provide a Rector to CI to for PHP upgrades code to PHP 8