我已将我的PhpStorm配置为使用Zend代码样式
PhpStorm |偏好|编辑|代码风格| PHP |从Zend设置
PhpStorm重新格式化的结果如下所示:
<?php
return [
'url_images' => '/img',
'url_images_email' => 'http://website.mine.amazonaws.com/img/mail',
'url_images_profile' => '//test.http://website.mine',
'url_images_editorial_team' => '//http://website.mine/images/tips1',
'url_images_profile_product' => '//http://website.mine/images/tips1',
'url_images_cms' => 'https://http://website.mine/wp-content/uploads',
];
对于我现有的代码库,有数百个文件,我想重新格式化代码以遵循Zend代码样式,所以我正在运行
./vendor/bin/phpcbf --standard=Zend config/autoload/image.development.php
运行此命令的结果如下所示:
<?php
return [
'url_images' => '/img',
'url_images_email' => 'http://website.mine.amazonaws.com/img/mail',
'url_images_profile' => '//test.http://website.mine',
'url_images_editorial_team' => '//http://website.mine/images/tips1',
'url_images_profile_product' => '//http://website.mine/images/tips1',
'url_images_cms' => 'https://http://website.mine/wp-content/uploads',
];
所以等号后的对齐明显不同。
现在我知道有很多选项可以使用phpcs.xml来配置phpcs,但是我试过的那些没有带来任何改进......
这是我现有的phpcs.xml
文件(如果需要):
<ruleset name="Zend Framework Coding Standard">
<description>Zend Framework Coding Standard</description>
<!-- display progress -->
<arg value="p"/>
<arg name="colors"/>
<!-- inherit rules from: -->
<rule ref="PSR2"/>
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<rule ref="Generic.Formatting.SpaceAfterNot"/>
<rule ref="Squiz.WhiteSpace.OperatorSpacing">
<properties>
<property name="ignoreNewlines" value="true"/>
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
<properties>
<property name="ignoreBlankLines" value="false"/>
</properties>
</rule>
<file>config</file>
</ruleset>
我的问题是:如何让phpcs / phpcbf完全像是PhpStorm上Zend的默认设置?