Wikunia / brackets-FuncDocr

FuncDocr generates JS/PHPDoc annotations for your functions
101 stars 14 forks source link

Function with default parameters (PHP) #54

Closed adricorse closed 9 years ago

adricorse commented 9 years ago

Hello, try to add a default parameters in your function, I have this resullt :

    /**
     * [[Description]]
     * @param  [[Type]] [$config=""] [[Description]]
     * @return [[Type]] [[Description]]
     */
    protected function demo($config=""){

So, if I change Type or Description in phpdoc for this variable and I use shortcut to add phpdoc in this method, my changes are removed. This bug appear only with default parameters.

Wikunia commented 9 years ago

Can you show me the code snippet before and after the bug? I can't reconstruct this bug. Thanks!

adricorse commented 9 years ago

I have Ubuntu 15.04 and all updates and the latest version of Brackets. To reconstruct this bug, check this example :

<?php
public class Example{
    protected function demo($abc = ""){
    }
}
?>

Now, use the shortcut to make a phpdoc for this function (Linux : CTRL + ALT + D)

<?php
public class Example{
    /**
     * [[Description]]
     * @param [[Type]] [$abc = ""] [[Description]]
     */
    protected function demo($abc = ""){
    }
}
?>

Now, you replace "[[Type]]" by anything (integer, float, string, etc .. )

<?php
public class Example{
    /**
     * [[Description]]
     * @param integer [$abc = ""] [[Description]]
     */
    protected function demo($abc = ""){
    }
}
?>

and place the cursor on the function and use again the shortcut (CTRL + ALT +D for me), this cancels what you wrote in all variables with default parameters (Type and Description).

Wikunia commented 9 years ago

Thanks for the issue! I hope this one fixes it. Please install from url. I'll register it, if everything works properly.

adricorse commented 9 years ago

It works! Thanks again ! :)