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

Renaming parameter with same name of one attributes will causes an exception #71

Open
rentalhost opened this issue Nov 8, 2016 · 0 comments

Comments

@rentalhost
Copy link

Renaming a parameter that have the same name of one of declared attributes will causes a conflict. This plugin will select the @attribute and if you apply the renaming process you will have a PS exception.

For instance:

class Test
{
    /**
     * @param $param
     */
    public function test($param)
    {
    }
}

Select $param and call rename (Refactor / Rename...), it'll select both $param, but will include too @param. If you try to rename it to, for instance, $test, the code will seems like:

class Test
{
    /**
     * @[test] $[test]
     */
    public function test($[test])
    {
    }
}

After you press enter to confirm the renaming, it'll displays the Refactoring Preview window with three options (both $param and too @param). If you just do refactoring as is, it'll rename the code to:

class Test
{
    /**
     * @param $[test]
     */
    public function test($param)
    {
    }
}

Note that it will rename only the annotation parameter, but will not affects the @param (will back to normal), but too will not apply on method parameter (will back to $param). It occur because an exception is thrown after you try do that (full exception log).

Cannot find manipulator for phpDocParam in phpDocParam:null class class
de.espend.idea.php.annotation.reference.
    DocTagNameAnnotationReferenceContributor$PhpDocTagReference
java.lang.Throwable
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:132)
    at com.intellij.psi.PsiReferenceBase.getManipulator(PsiReferenceBase.java:139)
    at com.intellij.psi.PsiReferenceBase.handleElementRename(PsiReferenceBase.java:115)
    at com.intellij.refactoring.rename.RenameUtil.rename(RenameUtil.java:266)
    ...

You can check this issue on this video (unlisted): PHP Annotations 4.2 issue.

This issue was registered on Jetbrains Youtrack too, but was not related to this platform. WI-33848

Plugin Version
PHP Annotations 4.2

Software Version
PhpStorm 2016.3 EAP
Build #PS-163.7342.9, built on November 2, 2016
JRE: 1.8.0_112-release-408-b2 x86
JVM: OpenJDK Server VM by JetBrains s.r.o

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

No branches or pull requests

1 participant