Skip to content

Commit

Permalink
Merge pull request #1922 from WordPress/3.0/remove-phpcshelper-class
Browse files Browse the repository at this point in the history
  • Loading branch information
GaryJones authored Jul 9, 2020
2 parents 9f04c22 + b868652 commit 09f36cc
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 121 deletions.
109 changes: 0 additions & 109 deletions WordPress/PHPCSHelper.php

This file was deleted.

4 changes: 2 additions & 2 deletions WordPress/Sniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use PHP_CodeSniffer\Sniffs\Sniff as PHPCS_Sniff;
use PHP_CodeSniffer\Files\File;
use PHP_CodeSniffer\Util\Tokens;
use WordPressCS\WordPress\PHPCSHelper;
use PHPCSUtils\BackCompat\Helper;

/**
* Represents a PHP_CodeSniffer sniff for sniffing WordPress coding standards.
Expand Down Expand Up @@ -1141,7 +1141,7 @@ protected function get_last_ptr_on_line( $stackPtr ) {
* @since 0.14.0
*/
protected function get_wp_version_from_cl() {
$cl_supported_version = trim( PHPCSHelper::get_config_data( 'minimum_supported_wp_version' ) );
$cl_supported_version = trim( Helper::getConfigData( 'minimum_supported_wp_version' ) );
if ( ! empty( $cl_supported_version )
&& filter_var( $cl_supported_version, \FILTER_VALIDATE_FLOAT ) !== false
) {
Expand Down
4 changes: 2 additions & 2 deletions WordPress/Sniffs/Arrays/ArrayIndentationSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
namespace WordPressCS\WordPress\Sniffs\Arrays;

use WordPressCS\WordPress\Sniff;
use WordPressCS\WordPress\PHPCSHelper;
use PHP_CodeSniffer\Util\Tokens;
use PHPCSUtils\BackCompat\Helper;

/**
* Enforces WordPress array indentation for multi-line arrays.
Expand Down Expand Up @@ -90,7 +90,7 @@ public function register() {
*/
public function process_token( $stackPtr ) {
if ( ! isset( $this->tab_width ) ) {
$this->tab_width = PHPCSHelper::get_tab_width( $this->phpcsFile );
$this->tab_width = Helper::getTabWidth( $this->phpcsFile );
}

if ( \T_OPEN_SHORT_ARRAY === $this->tokens[ $stackPtr ]['code']
Expand Down
4 changes: 2 additions & 2 deletions WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
namespace WordPressCS\WordPress\Sniffs\NamingConventions;

use WordPressCS\WordPress\AbstractFunctionParameterSniff;
use WordPressCS\WordPress\PHPCSHelper;
use PHP_CodeSniffer\Util\Tokens;
use PHPCSUtils\BackCompat\Helper;

/**
* Verify that everything defined in the global namespace is prefixed with a theme/plugin specific prefix.
Expand Down Expand Up @@ -265,7 +265,7 @@ public function getGroups() {
public function process_token( $stackPtr ) {

// Allow overruling the prefixes set in a ruleset via the command line.
$cl_prefixes = trim( PHPCSHelper::get_config_data( 'prefixes' ) );
$cl_prefixes = trim( Helper::getConfigData( 'prefixes' ) );
if ( ! empty( $cl_prefixes ) ) {
$this->prefixes = array_filter( array_map( 'trim', explode( ',', $cl_prefixes ) ) );
}
Expand Down
4 changes: 2 additions & 2 deletions WordPress/Sniffs/WP/I18nSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
namespace WordPressCS\WordPress\Sniffs\WP;

use WordPressCS\WordPress\AbstractFunctionRestrictionsSniff;
use WordPressCS\WordPress\PHPCSHelper;
use PHP_CodeSniffer\Util\Tokens;
use PHPCSUtils\BackCompat\Helper;

/**
* Makes sure WP internationalization functions are used properly.
Expand Down Expand Up @@ -191,7 +191,7 @@ public function process_token( $stack_ptr ) {
$this->text_domain_is_default = false;

// Allow overruling the text_domain set in a ruleset via the command line.
$cl_text_domain = trim( PHPCSHelper::get_config_data( 'text_domain' ) );
$cl_text_domain = trim( Helper::getConfigData( 'text_domain' ) );
if ( ! empty( $cl_text_domain ) ) {
$this->text_domain = array_filter( array_map( 'trim', explode( ',', $cl_text_domain ) ) );
}
Expand Down
4 changes: 2 additions & 2 deletions WordPress/Sniffs/WhiteSpace/PrecisionAlignmentSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
namespace WordPressCS\WordPress\Sniffs\WhiteSpace;

use WordPressCS\WordPress\Sniff;
use WordPressCS\WordPress\PHPCSHelper;
use PHP_CodeSniffer\Util\Tokens;
use PHPCSUtils\BackCompat\Helper;

/**
* Warn on line indentation ending with spaces for precision alignment.
Expand Down Expand Up @@ -90,7 +90,7 @@ public function register() {
*/
public function process_token( $stackPtr ) {
if ( ! isset( $this->tab_width ) ) {
$this->tab_width = PHPCSHelper::get_tab_width( $this->phpcsFile );
$this->tab_width = Helper::getTabWidth( $this->phpcsFile );
}

// Handle any custom ignore tokens received from a ruleset.
Expand Down
3 changes: 1 addition & 2 deletions WordPress/Tests/PHP/TypeCastsUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
namespace WordPressCS\WordPress\Tests\PHP;

use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
use WordPressCS\WordPress\PHPCSHelper;

/**
* Unit test class for the TypeCasts sniff.
Expand Down Expand Up @@ -44,7 +43,7 @@ public function getWarningList() {
return array(
14 => 1,
15 => 1,
16 => ( version_compare( PHPCSHelper::get_version(), '3.4.0', '<' ) === true ? 0 : 1 ),
16 => 1,
17 => 1,
28 => 1,
29 => 1,
Expand Down

0 comments on commit 09f36cc

Please sign in to comment.