Rector: [ServiceLocatorToDIRector] Error "Unable to resolve repository argument"

Created on 25 Feb 2020  路  9Comments  路  Source: rectorphp/rector

Bug Report

When running Rector with set doctrine-repository-as-service, I get the following error :

 [ERROR] Could not process "tests/Unit/App/Doctrine/ItemRepositoryTest.php" file by  
         "Rector\Rector\Architecture\RepositoryAsService\ServiceLocatorToDIRector", due to:                             
         "Unable to resolve repository argument".                                                                       

Minimal PHP Code Causing Issue

https://getrector.org/demo/c301546c-7d92-4b99-b1b6-1955831a6f39

Expected Behaviour

No errors ? ^^

bug

All 9 comments

I'm not sure how the demo site works, but right now if I click again the "process" button on the demo I provided, it still fails. Does it uses master? Is there a delay?

I'm not sure how the demo site works, but right now if I click again the "process" button on the demo I provided, it still fails. Does it uses master? Is there a delay?

I think it needs to be manually updated. cc @JanMikes

Hi, i have updated the demo's docker image right now, added cron to periodically update and working on a webhook trigger.

Thank you 馃憤

I have checked with given demo and it still fails. For me it seems that the code is incompatible with that set. @TomasVotruba is the usage correct?

I tried it here https://getrector.org/demo/4f650586-c388-4053-bf39-c81555abaf42#result and it seems to work.

Imho the error message is correct, it should just be better formatted and human readable.

The original code should be fixed. Maybe there were more bugs, but I covered just one.

This Rector should not apply on a Test file I guess ?

Location doesn't matter. The goal is to convert 'strings' to Class::constants

Confirm original issues is fixed, just tested locally the file

Confirmed! Thanks. :)

Was this page helpful?
0 / 5 - 0 ratings