3

After updating to the latest wpcs version I'm getting precision alignment warnings in my file. And it's happening for comments for the properties in my class. For instance

<?php
/**
 * FIle that holds the test class
 *
 * @since   1.0.0
 * @package test
 */

namespace Namespace\Admin;

/**
 * Test class
 *
 * @since  1.0.0
 */
class Test {
  /**
   * Global theme name
   *
   * @var string
   *
   * @since 1.0.0
   */
  protected $theme_name;
}

I am using 2 spaces for spacing instead 4 spaces, and spaces instead of tabs in my ruleset.

<!-- Tabs should represent 2 spaces. -->
  <arg name="tab-width" value="2"/>

  <!-- Set the default indent value and force spaces instead of tabs -->
  <rule ref="WordPress">
    <exclude name="Generic.WhiteSpace.DisallowSpaceIndent" />
  </rule>
  <rule ref="Generic.WhiteSpace.ScopeIndent">
    <properties>
      <property name="indent" value="2"/>
      <property name="tabIndent" value="false"/>
    </properties>
  </rule>
  <rule ref="Generic.WhiteSpace.DisallowTabIndent" />

  <rule ref="PEAR.Functions.FunctionCallSignature">
    <properties>
      <property name="indent" value="2"/>
    </properties>
  </rule>

I tried adding the T_DOC_COMMENT_WHITESPACE to ignoreAlignmentTokens

  <!-- Precision alignment sniff -->
  <rule ref="WordPress.WhiteSpace.PrecisionAlignment">
    <properties>
      <property name="ignoreAlignmentTokens" type="array" value="T_COMMENT,T_INLINE_HTML,T_DOC_COMMENT_WHITESPACE"/>
    </properties>
  </rule>

But I'm still getting the warning about the precision alignment of 2 spaces on my doc block and on my property.

Can this be silenced, or am I missing something?

dingo_d
  • 11,160
  • 11
  • 73
  • 132

1 Answers1

-1

I use phpstorm and it kind of takes care of it with the right settings.

It comes with preset rules for WordPress coding standards.

Henry Obiaraije
  • 301
  • 3
  • 10