Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write comments for function in PhpStorm?

Tags:

phpstorm

<?php

class Hello
{
    public function hello()
    {
        return "";
    }
}

I have function and I need to give comments and write documents for the same, like @param, @return.

How can I do that?

I am very new to PhpStorm.


1 Answers

1) Place the caret before the required code construct (class, method, function, and so on), type the opening block comment /**, and press Enter.

2) In the editor context menu, select Generate | Generate PHPDoc blocks and choose the code construct to generate PHPDoc comments for.

3) Press Alt+Insert, then select Generate PHPDoc blocks, and choose the code construct to generate PHPDoc comments for.

You can check this link for more info.: https://www.jetbrains.com/help/phpstorm/phpdoc-comments.html

like image 122
Anand Mainali Avatar answered Oct 29 '25 19:10

Anand Mainali



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!