繁体   English   中英

如何在PHPStorm中自动格式化PHP注释

[英]How to automatically format PHP annotations in PHPStorm

我正在处理大量具有Swagger PHP注释的PHP块文档的文件,但它们没有缩进。 无论如何要用空格自动格式化它们吗?

车削

/**
 * @SWG\Api(
 * path="/building/{buildingId}",
 * @SWG\Operation(
 * method="GET",
 * type="Building",
 * summary="Returns a Building object by ID",
 * nickname="building/getBuilding",
 * @SWG\Parameter(
 * name="buildingId",
 * description="ID of the building that needs to be fetched",
 * paramType="path",
 * required=false,
 * type="string",
 * defaultValue="1"
 * )
 * )
 * )
 */

/**
 * @SWG\Api(
 *   path="/building/{buildingId}",
 *   @SWG\Operation(
 *     method="GET",
 *     type="Building",
 *     summary="Returns a Building object by ID",
 *     nickname="building/getBuilding",
 *     @SWG\Parameter(
 *       name="buildingId",
 *       description="ID of the building that needs to be fetched",
 *       paramType="path",
 *       required=false,
 *       type="string",
 *       defaultValue="1"
 *     )
 *   )
 * )
 */

不幸的是,考虑到这一点,PHPStorm没有内置任何功能。 我用一点节点解决了这个问题,并且如果有其他人需要它,我可以开源我的工作。

:)

https://github.com/eknowles/grunt-tidy-annotations

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM