phpactor/vscode-phpactor

parser doesnt count for docblock

ctf0 opened this issue · 7 comments

ctf0 commented
/**
 * Determine if the user is authorized to make this request.
 *
 * @return bool
 */
public function authorize()
{
    return true;
}

Screen Shot 2023-01-09 at 5 59 44 AM

This is as designed, you are missing the actual return type, specifying it as a docblock isn't necessary?

ctf0 commented

you are missing the actual return type, specifying it as a docblock isn't necessary?

its a fw logic, laravel in this case is still using docblocks instead of type hints.

anyway the method & its doc are correct, using a php 8 return type hint or using docblock should be treated the same.

you can still add a return type even if it's FW logic - is there a reason not to?

but open having a config option to surpress this if the docblock is set

ctf0 commented

is there a reason not to?

not exactly but adds unnecessary noise to the editor specially that making the change makes no difference to the current state of the logic.

but open having a config option to surpress this if the docblock is set

that would be perfect, specially for cases where u have return types that sometimes cant be used directly as return type hints, ex.laravel Collection

ctf0 commented

believe it or not, the parser actually count for docblocks

  • /Users/xxx/.composer/vendor/twig/twig/src/Loader/ChainLoader.php#83

Screen Shot 2023-01-09 at 11 32 34 AM

in this case it should have complained about native type hint instead, or is it a different issue ?