在我的自定义嗅探中,我添加了
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="2" />
<property name="tabIndent" value="false" />
</properties>
</rule>
它适用于内部的功能和控制结构,但例如
function test_plugin_admin_enqueue( $hook ) {
/**
* Load only on ?page=test-ajax-admin.php
* The easiest way to find out the hook name is to go to the
* options page and put print_r( $hook ); before the conditional.
*/
if ( $hook !== 'toplevel_page_test-ajax-admin' ) {
return;
}
wp_enqueue_script( 'test-plugin-admin-script', plugin_dir_url( __FILE__ ) . 'js/admin.js', array( 'jquery' ) );
}
return
会有Tabs must be used to indent lines, spaces are not allowed
错误。
有没有办法检查正确的间距,而不使用制表符,而只使用空格?