Skip to content
This repository has been archived by the owner on Jul 12, 2020. It is now read-only.

Makes (not affected) absolute use-statements relative in fix-class-names #55

Closed
tobyS opened this issue Jan 4, 2014 · 4 comments
Closed
Labels

Comments

@tobyS
Copy link
Contributor

tobyS commented Jan 4, 2014

One of the recent changes introduced that fix-class-names changes use statments to be relative even if the were validly absolute before, see http://files.schlitt.info/tmp/diff_issues.patch.

To reproduce this diff do the following:

  1. Checkout https://github.com/Qafoo/changetrack revision 60a94df
  2. Move src/main/Qafoo/ChangeTrack/Analyzer/Vcs/GitCheckout.php -> src/main/Qafoo/ChangeTrack/Analyzer/Checkout/GitCheckout.php
  3. Execute refactor fix-class-names src/ test/ > diff_issues.patch

Btw. the intended changes do not occur in the diff at all.

@tobyS
Copy link
Contributor Author

tobyS commented Jan 4, 2014

@tomphp: I guess you are the right one to ping for a potential fix?

@tomphp
Copy link
Contributor

tomphp commented Jan 4, 2014

hmmm, this one is strange. Again I shall take a look at it tomorrow ;)

@tomphp
Copy link
Contributor

tomphp commented Jan 5, 2014

Ok I have found out why this is happening. The reason is php-refactorings-browser tries to guess the namespace from the directory structure in the folders given to is. While not perfect normally this works pretty well so long as the namespaces are well structured.

The problem here was that it was analysing the test/ folder which has well structured namespaces in test/phpunit/Qafoo/... however it also has non PSR-0 compliant php files in test/phpunit/_fixtures.

The best solution here would probably be to convert the _fixtures folder to be PSR-0 compliant.

Alternatively you can change your command to

refactor fix-class-names src/ test/phpunit/Qafoo > diff_issues.patch

to skip these files and fix any issues in the _fixtures (and behat contexts) manually.

So in reality I don't think this is a bug however I do think that some work may be required to extract namespaces from files more reliably at some time in the future, especially with PSR-4 on it's way.

@tobyS
Copy link
Contributor Author

tobyS commented Jan 5, 2014

Ah, thanks for the clarification. I'll then close this issue as "Won't fix".

@tobyS tobyS closed this as completed Jan 5, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants