9

我正在处理大量包含带有 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"
 *     )
 *   )
 * )
 */
4

1 回答 1

6

不幸的是,在 PHPStorm 中没有内置任何东西可以做到这一点。我用一点节点解决了这个问题,如果其他人需要它,我已经开源了我的工作。

:)

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

于 2015-06-13T15:30:50.883 回答