Skip to content

Commit fc4f321

Browse files
authored
Merge pull request #154 from PHPCSStandards/feature/various-docs-fixes
Docs: various fixes & improve type specificity
2 parents 77a01e7 + 684db66 commit fc4f321

File tree

8 files changed

+28
-27
lines changed

8 files changed

+28
-27
lines changed

PHPCSDebug/Sniffs/Debug/TokenListSniff.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class TokenListSniff implements Sniff
2828
/**
2929
* A list of tokenizers this sniff supports.
3030
*
31-
* @var array
31+
* @var array<string>
3232
*/
3333
public $supportedTokenizers = [
3434
'PHP',
@@ -41,7 +41,7 @@ class TokenListSniff implements Sniff
4141
*
4242
* This prevents issues with "undefined index" notices in case of rare tokenizer issues.
4343
*
44-
* @var array
44+
* @var array<string, int|string|array<int, int|string>>
4545
*/
4646
private $tokenDefaults = [
4747
'type' => '?',
@@ -57,7 +57,7 @@ class TokenListSniff implements Sniff
5757
/**
5858
* Returns an array of tokens this test wants to listen for.
5959
*
60-
* @return array
60+
* @return array<int|string>
6161
*/
6262
public function register()
6363
{
@@ -74,7 +74,8 @@ public function register()
7474
* @param int $stackPtr The position of the current
7575
* token in the stack.
7676
*
77-
* @return void
77+
* @return int|void Integer stack pointer to skip forward or void to continue
78+
* normal file processing.
7879
*/
7980
public function process(File $phpcsFile, $stackPtr)
8081
{

PHPCSDebug/Tests/Debug/TokenListCssTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ final class TokenListCssTest extends UtilityMethodTestCase
3333
/**
3434
* Set the name of a sniff to pass to PHPCS to limit the run (and force it to record errors).
3535
*
36-
* @var array
36+
* @var array<string>
3737
*/
3838
protected static $selectedSniff = ['PHPCSDebug.Debug.TokenList'];
3939

PHPCSDebug/Tests/Debug/TokenListJsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ final class TokenListJsTest extends UtilityMethodTestCase
3333
/**
3434
* Set the name of a sniff to pass to PHPCS to limit the run (and force it to record errors).
3535
*
36-
* @var array
36+
* @var array<string>
3737
*/
3838
protected static $selectedSniff = ['PHPCSDebug.Debug.TokenList'];
3939

PHPCSDebug/Tests/Debug/TokenListUnitTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ final class TokenListUnitTest extends UtilityMethodTestCase
2626
/**
2727
* Set the name of a sniff to pass to PHPCS to limit the run (and force it to record errors).
2828
*
29-
* @var array
29+
* @var array<string>
3030
*/
3131
protected static $selectedSniff = ['PHPCSDebug.Debug.TokenList'];
3232

Scripts/CheckSniffCompleteness.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class CheckSniffCompleteness
3131
* To disable showing progress, pass `--no-progress` on the command line
3232
* when calling the script.
3333
*
34-
* @var boolean
34+
* @var bool
3535
*/
3636
protected $showProgress = true;
3737

@@ -43,7 +43,7 @@ class CheckSniffCompleteness
4343
* To enable "quiet" mode, pass `-q` on the command line when calling
4444
* the script.
4545
*
46-
* @var boolean
46+
* @var bool
4747
*/
4848
protected $quietMode = false;
4949

@@ -52,7 +52,7 @@ class CheckSniffCompleteness
5252
*
5353
* This will be automatically detected if not set from the command-line.
5454
*
55-
* @var boolean
55+
* @var bool
5656
*/
5757
protected $showColored;
5858

@@ -66,7 +66,7 @@ class CheckSniffCompleteness
6666
/**
6767
* The target directories to examine.
6868
*
69-
* @var array
69+
* @var array<string>
7070
*/
7171
protected $targetDirs = [];
7272

@@ -80,7 +80,7 @@ class CheckSniffCompleteness
8080
/**
8181
* Directories to exclude from the scan.
8282
*
83-
* @var array
83+
* @var array<string>
8484
*/
8585
protected $excludedDirs = [
8686
'vendor',
@@ -89,14 +89,14 @@ class CheckSniffCompleteness
8989
/**
9090
* List of all files in the repo.
9191
*
92-
* @var array
92+
* @var array<string, int> Key is a file name, value irrelevant.
9393
*/
9494
protected $allFiles = [];
9595

9696
/**
9797
* List of all sniff files in the repo.
9898
*
99-
* @var array
99+
* @var array<string>
100100
*/
101101
protected $allSniffs = [];
102102

@@ -105,7 +105,7 @@ class CheckSniffCompleteness
105105
*
106106
* Keys are the strings to search for, values the replacement values.
107107
*
108-
* @var array
108+
* @var array<string, string>
109109
*/
110110
private $sniffToDoc = [
111111
'/Sniffs/' => '/Docs/',
@@ -117,7 +117,7 @@ class CheckSniffCompleteness
117117
*
118118
* Keys are the strings to search for, values the replacement values.
119119
*
120-
* @var array
120+
* @var array<string, string>
121121
*/
122122
private $sniffToUnitTest = [
123123
'/Sniffs/' => '/Tests/',
@@ -127,7 +127,7 @@ class CheckSniffCompleteness
127127
/**
128128
* Possible test case file extensions.
129129
*
130-
* @var array
130+
* @var array<string>
131131
*/
132132
private $testCaseExtensions = [
133133
'.inc',

Scripts/FileList.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ class FileList
4545
protected $rootPath;
4646

4747
/**
48-
* Recursive directory iterator.
48+
* Regex iterator.
4949
*
50-
* @var \DirectoryIterator
50+
* @var \RegexIterator
5151
*/
5252
protected $fileIterator;
5353

@@ -85,7 +85,7 @@ public function __construct($directory, $rootPath = '', $filter = '')
8585
/**
8686
* Retrieve the filtered file list iterator.
8787
*
88-
* @return array
88+
* @return \RegexIterator
8989
*/
9090
public function getIterator()
9191
{
@@ -95,7 +95,7 @@ public function getIterator()
9595
/**
9696
* Retrieve the filtered file list as an array.
9797
*
98-
* @return array
98+
* @return array<string>
9999
*/
100100
public function getList()
101101
{

Tests/DocsXsd/DocsXsdTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function testXsdValidationPassedWithValidXml($fixtureFile)
5858
/**
5959
* Data provider for valid test cases.
6060
*
61-
* @return array
61+
* @return array<string, array<string, string>>
6262
*/
6363
public function dataValidXsd()
6464
{
@@ -108,7 +108,7 @@ public function testXsdValidationFailsForInvalidXml($fixtureFile, $expectedStdOu
108108
/**
109109
* Data provider for invalid test cases.
110110
*
111-
* @return array
111+
* @return array<string, array<string, string>>
112112
*/
113113
public function dataInvalidXsd()
114114
{

Tests/IOTestCase.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ abstract class IOTestCase extends XTestCase
2828
* Note: if the command itself already contains a "working directory" argument,
2929
* this parameter will normally not need to be passed.
3030
*
31-
* @return array Format:
32-
* 'exitcode' int The exit code from the command.
33-
* 'stdout' string The output send to stdout.
34-
* 'stderr' string The output send to stderr.
31+
* @return array<string, int|string> Format:
32+
* 'exitcode' int The exit code from the command.
33+
* 'stdout' string The output send to stdout.
34+
* 'stderr' string The output send to stderr.
3535
*
3636
* @throws \RuntimeException When the passed arguments do not comply.
3737
* @throws \RuntimeException When no resource could be obtained to execute the command.

0 commit comments

Comments
 (0)