Skip to content
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

Unwanted renaming #5

Closed
vajexal opened this issue Jan 8, 2021 · 5 comments · Fixed by PHP-CS-Fixer/PHP-CS-Fixer#5421
Closed

Unwanted renaming #5

vajexal opened this issue Jan 8, 2021 · 5 comments · Fixed by PHP-CS-Fixer/PHP-CS-Fixer#5421
Labels
bug Something isn't working

Comments

@vajexal
Copy link

vajexal commented Jan 8, 2021

psr_autoloading rule doesn't support few code sources (src and tests for example), which leads to files renaming. For example if we run

vendor/bin/php-cs-fixer fix

on github.com/amphp/amp, test files will be renamed

-class FilterTest extends BaseTest
+class t_FilterTest extends BaseTest

Could this rule be removed?

@kelunik
Copy link
Member

kelunik commented Jan 8, 2021

I noticed that as well, but haven't found out what caused that change. I'd like to keep the rule, as it also checks the correct casing of files, but I'd like to disable it for all directories not being src / lib. That was the intention behind e504817 and 09a43ad, but it didn't work like I expected. Any idea how to do that?

@kelunik kelunik added the bug Something isn't working label Jan 8, 2021
@vajexal
Copy link
Author

vajexal commented Jan 8, 2021

here is the reason I think. For example $maxNamespace for FilterTest.php will be t because file path (test/FilterTest.php) minus root path (lib) is t/FilterTest.php and without filename it's t.

There's no way to configure phpcs fixer to ignore some rules for specific path as I know. Other solutions relate to github.com/FriendsOfPHP/PHP-CS-Fixer

@kelunik
Copy link
Member

kelunik commented Jan 9, 2021

I've opened PHP-CS-Fixer/PHP-CS-Fixer#5421.

kelunik added a commit to kelunik/PHP-CS-Fixer that referenced this issue Jan 9, 2021
@kelunik
Copy link
Member

kelunik commented Jan 11, 2021

I've temporarily disabled the rule, but will keep the issue open until it's fixed.

keradus pushed a commit to kelunik/PHP-CS-Fixer that referenced this issue Mar 19, 2021
keradus added a commit to PHP-CS-Fixer/PHP-CS-Fixer that referenced this issue Mar 20, 2021
…d directory (kelunik, keradus)

This PR was merged into the 2.18 branch.

Discussion
----------

PsrAutoloadingFixer - Fix PSR autoloading outside configured directory

Fixes amphp/php-cs-fixer-config#5.

Commits
-------

5d2d99d PsrAutoloadingFixer - call realpath only once
55a9991 PsrAutoloadingFixer - Fix PSR autoloading outside configured directory
@kelunik
Copy link
Member

kelunik commented Feb 1, 2022

The fix has been merged, so I'll close this one as well. 😄

@kelunik kelunik closed this as completed Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants