Skip to content

Commit b44d419

Browse files
committed
Docs: various minor fixes
... picked up along the way.
1 parent c93eb90 commit b44d419

28 files changed

+72
-69
lines changed

autoload.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ class Autoload
2626
/**
2727
* The composer autoloader.
2828
*
29-
* @var \Composer\Autoload\ClassLoader
29+
* @var \Composer\Autoload\ClassLoader|false|null The autoloader object or FALSE if no Composer autoloader could
30+
* be found. NULL when this hasn't been determined yet.
3031
*/
3132
private static $composerAutoloader = null;
3233

src/Files/File.php

+14-14
Original file line numberDiff line numberDiff line change
@@ -656,13 +656,13 @@ public function cleanUp()
656656
/**
657657
* Records an error against a specific token in the file.
658658
*
659-
* @param string $error The error message.
660-
* @param int $stackPtr The stack position where the error occurred.
661-
* @param string $code A violation code unique to the sniff message.
662-
* @param array $data Replacements for the error message.
663-
* @param int $severity The severity level for this error. A value of 0
664-
* will be converted into the default severity level.
665-
* @param boolean $fixable Can the error be fixed by the sniff?
659+
* @param string $error The error message.
660+
* @param int|null $stackPtr The stack position where the error occurred.
661+
* @param string $code A violation code unique to the sniff message.
662+
* @param array $data Replacements for the error message.
663+
* @param int $severity The severity level for this error. A value of 0
664+
* will be converted into the default severity level.
665+
* @param boolean $fixable Can the error be fixed by the sniff?
666666
*
667667
* @return boolean
668668
*/
@@ -690,13 +690,13 @@ public function addError(
690690
/**
691691
* Records a warning against a specific token in the file.
692692
*
693-
* @param string $warning The error message.
694-
* @param int $stackPtr The stack position where the error occurred.
695-
* @param string $code A violation code unique to the sniff message.
696-
* @param array $data Replacements for the warning message.
697-
* @param int $severity The severity level for this warning. A value of 0
698-
* will be converted into the default severity level.
699-
* @param boolean $fixable Can the warning be fixed by the sniff?
693+
* @param string $warning The error message.
694+
* @param int|null $stackPtr The stack position where the error occurred.
695+
* @param string $code A violation code unique to the sniff message.
696+
* @param array $data Replacements for the warning message.
697+
* @param int $severity The severity level for this warning. A value of 0
698+
* will be converted into the default severity level.
699+
* @param boolean $fixable Can the warning be fixed by the sniff?
700700
*
701701
* @return boolean
702702
*/

src/Standards/Generic/Sniffs/Classes/DuplicateClassNameSniff.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function register()
4343
* @param int $stackPtr The position of the current token
4444
* in the stack passed in $tokens.
4545
*
46-
* @return void
46+
* @return int
4747
*/
4848
public function process(File $phpcsFile, $stackPtr)
4949
{

src/Standards/Generic/Sniffs/WhiteSpace/LanguageConstructSpacingSniff.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ public function register()
5151
* @param int $stackPtr The position of the current token in
5252
* the stack passed in $tokens.
5353
*
54-
* @return void
54+
* @return int|void Integer stack pointer to skip forward or void to continue
55+
* normal file processing.
5556
*/
5657
public function process(File $phpcsFile, $stackPtr)
5758
{

src/Standards/Generic/Tests/Commenting/DocCommentUnitTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function setCliValues($testFile, $config)
4343
*
4444
* @param string $testFile The name of the file being tested.
4545
*
46-
* @return array(int => int)
46+
* @return array<int, int>
4747
*/
4848
public function getErrorList($testFile='')
4949
{
@@ -115,7 +115,7 @@ public function getErrorList($testFile='')
115115
* The key of the array should represent the line number and the value
116116
* should represent the number of warnings that should occur on that line.
117117
*
118-
* @return array(int => int)
118+
* @return array<int, int>
119119
*/
120120
public function getWarningList()
121121
{

src/Standards/Generic/Tests/Files/OneTraitPerFileUnitTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ final class OneTraitPerFileUnitTest extends AbstractSniffUnitTest
2626
* The key of the array should represent the line number and the value
2727
* should represent the number of errors that should occur on that line.
2828
*
29-
* @return array(int => int)
29+
* @return array<int, int>
3030
*/
3131
public function getErrorList()
3232
{
@@ -44,7 +44,7 @@ public function getErrorList()
4444
* The key of the array should represent the line number and the value
4545
* should represent the number of warnings that should occur on that line.
4646
*
47-
* @return array(int => int)
47+
* @return array<int, int>
4848
*/
4949
public function getWarningList()
5050
{

src/Standards/Squiz/Sniffs/Classes/ClassFileNameSniff.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ public function register()
3939
* @param int $stackPtr The position of the current token in
4040
* the stack passed in $tokens.
4141
*
42-
* @return void
42+
* @return int|void Integer stack pointer to skip forward or void to continue
43+
* normal file processing.
4344
*/
4445
public function process(File $phpcsFile, $stackPtr)
4546
{

src/Standards/Squiz/Sniffs/Commenting/LongConditionClosingCommentSniff.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class LongConditionClosingCommentSniff implements Sniff
2828
/**
2929
* The openers that we are interested in.
3030
*
31-
* @var integer[]
31+
* @var array<int|string>
3232
*/
3333
private static $openers = [
3434
T_SWITCH,

src/Standards/Squiz/Sniffs/Operators/ComparisonOperatorUsageSniff.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class ComparisonOperatorUsageSniff implements Sniff
4444
/**
4545
* A list of invalid operators with their alternatives.
4646
*
47-
* @var array<string, array<int, string>>
47+
* @var array<string, array<int|string, string>>
4848
*/
4949
private static $invalidOps = [
5050
'PHP' => [

tests/Core/AbstractMethodUnitTest.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ public static function assertTestMarkersAreUnique(File $phpcsFile)
164164
* Note: the test delimiter comment MUST start with "/* test" to allow this function to
165165
* distinguish between comments used *in* a test and test delimiters.
166166
*
167-
* @param string $commentString The delimiter comment to look for.
168-
* @param int|string|array $tokenType The type of token(s) to look for.
169-
* @param string $tokenContent Optional. The token content for the target token.
167+
* @param string $commentString The delimiter comment to look for.
168+
* @param int|string|array<int|string> $tokenType The type of token(s) to look for.
169+
* @param string $tokenContent Optional. The token content for the target token.
170170
*
171171
* @return int
172172
*/
@@ -183,10 +183,10 @@ public function getTargetToken($commentString, $tokenType, $tokenContent=null)
183183
* Note: the test delimiter comment MUST start with "/* test" to allow this function to
184184
* distinguish between comments used *in* a test and test delimiters.
185185
*
186-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file to find the token in.
187-
* @param string $commentString The delimiter comment to look for.
188-
* @param int|string|array $tokenType The type of token(s) to look for.
189-
* @param string $tokenContent Optional. The token content for the target token.
186+
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file to find the token in.
187+
* @param string $commentString The delimiter comment to look for.
188+
* @param int|string|array<int|string> $tokenType The type of token(s) to look for.
189+
* @param string $tokenContent Optional. The token content for the target token.
190190
*
191191
* @return int
192192
*

tests/Core/Config/ExtensionsArgTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function testValidExtensions($passedValue, $expected)
4444
*
4545
* @see self::testValidExtensions()
4646
*
47-
* @return array<int, array<string>>
47+
* @return array<string, array<string, string|array<string, string>>>
4848
*/
4949
public static function dataValidExtensions()
5050
{

tests/Core/Config/GeneratorArgTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function testValidGenerators($argumentValue, $expectedPropertyValue)
4444
*
4545
* @see self::testValidGenerators()
4646
*
47-
* @return array<int, array<string>>
47+
* @return array<string, array<string, string>>
4848
*/
4949
public static function dataValidGeneratorNames()
5050
{
@@ -131,7 +131,7 @@ public function testInvalidGenerator($generatorName)
131131
*
132132
* @see self::testInvalidGenerator()
133133
*
134-
* @return array<int, array<string>>
134+
* @return array<array<string>>
135135
*/
136136
public static function dataInvalidGeneratorNames()
137137
{

tests/Core/File/FindImplementedInterfaceNamesTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function testFindImplementedInterfaceNames($identifier, $expected)
7171
*
7272
* @see testFindImplementedInterfaceNames()
7373
*
74-
* @return array<string, array<string, string|array<string>>>
74+
* @return array<string, array<string, string|array<string>|false>>
7575
*/
7676
public static function dataImplementedInterface()
7777
{

tests/Core/Filters/AbstractFilterTestCase.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,10 @@ protected static function getFakeFileList()
223223
* These type of tests should be able to run and pass on both *nix as well as Windows
224224
* based dev systems. This method is a helper to allow for this.
225225
*
226-
* @param array<string|array> $paths A single or multi-dimensional array containing
227-
* file paths.
226+
* @param array<string|array<string>> $paths A single or multi-dimensional array containing
227+
* file paths.
228228
*
229-
* @return array<string|array>
229+
* @return array<string|array<string>>
230230
*/
231231
protected static function mapPathsToRuntimeOs(array $paths)
232232
{

tests/Core/Filters/GitStagedTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ public function testExecAlwaysReturnsArray($cmd, $expected)
240240
* JRF: I've not managed to find a command which does so, let alone one, which then
241241
* doesn't have side-effects of uncatchable output while running the tests.}
242242
*
243-
* @return array<string, array<string, array<string>>>
243+
* @return array<string, array<string, string|array<string>>>
244244
*/
245245
public static function dataExecAlwaysReturnsArray()
246246
{

tests/Core/Ruleset/DisplayCachedMessagesTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public function testNonBlockingErrorsGenerateOutput($messages, $expected)
136136
*
137137
* @see testNonBlockingErrorsGenerateOutput()
138138
*
139-
* @return array<string, array<string, string|array<string>>>
139+
* @return array<string, array<string, string|array<string, int>>>
140140
*/
141141
public static function dataNonBlockingErrorsGenerateOutput()
142142
{

tests/Core/Ruleset/ProcessRulesetTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ public function testRuleExcludeWithoutNameIsIgnored()
243243
/**
244244
* Test Helper.
245245
*
246-
* @return \PHP_CodeSniffer\Sniffs\Sniff
246+
* @return \PHP_CodeSniffer\Ruleset
247247
*/
248248
private function getMiscRuleset()
249249
{

tests/Core/Sniffs/AbstractArraySniffTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ final class AbstractArraySniffTest extends AbstractMethodUnitTest
2525
* This extends the \PHP_CodeSniffer\Sniffs\AbstractArraySniff class to make the
2626
* internal workings of the sniff observable.
2727
*
28-
* @var \PHP_CodeSniffer\Sniffs\AbstractArraySniffTestable
28+
* @var \PHP_CodeSniffer\Tests\Core\Sniffs\AbstractArraySniffTestable
2929
*/
3030
protected static $sniff;
3131

tests/Core/Tokenizers/AbstractTokenizerTestCase.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ public function testTestMarkersAreUnique()
113113
* Note: the test delimiter comment MUST start with "/* test" to allow this function to
114114
* distinguish between comments used *in* a test and test delimiters.
115115
*
116-
* @param string $commentString The delimiter comment to look for.
117-
* @param int|string|array $tokenType The type of token(s) to look for.
118-
* @param string $tokenContent Optional. The token content for the target token.
116+
* @param string $commentString The delimiter comment to look for.
117+
* @param int|string|array<int|string> $tokenType The type of token(s) to look for.
118+
* @param string $tokenContent Optional. The token content for the target token.
119119
*
120120
* @return int
121121
*/

tests/Core/Tokenizers/PHP/BackfillMatchTokenTest.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -462,16 +462,16 @@ public static function dataSwitchCaseVersusMatch()
462462
* Helper function to verify that all scope related array indexes for a control structure
463463
* are set correctly.
464464
*
465-
* @param string $token The control structure token to check.
466-
* @param int $openerOffset The expected offset of the scope opener in relation to
467-
* the control structure token.
468-
* @param int $closerOffset The expected offset of the scope closer in relation to
469-
* the control structure token.
470-
* @param bool $skipScopeCloserCheck Whether to skip the scope closer check.
471-
* This should be set to "true" when testing nested arrow functions,
472-
* where the "inner" arrow function shares a scope closer with the
473-
* "outer" arrow function, as the 'scope_condition' for the scope closer
474-
* of the "inner" arrow function will point to the "outer" arrow function.
465+
* @param int $token The control structure token to check.
466+
* @param int $openerOffset The expected offset of the scope opener in relation to
467+
* the control structure token.
468+
* @param int $closerOffset The expected offset of the scope closer in relation to
469+
* the control structure token.
470+
* @param bool $skipScopeCloserCheck Whether to skip the scope closer check.
471+
* This should be set to "true" when testing nested arrow functions,
472+
* where the "inner" arrow function shares a scope closer with the
473+
* "outer" arrow function, as the 'scope_condition' for the scope closer
474+
* of the "inner" arrow function will point to the "outer" arrow function.
475475
*
476476
* @return void
477477
*/

tests/Core/Tokenizers/PHP/ContextSensitiveKeywordsTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public function testKeywords($testMarker, $expectedTokenType)
178178
*
179179
* @see testKeywords()
180180
*
181-
* @return array
181+
* @return array<string, array<string, string>>
182182
*/
183183
public static function dataKeywords()
184184
{

tests/Core/Tokenizers/PHP/DNFTypesParseError1Test.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function testBrokenDNFTypeCantEndOnOpenParenthesis($testMarker)
5252
*
5353
* @see testBrokenDNFTypeCantEndOnOpenParenthesis()
5454
*
55-
* @return array<string, array<string, string>>
55+
* @return array<string, array<string>>
5656
*/
5757
public static function dataBrokenDNFTypeCantEndOnOpenParenthesis()
5858
{

tests/Core/Tokenizers/PHP/DNFTypesParseError2Test.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function testBrokenDNFTypeParensShouldAlwaysBeAPairMissingCloseParens($te
6161
*
6262
* @see testBrokenDNFTypeParensShouldAlwaysBeAPairMissingCloseParens()
6363
*
64-
* @return array<string, array<string, string>>
64+
* @return array<string, array<string>>
6565
*/
6666
public static function dataBrokenDNFTypeParensShouldAlwaysBeAPairMissingCloseParens()
6767
{
@@ -120,7 +120,7 @@ public function testBrokenDNFTypeParensShouldAlwaysBeAPairMissingOpenParens($tes
120120
*
121121
* @see testBrokenDNFTypeParensShouldAlwaysBeAPairMissingOpenParens()
122122
*
123-
* @return array<string, array<string, string>>
123+
* @return array<string, array<string>>
124124
*/
125125
public static function dataBrokenDNFTypeParensShouldAlwaysBeAPairMissingOpenParens()
126126
{
@@ -201,7 +201,7 @@ public function testBrokenDNFTypeParensShouldAlwaysBeAPairMatchedAndUnmatched($t
201201
*
202202
* @see testBrokenDNFTypeParensShouldAlwaysBeAPairMatchedAndUnmatched()
203203
*
204-
* @return array<string, array<string, string>>
204+
* @return array<string, array<string>>
205205
*/
206206
public static function dataBrokenDNFTypeParensShouldAlwaysBeAPairMatchedAndUnmatched()
207207
{

tests/Core/Tokenizers/PHP/DNFTypesTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function testNormalParentheses($testMarker, $skipCheckInside=false)
9898
*
9999
* @see testNormalParentheses()
100100
*
101-
* @return array<string, array<string, string|int|false>>
101+
* @return array<string, array<string, string|bool>>
102102
*/
103103
public static function dataNormalParentheses()
104104
{

tests/Core/Tokenizers/PHP/OtherContextSensitiveKeywordsTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function testKeywords($testMarker, $expectedTokenType)
134134
*
135135
* @see testKeywords()
136136
*
137-
* @return array
137+
* @return array<string, array<string, string>>
138138
*/
139139
public static function dataKeywords()
140140
{

tests/Core/Tokenizers/PHP/TypedConstantsTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ public static function dataTypedConstant()
271271
*
272272
* @see testTypedConstant()
273273
*
274-
* @return array<string, array<string, string>>
274+
* @return array<string, array<string, string|array<int|string>>>
275275
*/
276276
public static function dataNullableTypedConstant()
277277
{
@@ -386,7 +386,7 @@ public static function dataNullableTypedConstant()
386386
*
387387
* @see testTypedConstant()
388388
*
389-
* @return array<string, array<string, string>>
389+
* @return array<string, array<string, string|array<int|string>>>
390390
*/
391391
public static function dataUnionTypedConstant()
392392
{
@@ -475,7 +475,7 @@ public static function dataUnionTypedConstant()
475475
*
476476
* @see testTypedConstant()
477477
*
478-
* @return array<string, array<string, string>>
478+
* @return array<string, array<string, string|array<int|string>>>
479479
*/
480480
public static function dataIntersectionTypedConstant()
481481
{
@@ -520,7 +520,7 @@ public static function dataIntersectionTypedConstant()
520520
*
521521
* @see testTypedConstant()
522522
*
523-
* @return array<string, array<string, string>>
523+
* @return array<string, array<string, string|array<int|string>>>
524524
*/
525525
public static function dataDNFTypedConstant()
526526
{

tests/Core/Tokenizers/Tokenizer/RecurseScopeMapSwitchTokenScopeTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function testSwitchScope($testMarker, $expectedTokens, $testOpenerMarker=
9292
*
9393
* @see testSwitchScope()
9494
*
95-
* @return array<string, array<string, string|array<string, int|string>>>
95+
* @return array<string, array<string, string|array<string, int|string>|null>>
9696
*/
9797
public static function dataSwitchScope()
9898
{

0 commit comments

Comments
 (0)