PHP storm 注释符号在行首

PHP storm 注释符号在行首


2021-09-09

问题

PHP storm 默认设置 注释快捷键 设置的行注释 设置在行首,如下:❌

1
2
3
4
            // todo 使用队列, 替换 raise dispatchNow
            $thread->raise(new Created($thread));
    //        ProcessThreadCreated::dispatchNow($thread);
            ProcessThreadCreated::dispatch($thread);

使用 格式化 功能以后,格式又发生错乱,❌

1
2
3
4
            // todo 使用队列, 替换 raise dispatchNow
            $thread->raise(new Created($thread));
            //        ProcessThreadCreated::dispatchNow($thread);
            ProcessThreadCreated::dispatch($thread);

注释时直接 注释在代码前,而非行首,如下:✅

1
2
3
4
            // todo 使用队列, 替换 raise dispatchNow
            $thread->raise(new Created($thread));
            //ProcessThreadCreated::dispatchNow($thread);
            ProcessThreadCreated::dispatch($thread)

解决

  1. 设置, 取消勾选 Line Comment at first column

Settings - Editor - Code Style - PHP - Code Generation

  1. 自动格式化配置,取消勾选 Comment at first column

Settings - Editor - Code Style - PHP - Wrapping and Braces

沪ICP备2022013452号-1