idea-php-symfony2-plugin
idea-php-symfony2-plugin copied to clipboard
Renaming templates through refactoring breaks references to it
when using the Refactor > rename
feature to rename a template, PHPStorm properly identifies the render()
call as needing to be updated during the refactoring (thanks to this plugin AFAICT). But the refactoring being performed is wrong.
I had a template named @Web/Space/Main/delete_confirmation.html.twig
. When renaming the file to delete.html.twig
in the same folder, I expected the render call to be updated to @Web/Space/Main/delete.html.twig
but it was updated to delete.html.twig
instead.
This is due to a simple PSIReference that will only replace the references' name
with the PSIFiles' name. To implement the behaviour, we should add a rename handler.
Ref: https://github.com/Haehnchen/idea-php-symfony2-plugin/blob/147d6d0951ac64a231e89f7a1e334e2e2d80e2ea/src/main/java/fr/adrienbrault/idea/symfony2plugin/templating/TemplateReference.java#L15
Hello, I have the same problem with PhpStorm 2021.3.2 and Symfony Support plugin 0.23.213 (in a Symfony 6 project). Do you think you could implement the solution you propose ? Or maybe I can try to do it and submit a pull request ?
Related: when moving a template the {% extends %}
paths inside the template will become relative instead of absolute which also breaks things.