Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CS: improve use statements #778

Merged
merged 2 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

namespace WordPressVIPMinimum\Sniffs\Constants;

use WordPressVIPMinimum\Sniffs\Sniff;
use PHP_CodeSniffer\Util\Tokens;
use WordPressVIPMinimum\Sniffs\Sniff;

/**
* Restricts usage of some constants.
Expand Down
2 changes: 1 addition & 1 deletion WordPressVIPMinimum/Sniffs/Files/IncludingFileSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

namespace WordPressVIPMinimum\Sniffs\Files;

use WordPressCS\WordPress\AbstractFunctionRestrictionsSniff;
use PHP_CodeSniffer\Util\Tokens;
use WordPressCS\WordPress\AbstractFunctionRestrictionsSniff;

/**
* WordPressVIPMinimum_Sniffs_Files_IncludingFileSniff.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

namespace WordPressVIPMinimum\Sniffs\Files;

use WordPressVIPMinimum\Sniffs\Sniff;
use PHP_CodeSniffer\Util\Tokens;
use PHPCSUtils\BackCompat\BCFile;
use WordPressVIPMinimum\Sniffs\Sniff;

/**
* Ensure that non-PHP files are included via `file_get_contents()` instead of using `include/require[_once]`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

namespace WordPressVIPMinimum\Sniffs\Functions;

use WordPressVIPMinimum\Sniffs\Sniff;
use PHP_CodeSniffer\Util\Tokens;
use WordPressVIPMinimum\Sniffs\Sniff;

/**
* This sniff enforces checking the return value of a function before passing it to another one.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

namespace WordPressVIPMinimum\Sniffs\Functions;

use WordPressCS\WordPress\AbstractFunctionRestrictionsSniff;
use PHP_CodeSniffer\Util\Tokens;
use WordPressCS\WordPress\AbstractFunctionRestrictionsSniff;

/**
* Restricts usage of some functions in VIP context.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

namespace WordPressVIPMinimum\Sniffs\JS;

use WordPressVIPMinimum\Sniffs\Sniff;
use PHP_CodeSniffer\Util\Tokens;
use WordPressVIPMinimum\Sniffs\Sniff;

/**
* WordPressVIPMinimum_Sniffs_JS_DangerouslySetInnerHTMLSniff.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

namespace WordPressVIPMinimum\Sniffs\JS;

use WordPressVIPMinimum\Sniffs\Sniff;
use PHP_CodeSniffer\Util\Tokens;
use WordPressVIPMinimum\Sniffs\Sniff;

/**
* WordPressVIPMinimum_Sniffs_JS_HTMLExecutingFunctions.
Expand Down
2 changes: 1 addition & 1 deletion WordPressVIPMinimum/Sniffs/JS/InnerHTMLSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

namespace WordPressVIPMinimum\Sniffs\JS;

use WordPressVIPMinimum\Sniffs\Sniff;
use PHP_CodeSniffer\Util\Tokens;
use WordPressVIPMinimum\Sniffs\Sniff;

/**
* WordPressVIPMinimum_Sniffs_JS_InnerHTMLSniff.
Expand Down
2 changes: 1 addition & 1 deletion WordPressVIPMinimum/Sniffs/JS/StringConcatSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

namespace WordPressVIPMinimum\Sniffs\JS;

use WordPressVIPMinimum\Sniffs\Sniff;
use PHP_CodeSniffer\Util\Tokens;
use WordPressVIPMinimum\Sniffs\Sniff;

/**
* WordPressVIPMinimum_Sniffs_JS_StringConcatSniff.
Expand Down
2 changes: 1 addition & 1 deletion WordPressVIPMinimum/Sniffs/JS/StrippingTagsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

namespace WordPressVIPMinimum\Sniffs\JS;

use WordPressVIPMinimum\Sniffs\Sniff;
use PHP_CodeSniffer\Util\Tokens;
use WordPressVIPMinimum\Sniffs\Sniff;

/**
* WordPressVIPMinimum_Sniffs_JS_StrippingTagsSniff.
Expand Down
2 changes: 1 addition & 1 deletion WordPressVIPMinimum/Sniffs/JS/WindowSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

namespace WordPressVIPMinimum\Sniffs\JS;

use WordPressVIPMinimum\Sniffs\Sniff;
use PHP_CodeSniffer\Util\Tokens;
use WordPressVIPMinimum\Sniffs\Sniff;

/**
* WordPressVIPMinimum_Sniffs_JS_WindowSniff.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

namespace WordPressVIPMinimum\Sniffs\Performance;

use WordPressVIPMinimum\Sniffs\Sniff;
use PHP_CodeSniffer\Util\Tokens;
use WordPressVIPMinimum\Sniffs\Sniff;

/**
* This sniff check whether a cached value is being overridden.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

namespace WordPressVIPMinimum\Sniffs\Performance;

use WordPressVIPMinimum\Sniffs\Sniff;
use PHP_CodeSniffer\Util\Tokens;
use WordPressVIPMinimum\Sniffs\Sniff;

/**
* Restricts usage of file_get_contents().
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

namespace WordPressVIPMinimum\Sniffs\Performance;

use WordPressVIPMinimum\Sniffs\Sniff;
use PHP_CodeSniffer\Util\Tokens;
use WordPressVIPMinimum\Sniffs\Sniff;

/**
* Restricts the implementation of taxonomy term meta via options.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

namespace WordPressVIPMinimum\Sniffs\Performance;

use WordPressCS\WordPress\AbstractArrayAssignmentRestrictionsSniff;
use PHP_CodeSniffer\Util\Tokens;
use WordPressCS\WordPress\AbstractArrayAssignmentRestrictionsSniff;

/**
* Flag suspicious WP_Query and get_posts params.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

namespace WordPressVIPMinimum\Sniffs\Security;

use WordPressVIPMinimum\Sniffs\Sniff;
use PHP_CodeSniffer\Util\Tokens;
use WordPressVIPMinimum\Sniffs\Sniff;

/**
* Flag functions that don't return anything, yet are wrapped in an escaping function call.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

namespace WordPressVIPMinimum\Sniffs\Security;

use WordPressVIPMinimum\Sniffs\Sniff;
use PHP_CodeSniffer\Util\Tokens;
use WordPressVIPMinimum\Sniffs\Sniff;

/**
* Require `exit;` being called after wp_redirect and wp_safe_redirect.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

namespace WordPressVIPMinimum\Sniffs\Security;

use WordPressVIPMinimum\Sniffs\Sniff;
use PHP_CodeSniffer\Util\Tokens;
use WordPressVIPMinimum\Sniffs\Sniff;

/**
* Restricts usage of str_replace with all 3 params being static.
Expand Down
4 changes: 3 additions & 1 deletion WordPressVIPMinimum/Sniffs/Sniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@

namespace WordPressVIPMinimum\Sniffs;

use WordPressCS\WordPress\Sniff as WPCS_Sniff;

/**
* Represents a WordPress\Sniff for sniffing VIP coding standards.
*
* Provides a bootstrap for the sniffs, to reduce code duplication.
*
* @package VIPCS\WordPressVIPMinimum
*/
abstract class Sniff extends \WordPressCS\WordPress\Sniff {
abstract class Sniff extends WPCS_Sniff {
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

namespace WordPressVIPMinimum\Sniffs\UserExperience;

use PHP_CodeSniffer\Util\Tokens;
use PHPCSUtils\Utils\GetTokensAsString;
use PHPCSUtils\Utils\TextStrings;
use WordPressCS\WordPress\AbstractFunctionParameterSniff;
use PHP_CodeSniffer\Util\Tokens;

/**
* Discourages removal of the admin bar.
Expand Down