-
-
Notifications
You must be signed in to change notification settings - Fork 158
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
php-cs-fixer issue #15
Comments
Oh really? I have never seen this on my own machine (using PHPStorm with php-cs-fixer integration). I just tried on a separate environment and noticed the same. Let me investigate what the difference is. |
The difference isn't too bad, if you just run if you run it on the tests directory also (as I did originally) it will update the namespaces on all the tests.. I think all you need to fix that issue is update following in composer.json (I've not tested this)
|
Yeah, I noticed that mostly it is comments and formatting. Oops! Not following PSR-2 as I stated :) I am only wondering why it changes "Test" to "test". Couldn't find anything about that in the PSR-2 specs... |
Yes, and oddly enough it doesn't do the same for other namespaces eg. |
I changed composer.json to
and HolidaysFilterTest.php also (reference to trait use Yasumi\tests\YasumiBase), and now phpunit runs without error. Hmm... still wondering why this directory name was changed. |
I guess if it doesn't hurt BC its not a bad thing to be more compliant - I trust php-cs-fixer knows what it's doing :) |
Actually I did some tests, and I get the feeling it applies fixes that are not only PSR2 :(. For example it removes the '@Package....' line from the comments and I checked that is part of the 'Symfony' level. Looks like the option --level=psr2 doesn't mean exclusively 'PSR2'. For good measure I checked another package (Dingo API) and their composer.json contents for the unit tests is the same as mine. I want to be PSR2 compliant, but then php-cs-fixer should not do anything beyond that. |
Ah, I see.. that makes sense. Just looking at the docs for php-cs-fixer you can manually specify which fixers you want to include/exclude, using fixers flag eg Even better you can define a I'm just running it with that config now to see how it turns out. |
Ah yes. Then maybe it's better to create such a custom config file everybody can use. This will avoid any confusion as well :) Thanks for checking! |
Looks good so far, I've just had to modify the config from Dingo slightly. Do you want me to create a PR? |
Sure! Let me check it out later |
This PR resolves issue #15 php Coding Standard Fixer issues.
Issue resolved with PR #16 |
Running
php-cs-fixer fix . --level=psr2
generates a massive list of changes, and breaks unit tests (it changes the namespaces for tests fromYasumi\Tests\NewZealand
toYasumi\tests\NewZealand
)Are there some specific settings to use when running php-cs-fixer?
The text was updated successfully, but these errors were encountered: