Skip to content

Commit ff4acee

Browse files
authored
Merge pull request #826 from Automattic/feature/docs-improve-specificity
2 parents 6e53ed0 + 97d83d5 commit ff4acee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+79
-91
lines changed

WordPressVIPMinimum/Sniffs/AbstractVariableRestrictionsSniff.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ abstract class AbstractVariableRestrictionsSniff extends Sniff {
5858
/**
5959
* Returns an array of tokens this test wants to listen for.
6060
*
61-
* @return array
61+
* @return array<int|string>
6262
*/
6363
public function register() {
6464
// Retrieve the groups only once and don't set up a listener if there are no groups.
@@ -91,7 +91,7 @@ public function register() {
9191
* )
9292
* )
9393
*
94-
* @return array
94+
* @return array<string, array<string, string|array<string>>>
9595
*/
9696
abstract public function getGroups();
9797

WordPressVIPMinimum/Sniffs/Classes/DeclarationCompatibilitySniff.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class DeclarationCompatibilitySniff extends AbstractScopeSniff {
2727
/**
2828
* A list of classes and methods to check.
2929
*
30-
* @var array<string, array<string, array<string, mixed>>>
30+
* @var array<string, array<string, array<int|string, string|array<string, bool|string>>>>
3131
*/
3232
public $checkClasses = [
3333
'WP_Widget' => [
@@ -315,7 +315,7 @@ private function addError( $parentClassName, $methodName, $currentMethodSignatur
315315
*
316316
* @param array $methodSignature Signature of a method.
317317
*
318-
* @return array
318+
* @return array<string>
319319
*/
320320
private function generateParamList( $methodSignature ) {
321321
$paramList = [];

WordPressVIPMinimum/Sniffs/Classes/RestrictedExtendClassesSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class RestrictedExtendClassesSniff extends AbstractClassRestrictionsSniff {
1919
/**
2020
* Groups of classes to restrict.
2121
*
22-
* @return array
22+
* @return array<string, array<string, string|array<string>>>
2323
*/
2424
public function getGroups() {
2525
return [

WordPressVIPMinimum/Sniffs/Constants/ConstantStringSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ConstantStringSniff extends Sniff {
2020
/**
2121
* Returns an array of tokens this test wants to listen for.
2222
*
23-
* @return array
23+
* @return array<int|string>
2424
*/
2525
public function register() {
2626
return [

WordPressVIPMinimum/Sniffs/Constants/RestrictedConstantsSniff.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class RestrictedConstantsSniff extends Sniff {
1919
/**
2020
* List of restricted constant names.
2121
*
22-
* @var array
22+
* @var array<string>
2323
*/
2424
public $restrictedConstantNames = [
2525
'A8C_PROXIED_REQUEST',
@@ -28,7 +28,7 @@ class RestrictedConstantsSniff extends Sniff {
2828
/**
2929
* List of restricted constant declarations.
3030
*
31-
* @var array
31+
* @var array<string>
3232
*/
3333
public $restrictedConstantDeclaration = [
3434
'JETPACK_DEV_DEBUG',
@@ -38,7 +38,7 @@ class RestrictedConstantsSniff extends Sniff {
3838
/**
3939
* Returns an array of tokens this test wants to listen for.
4040
*
41-
* @return array
41+
* @return array<int|string>
4242
*/
4343
public function register() {
4444
return [

WordPressVIPMinimum/Sniffs/Files/IncludingFileSniff.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class IncludingFileSniff extends AbstractFunctionRestrictionsSniff {
2020
/**
2121
* List of function used for getting paths.
2222
*
23-
* @var array
23+
* @var array<string>
2424
*/
2525
public $getPathFunctions = [
2626
'dirname',
@@ -55,7 +55,7 @@ class IncludingFileSniff extends AbstractFunctionRestrictionsSniff {
5555
/**
5656
* List of restricted constants.
5757
*
58-
* @var array
58+
* @var array<string, string>
5959
*/
6060
public $restrictedConstants = [
6161
'TEMPLATEPATH' => 'get_template_directory',
@@ -65,7 +65,7 @@ class IncludingFileSniff extends AbstractFunctionRestrictionsSniff {
6565
/**
6666
* List of allowed constants.
6767
*
68-
* @var array
68+
* @var array<string>
6969
*/
7070
public $allowedConstants = [
7171
'ABSPATH',
@@ -77,7 +77,7 @@ class IncludingFileSniff extends AbstractFunctionRestrictionsSniff {
7777
* List of keywords allowed for use in custom constants.
7878
* Note: Customizing this property will overwrite current default values.
7979
*
80-
* @var array
80+
* @var array<string>
8181
*/
8282
public $allowedKeywords = [
8383
'PATH',
@@ -87,7 +87,7 @@ class IncludingFileSniff extends AbstractFunctionRestrictionsSniff {
8787
/**
8888
* Functions used for modify slashes.
8989
*
90-
* @var array
90+
* @var array<string>
9191
*/
9292
public $slashingFunctions = [
9393
'trailingslashit',
@@ -107,7 +107,7 @@ public function getGroups() {
107107
/**
108108
* Returns an array of tokens this test wants to listen for.
109109
*
110-
* @return array
110+
* @return array<int|string>
111111
*/
112112
public function register() {
113113
return Tokens::$includeTokens;

WordPressVIPMinimum/Sniffs/Files/IncludingNonPHPFileSniff.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class IncludingNonPHPFileSniff extends Sniff {
2323
*
2424
* Files with these extensions are allowed to be `include`d.
2525
*
26-
* @var array Key is the extension, value is irrelevant.
26+
* @var array<string, bool> Key is the extension, value is irrelevant.
2727
*/
2828
private $php_extensions = [
2929
'php' => true,
@@ -34,7 +34,7 @@ class IncludingNonPHPFileSniff extends Sniff {
3434
/**
3535
* File extensions used for SVG and CSS files.
3636
*
37-
* @var array Key is the extension, value is irrelevant.
37+
* @var array<string, bool> Key is the extension, value is irrelevant.
3838
*/
3939
private $svg_css_extensions = [
4040
'css' => true,
@@ -44,7 +44,7 @@ class IncludingNonPHPFileSniff extends Sniff {
4444
/**
4545
* Returns an array of tokens this test wants to listen for.
4646
*
47-
* @return array
47+
* @return array<int|string>
4848
*/
4949
public function register() {
5050
return Tokens::$includeTokens;

WordPressVIPMinimum/Sniffs/Functions/CheckReturnValueSniff.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class CheckReturnValueSniff extends Sniff {
2424
/**
2525
* Pairs we are about to check.
2626
*
27-
* @var array
27+
* @var array<string, array<string>>
2828
*/
2929
public $catch = [
3030
'esc_url' => [
@@ -48,7 +48,7 @@ class CheckReturnValueSniff extends Sniff {
4848
/**
4949
* Tokens we are about to examine, which are not functions.
5050
*
51-
* @var array
51+
* @var array<string, int|string>
5252
*/
5353
public $notFunctions = [
5454
'foreach' => T_FOREACH,
@@ -57,7 +57,7 @@ class CheckReturnValueSniff extends Sniff {
5757
/**
5858
* Returns the token types that this sniff is interested in.
5959
*
60-
* @return array(int)
60+
* @return array<int|string>
6161
*/
6262
public function register() {
6363
return [ T_STRING ];
@@ -293,7 +293,7 @@ public function findNonCheckedVariables( $stackPtr ) {
293293
* Function used as as callback for the array_reduce call.
294294
*
295295
* @param string|null $carry The final string.
296-
* @param mixed $item Processed item.
296+
* @param array $item Processed item.
297297
*
298298
* @return string
299299
*/

WordPressVIPMinimum/Sniffs/Functions/DynamicCallsSniff.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class DynamicCallsSniff extends Sniff {
2929
/**
3030
* Functions that should not be called dynamically.
3131
*
32-
* @var array
32+
* @var array<string, bool>
3333
*/
3434
private $disallowed_functions = [
3535
'assert' => true,
@@ -48,7 +48,7 @@ class DynamicCallsSniff extends Sniff {
4848
*
4949
* Populated at run-time.
5050
*
51-
* @var array The key is the name of the variable, the value, its assigned value.
51+
* @var array<string, string> The key is the name of the variable, the value, its assigned value.
5252
*/
5353
private $variables_arr = [];
5454

@@ -62,7 +62,7 @@ class DynamicCallsSniff extends Sniff {
6262
/**
6363
* Returns the token types that this sniff is interested in.
6464
*
65-
* @return array(int)
65+
* @return array<int|string>
6666
*/
6767
public function register() {
6868
return [ T_VARIABLE => T_VARIABLE ];

WordPressVIPMinimum/Sniffs/Functions/RestrictedFunctionsSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class RestrictedFunctionsSniff extends AbstractFunctionRestrictionsSniff {
1818
/**
1919
* Groups of functions to restrict.
2020
*
21-
* @return array
21+
* @return array<string, array<string, string|array<string>|array<string, bool>>>
2222
*/
2323
public function getGroups() {
2424

0 commit comments

Comments
 (0)