Phpstorm header annotation, class annotation and function annotation settings (slightly improved)

Procedural apes are fearless 2022-02-13 05:15:44 阅读数:672

phpstorm header annotation class annotation

First ,PhpStorm In the file 、 class 、 Function and other comments are set in :setting-》Editor-》FIle and Code Template-》Includes Just click next , The default of the method is :

/** ${PARAM_DOC} #if (${TYPE_HINT} != "void") * @return ${TYPE_HINT} #end ${THROWS_DOC} */

But what I found was that , The default comment in the file is like this :

1 /** 2 * Created by ${PRODUCT_NAME}. 3 * @purpose describe 4 * @Author: user 5 * @Time: ${DATE} ${TIME} 6 */

When I put the above paragraph 5 Lines of code are copied directly to PHP Function Doc Comment At this time , Find placeholders {} Nothing in has been replaced , Instead, it's typed as a string .

Method :

1、 We are PhpStorm in setting-》Editor-》Live Template, Find the template options , You will see the template settings of various languages ;

2、 Find one on the right + Number , Create a custom template : choice Live Template, Then set according to the configuration sequence in the figure below :

 Insert picture description here

 Insert picture description here

3、 After point saving , go back to FIle and Code Template-》Includes, stay PHP Function Doc Comment Set up here :

/** * @Notes: * @Interface ${NAME} ${PARAM_DOC} #if (${TYPE_HINT} != "void") * @return ${TYPE_HINT} #end ${THROWS_DOC} * @author: Chenrui * @Time: ${DATE} ${TIME} */

4、 Click on Apply, Click on OK, Then in front of the method , Input /** Back carriage return :

/** * @Notes: * @Interface put_token * @param $data * @return string * @author: Chenrui * @Time: 2018/5/9 18:05 */

I set it myself

/** ${PARAM_DOC} #if (${TYPE_HINT} != "void") * @return ${TYPE_HINT} #end ${THROWS_DOC} User: lxw Date: ${DATE} ${TIME} */

 Insert picture description here

OK, complete .

Link to the original text :https://blog.csdn.net/chenrui310/article/details/80257433

copyright:author[Procedural apes are fearless],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/02/202202130515422781.html