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

optimize-use: Declared class imported #32

Closed
tobyS opened this issue Sep 8, 2013 · 2 comments
Closed

optimize-use: Declared class imported #32

tobyS opened this issue Sep 8, 2013 · 2 comments

Comments

@tobyS
Copy link
Contributor

tobyS commented Sep 8, 2013

Using the optimize-use command on test/features/bootstrap/FeatureContext.php (known project) yields an import for the class that is declared in the file:

$ refactor optimize-use test/features/bootstrap/FeatureContext.php 
--- a/test/features/bootstrap/FeatureContext.php
+++ b/test/features/bootstrap/FeatureContext.php
@@ -10,15 +10,26 @@
 use Qafoo\ChangeTrack\Analyzer;
 use Qafoo\ChangeTrack\Calculator;
 use Qafoo\ChangeTrack\Change;
+use FeatureContext;-class FeatureContext extends BehatContext
+class FeatureContext extends BehatContext
pscheit added a commit to pscheit/php-refactoring-browser that referenced this issue Oct 6, 2013
pscheit added a commit to pscheit/php-refactoring-browser that referenced this issue Oct 6, 2013
@pscheit
Copy link
Contributor

pscheit commented Oct 6, 2013

I have fixed this in my fork.
Unfortunately there was a bug/feature in the TokenReflectionAnalysis. When a file without a namespace token is given, the namespaceDeclarationLine is set to the line of the first class token. I found this very unintuitive and changed our adapter for this case to return the namespaceDeclarationLine as 0. Would you agree with this?

if #37 would be merged, I can pull this fix

best regards
Philipp

@beberlei
Copy link
Contributor

Merged and fixed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants