Skip to content

Commit 04200fd

Browse files
authored
Merge pull request #295 from Automattic/fix/phpcs-violations-in-vipcs
Fix PHPCS violations in VIPCS
2 parents 395c4de + d846b56 commit 04200fd

File tree

9 files changed

+22
-22
lines changed

9 files changed

+22
-22
lines changed

WordPressVIPMinimum/Sniffs/Classes/RestrictedExtendClassesSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class RestrictedExtendClassesSniff extends AbstractClassRestrictionsSniff {
2828
public function getGroups() {
2929
return array(
3030
'wp_cli' => array(
31-
'type' => 'warning',
31+
'type' => 'warning',
3232
'message' => 'We recommend extending `WPCOM_VIP_CLI_Command` instead of `WP_CLI_Command` and using the helper functions available in it (such as `stop_the_insanity()`), see https://vip.wordpress.com/documentation/writing-bin-scripts/ for more information.',
3333
'classes' => array(
3434
'WP_CLI_Command',

WordPressVIPMinimum/Sniffs/Filters/RestrictedHookSniff.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ class RestrictedHookSniff extends AbstractFunctionParameterSniff {
5454
// WordPress.com: https://lobby.vip.wordpress.com/wordpress-com-documentation/fetching-remote-data/.
5555
// VIP Go: https://vip.wordpress.com/documentation/vip-go/fetching-remote-data/.
5656
'type' => 'Warning',
57-
'msg' => 'Please ensure that the timeout being filtered is not greater than 3s since remote requests require the user to wait for completion before the rest of the page will load. Manual inspection required.',
58-
'code' => 'HighTimeout',
57+
'msg' => 'Please ensure that the timeout being filtered is not greater than 3s since remote requests require the user to wait for completion before the rest of the page will load. Manual inspection required.',
58+
'code' => 'HighTimeout',
5959
],
6060
'http_request_args' => [
6161
// WordPress.com: https://lobby.vip.wordpress.com/wordpress-com-documentation/fetching-remote-data/.
6262
// VIP Go: https://vip.wordpress.com/documentation/vip-go/fetching-remote-data/.
6363
'type' => 'Warning',
64-
'msg' => 'Please ensure that the timeout being filtered is not greater than 3s since remote requests require the user to wait for completion before the rest of the page will load. Manual inspection required.',
65-
'code' => 'HighTimeout',
64+
'msg' => 'Please ensure that the timeout being filtered is not greater than 3s since remote requests require the user to wait for completion before the rest of the page will load. Manual inspection required.',
65+
'code' => 'HighTimeout',
6666
],
6767
];
6868

WordPressVIPMinimum/Sniffs/Functions/StripTagsSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class StripTagsSniff extends AbstractFunctionParameterSniff {
3434
* depending on your needs.
3535
*/
3636
protected $target_functions = [
37-
'strip_tags' => true,
37+
'strip_tags' => true,
3838
];
3939

4040
/**

WordPressVIPMinimum/Sniffs/JS/WindowSniff.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ public function register() {
5959
'port' => true,
6060
'password' => true,
6161
],
62-
'name' => true,
63-
'status' => true,
62+
'name' => true,
63+
'status' => true,
6464
];
6565

6666
/**
@@ -90,7 +90,7 @@ public function process( File $phpcsFile, $stackPtr ) {
9090
}
9191

9292
$nextTokenPtr = $phpcsFile->findNext( Tokens::$emptyTokens, ( $stackPtr + 1 ), null, true, null, true );
93-
$nextToken = $tokens[ $nextTokenPtr ]['code'];
93+
$nextToken = $tokens[ $nextTokenPtr ]['code'];
9494
if ( T_OBJECT_OPERATOR !== $nextToken && T_OPEN_SQUARE_BRACKET !== $nextToken ) {
9595
// No . or [' next, bail.
9696
return;
@@ -109,7 +109,7 @@ public function process( File $phpcsFile, $stackPtr ) {
109109
}
110110

111111
$nextNextNextTokenPtr = $phpcsFile->findNext( array_merge( [ T_CLOSE_SQUARE_BRACKET ], Tokens::$emptyTokens ), ( $nextNextTokenPtr + 1 ), null, true, null, true );
112-
$nextNextNextToken = $tokens[ $nextNextNextTokenPtr ]['code'];
112+
$nextNextNextToken = $tokens[ $nextNextNextTokenPtr ]['code'];
113113

114114
$nextNextNextNextToken = false;
115115
if ( T_OBJECT_OPERATOR === $nextNextNextToken || T_OPEN_SQUARE_BRACKET === $nextNextNextToken ) {
@@ -126,7 +126,7 @@ public function process( File $phpcsFile, $stackPtr ) {
126126
}
127127
}
128128

129-
$windowProperty = 'window.';
129+
$windowProperty = 'window.';
130130
$windowProperty .= $nextNextNextNextToken ? $nextNextToken . '.' . $nextNextNextNextToken : $nextNextToken;
131131

132132
$prevTokenPtr = $phpcsFile->findPrevious( Tokens::$emptyTokens, ( $stackPtr - 1 ), null, true, null, true );

WordPressVIPMinimum/Sniffs/Variables/ServerVariablesSniff.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ class ServerVariablesSniff implements Sniff {
2424
* @var array
2525
*/
2626
public $restrictedVariables = array(
27-
'authVariables' => array(
27+
'authVariables' => array(
2828
'PHP_AUTH_USER' => true,
2929
'PHP_AUTH_PW' => true,
3030
),
31-
'userControlledVariables' => array(
31+
'userControlledVariables' => array(
3232
'HTTP_X_IP_TRAIL' => true,
3333
'HTTP_X_FORWARDED_FOR' => true,
3434
'REMOTE_ADDR' => true,

WordPressVIPMinimum/Tests/Filters/AlwaysReturnUnitTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ public function getErrorList() {
3131
*/
3232
public function getWarningList() {
3333
return array(
34-
15 => 1,
35-
49 => 1,
36-
88 => 1,
37-
95 => 1,
34+
15 => 1,
35+
49 => 1,
36+
88 => 1,
37+
95 => 1,
3838
105 => 1,
3939
);
4040
}

WordPressVIPMinimum/Tests/Filters/RestrictedHookUnitTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ public function getErrorList() {
3333
*/
3434
public function getWarningList() {
3535
return array(
36-
7 => 1,
37-
8 => 1,
38-
9 => 1,
36+
7 => 1,
37+
8 => 1,
38+
9 => 1,
3939
10 => 1,
4040
11 => 1,
4141
12 => 1,

WordPressVIPMinimum/Tests/Variables/VariableAnalysisUnitTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function getErrorList() {
3232
*/
3333
public function getWarningList() {
3434
return [
35-
5 => 2,
35+
5 => 2,
3636
18 => 2,
3737
];
3838
}

bin/phpcs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
#
1010
# ./bin/phpcs
1111

12-
"$(pwd)/vendor/bin/phpcs" --runtime-set ignore_warnings_on_exit 1
12+
"$(pwd)/vendor/bin/phpcs"

0 commit comments

Comments
 (0)