Skip to content

Commit 84acf4e

Browse files
committed
Docs: improve type declarations
This commit addresses the `@return` tag for all sniff `register()` methods. Future commits may follow for other parts of the codebase. PHP native tokens will always be integers. PHP_CodeSniffer polyfilled and PHP_CodeSniffer native tokens will always be strings. While some sniffs only return one or the other, I've chosen to update these tags to be the same across all sniffs for consistency.
1 parent 5b9078f commit 84acf4e

File tree

205 files changed

+213
-213
lines changed

Some content is hidden

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

205 files changed

+213
-213
lines changed

src/Sniffs/AbstractArraySniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ abstract class AbstractArraySniff implements Sniff
1919
/**
2020
* Returns an array of tokens this test wants to listen for.
2121
*
22-
* @return array
22+
* @return array<int|string>
2323
*/
2424
final public function register()
2525
{

src/Sniffs/AbstractPatternSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function __construct($ignoreComments=null)
7878
* Classes extending <i>AbstractPatternTest</i> should implement the
7979
* <i>getPatterns()</i> method to register the patterns they wish to test.
8080
*
81-
* @return int[]
81+
* @return array<int|string>
8282
* @see process()
8383
*/
8484
final public function register()

src/Sniffs/AbstractScopeSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function __construct(
104104
* DO NOT OVERRIDE THIS METHOD. Use the constructor of this class to register
105105
* for the desired tokens and scope.
106106
*
107-
* @return int[]
107+
* @return array<int|string>
108108
* @see __constructor()
109109
*/
110110
final public function register()

src/Sniffs/Sniff.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ interface Sniff
2828
*
2929
* <code>
3030
* return array(
31-
* T_WHITESPACE,
32-
* T_DOC_COMMENT,
33-
* T_COMMENT,
34-
* );
31+
* T_WHITESPACE,
32+
* T_DOC_COMMENT,
33+
* T_COMMENT,
34+
* );
3535
* </code>
3636
*
37-
* @return mixed[]
37+
* @return array<int|string>
3838
* @see Tokens.php
3939
*/
4040
public function register();

src/Standards/Generic/Sniffs/Arrays/DisallowLongArraySyntaxSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class DisallowLongArraySyntaxSniff implements Sniff
1919
/**
2020
* Registers the tokens that this sniff wants to listen for.
2121
*
22-
* @return int[]
22+
* @return array<int|string>
2323
*/
2424
public function register()
2525
{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class DuplicateClassNameSniff implements Sniff
2626
/**
2727
* Registers the tokens that this sniff wants to listen for.
2828
*
29-
* @return int[]
29+
* @return array<int|string>
3030
*/
3131
public function register()
3232
{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class OpeningBraceSameLineSniff implements Sniff
1919
/**
2020
* Returns an array of tokens this test wants to listen for.
2121
*
22-
* @return array
22+
* @return array<int|string>
2323
*/
2424
public function register()
2525
{

src/Standards/Generic/Sniffs/CodeAnalysis/AssignmentInConditionSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class AssignmentInConditionSniff implements Sniff
4040
/**
4141
* Registers the tokens that this sniff wants to listen for.
4242
*
43-
* @return int[]
43+
* @return array<int|string>
4444
*/
4545
public function register()
4646
{

src/Standards/Generic/Sniffs/CodeAnalysis/EmptyPHPStatementSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class EmptyPHPStatementSniff implements Sniff
2323
/**
2424
* Returns an array of tokens this test wants to listen for.
2525
*
26-
* @return int[]
26+
* @return array<int|string>
2727
*/
2828
public function register()
2929
{

src/Standards/Generic/Sniffs/CodeAnalysis/EmptyStatementSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class EmptyStatementSniff implements Sniff
3434
/**
3535
* Registers the tokens that this sniff wants to listen for.
3636
*
37-
* @return int[]
37+
* @return array<int|string>
3838
*/
3939
public function register()
4040
{

0 commit comments

Comments
 (0)