-
Notifications
You must be signed in to change notification settings - Fork 242
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
Introduce PHP-CS-Fixer #613
Conversation
This breaks testing on PHP 7.2 because of incompatible dependencies. This cannot be accepted as is. Also, it would be great to start with a php-cs-fixer that is a bit closer to our existing setup. For instance, I'm quite sure that the current codebase is mostly using concatenation without spaces (i.e. the |
Yeah, I'll try to figure out how to do it properly, keeping support for PHP 7.2+ 👍. |
@stof in terms of Fixer configuration, there are rules that cause diff regardless of the config, because the codebase is not consistent:
So basically each option have tradeoff and it needs to be decided what to do with each. I've now configured Fixer to use options that causes as little changes as possible (66 files changed instead of 118 as before). Let's see if it's acceptable 🙂. |
I was thinking about adding |
@stof it should be OK now (not counting CS) 🙂. Waiting for workflow approval is a frustrating experience for first-time contributors 😅. |
@Wirone I understand that and I generally change that setting to require it only for new github accounts instead of the github default value. But I don't have admin rights on the repo /cc @ciaranmcnulty |
FYI: PHPStan errors are fixed in #612, so maybe we should finish that one first. |
9810b7d
to
a17843d
Compare
@stof rebased and conflicts resolved, ready for review and deciding about the Fixer's ruleset 🙂. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
@stof You now have repo admin rights |
@Wirone can you add a commit accepting the changes so we can see if there's anything crazy, easily? |
b4fe9be
to
16bbfc7
Compare
@ciaranmcnulty Of course, here are the applied fixes 🙂. |
16bbfc7
to
95e97d1
Compare
@stof I've rebased the branch, re-applied coding standards for new code (amended previous commit), and added simple change to the Fixer config (disabled |
Instead of disabling |
@stof I wanted to do it initially, but as I wrote in the commit's message, it's against current coding standard in the project. But sure, I can do it if you want - it will add 15 commas across the code base. Do you want me to do it? |
@Wirone I'm quite sure the current state of the code is a mixed state (due to not having tooling enforcing it) rather than a consistent state of not using trailing comma in multiline array. |
Shim version was used in order to minimise impact of dev dependencies. Config files may look like there are missing classes, but it works.
This is required because Prophecy supports PHP 7.2+ while Fixer requires PHP >=7.4, so it's failing in the CI.
…tests in the CI Fixer is needed only in dedicated job, which runs on PHP 8.2 so dependencies can be resolved. For running tests it;s not required at all, so even if it's not compatible only with 7.2 and 7.3 we can remove it for any PHP version in the tests' matrix.
Since PHP 7.2-7.4 is supported we can't use trailing commas in arguments, parameters and match. Enabling it only for arrays is against current coding standard used in the project.
127e4fc
to
c7df023
Compare
I did not apply suggested changes because I want to get feedback if you like these changes or not. We can tweak configuration in order to keep more of current conventions (like class instantiation without parentheses).