Skip to content

Commit 91986ec

Browse files
authored
Merge pull request #1235 from PHPCSStandards/feature/various-doc-fixes
Docs: various type fixes
2 parents 8673f6a + 5255e10 commit 91986ec

File tree

10 files changed

+33
-33
lines changed

10 files changed

+33
-33
lines changed

src/Files/File.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2443,8 +2443,8 @@ public function findNext(
24432443
/**
24442444
* Returns the position of the first non-whitespace token in a statement.
24452445
*
2446-
* @param int $start The position to start searching from in the token stack.
2447-
* @param int|string|array $ignore Token types that should not be considered stop points.
2446+
* @param int $start The position to start searching from in the token stack.
2447+
* @param int|string|array|null $ignore Token types that should not be considered stop points.
24482448
*
24492449
* @return int
24502450
*/
@@ -2634,8 +2634,8 @@ public function findStartOfStatement($start, $ignore=null)
26342634
/**
26352635
* Returns the position of the last non-whitespace token in a statement.
26362636
*
2637-
* @param int $start The position to start searching from in the token stack.
2638-
* @param int|string|array $ignore Token types that should not be considered stop points.
2637+
* @param int $start The position to start searching from in the token stack.
2638+
* @param int|string|array|null $ignore Token types that should not be considered stop points.
26392639
*
26402640
* @return int
26412641
*/
@@ -2756,7 +2756,7 @@ public function findEndOfStatement($start, $ignore=null)
27562756
* token stack.
27572757
* @param bool $exclude If true, find the token that is NOT of
27582758
* the types specified in $types.
2759-
* @param string $value The value that the token must be equal to.
2759+
* @param string|null $value The value that the token must be equal to.
27602760
* If value is omitted, tokens with any value will
27612761
* be returned.
27622762
*

src/Files/FileList.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ public function __construct(Config $config, Ruleset $ruleset)
110110
* If a file object has already been created, it can be passed here.
111111
* If it is left NULL, it will be created when accessed.
112112
*
113-
* @param string $path The path to the file being added.
114-
* @param \PHP_CodeSniffer\Files\File $file The file being added.
113+
* @param string $path The path to the file being added.
114+
* @param \PHP_CodeSniffer\Files\File|null $file The file being added.
115115
*
116116
* @return void
117117
*/

src/Fixer.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,10 @@ public function fixFile()
222222
/**
223223
* Generates a text diff of the original file and the new content.
224224
*
225-
* @param string $filePath Optional file path to diff the file against.
226-
* If not specified, the original version of the
227-
* file will be used.
228-
* @param boolean $colors Print coloured output or not.
225+
* @param string|null $filePath Optional file path to diff the file against.
226+
* If not specified, the original version of the
227+
* file will be used.
228+
* @param boolean $colors Print coloured output or not.
229229
*
230230
* @return string
231231
*
@@ -698,10 +698,10 @@ public function revertToken($stackPtr)
698698
/**
699699
* Replace the content of a token with a part of its current content.
700700
*
701-
* @param int $stackPtr The position of the token in the token stack.
702-
* @param int $start The first character to keep.
703-
* @param int $length The number of characters to keep. If NULL, the content of
704-
* the token from $start to the end of the content is kept.
701+
* @param int $stackPtr The position of the token in the token stack.
702+
* @param int $start The first character to keep.
703+
* @param int|null $length The number of characters to keep. If NULL, the content of
704+
* the token from $start to the end of the content is kept.
705705
*
706706
* @return bool If the change was accepted.
707707
*/

src/Ruleset.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1698,8 +1698,8 @@ public function setSniffProperty($sniffClass, $name, $settings)
16981698
* Optionally takes a listener to get ignore patterns specified
16991699
* for that sniff only.
17001700
*
1701-
* @param string $listener The listener to get patterns for. If NULL, all
1702-
* patterns are returned.
1701+
* @param string|null $listener The listener to get patterns for. If NULL, all
1702+
* patterns are returned.
17031703
*
17041704
* @return array
17051705
*/
@@ -1724,8 +1724,8 @@ public function getIgnorePatterns($listener=null)
17241724
* Optionally takes a listener to get include patterns specified
17251725
* for that sniff only.
17261726
*
1727-
* @param string $listener The listener to get patterns for. If NULL, all
1728-
* patterns are returned.
1727+
* @param string|null $listener The listener to get patterns for. If NULL, all
1728+
* patterns are returned.
17291729
*
17301730
* @return array
17311731
*/

src/Standards/Generic/Sniffs/Formatting/MultipleStatementAlignmentSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function process(File $phpcsFile, $stackPtr)
9292
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
9393
* @param int $stackPtr The position of the current token
9494
* in the stack passed in $tokens.
95-
* @param int $end The token where checking should end.
95+
* @param int|null $end The token where checking should end.
9696
* If NULL, the entire file will be checked.
9797
*
9898
* @return int

src/Standards/Generic/Sniffs/PHP/DeprecatedFunctionsSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function __construct()
5353
* @param int $stackPtr The position of the forbidden function
5454
* in the token array.
5555
* @param string $function The name of the forbidden function.
56-
* @param string $pattern The pattern used for the match.
56+
* @param string|null $pattern The pattern used for the match.
5757
*
5858
* @return void
5959
*/

src/Standards/Generic/Sniffs/PHP/ForbiddenFunctionsSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ public function process(File $phpcsFile, $stackPtr)
206206
* @param int $stackPtr The position of the forbidden function
207207
* in the token array.
208208
* @param string $function The name of the forbidden function.
209-
* @param string $pattern The pattern used for the match.
209+
* @param string|null $pattern The pattern used for the match.
210210
*
211211
* @return void
212212
*/

src/Tokenizers/Tokenizer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -579,10 +579,10 @@ private function createPositionMap()
579579
* is placed into an orig_content index and the new token length is also
580580
* set in the length index.
581581
*
582-
* @param array $token The token to replace tabs inside.
583-
* @param string $prefix The character to use to represent the start of a tab.
584-
* @param string $padding The character to use to represent the end of a tab.
585-
* @param int $tabWidth The number of spaces each tab represents.
582+
* @param array $token The token to replace tabs inside.
583+
* @param string $prefix The character to use to represent the start of a tab.
584+
* @param string $padding The character to use to represent the end of a tab.
585+
* @param int|null $tabWidth The number of spaces each tab represents.
586586
*
587587
* @return void
588588
*/

src/Util/Cache.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,8 @@ public static function save()
300300
/**
301301
* Retrieves a single entry from the cache.
302302
*
303-
* @param string $key The key of the data to get. If NULL,
304-
* everything in the cache is returned.
303+
* @param string|null $key The key of the data to get. If NULL,
304+
* everything in the cache is returned.
305305
*
306306
* @return mixed
307307
*/
@@ -323,9 +323,9 @@ public static function get($key=null)
323323
/**
324324
* Retrieves a single entry from the cache.
325325
*
326-
* @param string $key The key of the data to set. If NULL,
327-
* sets the entire cache.
328-
* @param mixed $value The value to set.
326+
* @param string|null $key The key of the data to set. If NULL,
327+
* sets the entire cache.
328+
* @param mixed $value The value to set.
329329
*
330330
* @return void
331331
*/

src/Util/Tokens.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -804,8 +804,8 @@ public static function tokenName($token)
804804
* @param array<int|string> $tokens The token types to get the highest weighted
805805
* type for.
806806
*
807-
* @return int The highest weighted token.
808-
* On equal "weight", returns the first token of that particular weight.
807+
* @return int|string The highest weighted token.
808+
* On equal "weight", returns the first token of that particular weight.
809809
*/
810810
public static function getHighestWeightedToken(array $tokens)
811811
{

0 commit comments

Comments
 (0)