phpstorm - 如何对 PhpStorm 中的字段进行排序,包括注释
问题描述
我有一堆领域,比如
/**
* @var string
* Some stuff here
*/
private $var3;
/**
* @var int
* Some other stuff
*/
private $var2;
// Just a comment
private $var1;
我想让它们按字母顺序排列。最终结果应该是
// Just a comment
private $var1;
/**
* @var int
* Some other stuff
*/
private $var2;
/**
* @var string
* Some stuff here
*/
private $var3;
我尝试使用一个名为“字符串操作”的插件,但它不会将注释与字段保持在一起,排序会导致像这样的随机
* @var int
* @var string
* Some other stuff
* Some stuff here
*/
*/
/**
/**
// Just a comment
private $var1;
private $var2;
private $var3;
我还尝试使用 IDE 内置的重新排列代码。我保留了默认规则,但将“字段”之一更改为“按名称排序”。好像什么都没做...
我对尝试什么没有任何其他想法,并且对于许多大文件,手动执行此操作是一项乏味的工作。
有什么解决办法吗?
解决方案
推荐阅读
- javascript - Node JS通过管道重定向,chrome下载而不是播放
- reactjs - OpenID Connect + Django DRF + React:如何使用?
- ios - 如何在 SwiftUI 中将我的环境对象设置为用户输入?
- mongodb - Kubernetes 上的 Mongodb 超出内存限制 - 可用内存小于系统内存
- sql-server - 如何将 MS SQL Server 数据库连接到 Oracle 云数据库
- amazon-web-services - Elastic Beanstalk 无法在自定义 VPC 和子网中启动
- typescript - React-styledComponents:属性'children'的类型不兼容
- python - 试图用正则表达式拆分句子
- html - 如何在不使用任何 css 属性的情况下将背景图像放入 html 中?
- openapi - 全球化 OpenAPI 中某些控制器名称的标签