Wikunia / brackets-FuncDocr

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

refresh comments with the shortcut #57

Closed adricorse closed 6 years ago

adricorse commented 9 years ago

Hello (Oh nooo ;) ) When you have already generate PHPDoc, take this exemple and you generate this :

<?php
function hello(){
return true;
}
?>

The FuncDocr will generate this :

<?php
/**
 * [[Description]]
 * @return boolean [[Description]]
 */
function hello(){
    return true;
}
?>

But, now, replace "true" with something else, like "$var" and you use shortcut to regenerate PHPDocs. The PHPDoc is again "return boolean".

<?php
/**
 * [[Description]]
 * @return boolean [[Description]]
 */
function hello(){
    return $var;
}
?>

But if you start by "return $var" and end by "return true", the PHPDoc is correct. Good luck ;)

Wikunia commented 9 years ago

I'm sorry that one is normal. The reason is the following: If you have the following code:

function hello(b,a){
    if (b > a) {
        return false;
    }
    return true;
}

The return type will be boolean. It isn't obvious that this change always returns a boolean as well:

function hello(b,a){
    $bool = true;
    if (b > a) {
        $bool = false;
    }
    return $bool;
}

If you update the code the type which was set will stay the same (for type and description), cause sometimes it isn't easily possible to determine the type, so I rely on the type which is already inside the documentation. Hope you know what I mean, sorry for my bad explanation.

adricorse commented 9 years ago

But, ideally, boolean can be changed to [[Type]], no ? Because if you replace your $bool = true by $bool = "ok"; (both $bool), return $bool is defined "boolean" again by your Doc

Wikunia commented 9 years ago

Hmm yeah that one will be fine :) I'll code that one in the next days.

Wikunia commented 9 years ago

Sorry don't know what you meant. Do you have an example for me?