有没有一种简单的方法(在PhpStorm中)将PHP代码片段包装到PHPDoc中?

有没有一种简单的方法(在PhpStorm中)将PHP代码片段包装到PHPDoc中?,php,phpstorm,Php,Phpstorm,有没有办法复制一些代码并插入到PHPDoc注释中,以便格式保持不变 我需要将这段代码插入函数的PHPC中 [ [ '_is_forecast' => true, '_is_fake_item' => false, 'humidity' => 1.24, // ... other pa

有没有办法复制一些代码并插入到PHPDoc注释中,以便格式保持不变

我需要将这段代码插入函数的PHPC中

         [
            [
                '_is_forecast'  => true,
                '_is_fake_item'     => false,
                'humidity'          => 1.24,
                // ... other parameters
                'rain_intensity'    => 3,
                'timestamp'         => '2019-12-20 11:20 UTC',
            ],
            [
                '_is_forecast'  => true,
                '_is_fake_item'     => false,
                'humidity'          => 24.5,
                // ... other parameters
                'rain_intensity'    => 23,
                'timestamp'         => '2019-12-20 11:40 UTC',
            ],
        ];
那么它应该是这样的:

/**
 *
 *        [
 *            [
 *                '_is_forecast'  => true,
 *                '_is_fake_item'     => false,
 *                'humidity'          => 1.24,
 *                / ... other parameters
 *                'rain_intensity'    => 3,
 *                'timestamp'         => '2019-12-20 11:20 UTC',
 *            ],
 *            [
 *                '_is_forecast'  => true,
 *                '_is_fake_item'     => false,
 *                'humidity'          => 24.5,
 *                / ... other parameters
 *                'rain_intensity'    => 23,
 *                'timestamp'         => '2019-12-20 11:40 UTC',
 *            ],
 *        ];
 *
 * @return array
 */
public function groupByParams()
{
   return [];
}

您可以使用PHPStrom ctr+alt+s open设置的活动模板。搜索实时模板。并创建您的模板。并为此设置小缩写,这样您就可以轻松访问该模板的任何位置。或者在你的例子中,注释代码。存档。仅仅通过使用。ctr+j选择您的缩写

您可以在“代码”菜单的“块注释”中使用注释,在菜单栏中,通常我选择要注释的文本块,然后按CTRL+/或CTRL+SHIFT+/,具体取决于我要获取的注释类型

PHPStorm将根据当前编辑的文件类型应用注释

使用相同的击键组合取消对块的注释

您可以使用在新粘贴的行中批量添加*。注意:如果在粘贴过程中更改了格式-请尝试使用编辑|粘贴而不使用格式,而不是普通粘贴,它可能会根据您的设置缩进/重新格式化代码。