Skip to content

Commit 5466170

Browse files
authored
Merge pull request #2545 from WordPress/feature/docs-improve-type-specificity
2 parents 549cd33 + 641456d commit 5466170

File tree

5 files changed

+11
-14
lines changed

5 files changed

+11
-14
lines changed

WordPress/AbstractFunctionParameterSniff.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@ abstract class AbstractFunctionParameterSniff extends AbstractFunctionRestrictio
3232
/**
3333
* Functions this sniff is looking for. Should be defined in the child class.
3434
*
35-
* @var array The only requirement for this array is that the top level
36-
* array keys are the names of the functions you're looking for.
37-
* Other than that, the array can have arbitrary content
38-
* depending on your needs.
35+
* @var array<string, mixed> The only requirement for this array is that the top level
36+
* array keys are the names of the functions you're looking for.
37+
* Other than that, the array can have arbitrary content
38+
* depending on your needs.
3939
*/
4040
protected $target_functions = array();
4141

4242
/**
4343
* Groups of functions to restrict.
4444
*
45-
* @return array
45+
* @return array<string, array<string, array<string>>>
4646
*/
4747
public function getGroups() {
4848
if ( empty( $this->target_functions ) ) {

WordPress/Sniffs/NamingConventions/ValidHookNameSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class ValidHookNameSniff extends AbstractFunctionParameterSniff {
6969
*
7070
* @since 0.11.0
7171
*
72-
* @return array
72+
* @return array<string, array<string, array<string>>>
7373
*/
7474
public function getGroups() {
7575
// Only retrieve functions which are not used for deprecated hooks.

WordPress/Sniffs/PHP/IniSetSniff.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ final class IniSetSniff extends AbstractFunctionParameterSniff {
3030
*
3131
* @since 2.1.0
3232
*
33-
* @var array Multidimensional array with parameter details.
34-
* $target_functions = array(
35-
* (string) Function name.
36-
* );
33+
* @var array<string, true> Key is function name, value irrelevant.
3734
*/
3835
protected $target_functions = array(
3936
'ini_set' => true,
@@ -47,7 +44,7 @@ final class IniSetSniff extends AbstractFunctionParameterSniff {
4744
* @since 2.1.0
4845
* @since 3.0.0 Renamed from `$whitelisted_options` to `$safe_options`.
4946
*
50-
* @var array Multidimensional array with parameter details.
47+
* @var array<string, array<string, array<string>>> Multidimensional array with parameter details.
5148
* $safe_options = array(
5249
* (string) option name. = array(
5350
* (string[]) 'valid_values' = array()
@@ -74,7 +71,7 @@ final class IniSetSniff extends AbstractFunctionParameterSniff {
7471
* @since 2.1.0
7572
* @since 3.0.0 Renamed from `$blacklisted_options` to `$disallowed_options`.
7673
*
77-
* @var array Multidimensional array with parameter details.
74+
* @var array<string, array<string, string|array<string>>> Multidimensional array with parameter details.
7875
* $disallowed_options = array(
7976
* (string) option name. = array(
8077
* (string[]) 'invalid_values' = array()

WordPress/Sniffs/WP/DeprecatedParameterValuesSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ final class DeprecatedParameterValuesSniff extends AbstractFunctionParameterSnif
4848
* @since 3.0.0 The format of the value has changed to support function calls
4949
* using named parameters.
5050
*
51-
* @var array Multidimensional array with parameter details.
51+
* @var array<string, array<int, array<string, mixed>>> Multidimensional array with parameter details.
5252
* $target_functions = array(
5353
* (string) Function name. => array(
5454
* (int) Target parameter position, 1-based. => array(

WordPress/Sniffs/WP/DeprecatedParametersSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ final class DeprecatedParametersSniff extends AbstractFunctionParameterSniff {
5353
*
5454
* @since 0.12.0
5555
*
56-
* @var array Multidimensional array with parameter details.
56+
* @var array<string, array<int, array<string, mixed>>> Multidimensional array with parameter details.
5757
* $target_functions = array(
5858
* (string) Function name. => array(
5959
* (int) Target parameter position, 1-based. => array(

0 commit comments

Comments
 (0)