Skip to content

Commit 471d44f

Browse files
jrfnlbitdaw
andcommitted
Docs: fix various incorrect type annotations
Includes a number of fixes previously pulled in (closed) PR 3703. Co-authored-by: Andrew Dawes <andrewsdawes@gmail.com>
1 parent f199b60 commit 471d44f

File tree

70 files changed

+84
-82
lines changed

Some content is hidden

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

70 files changed

+84
-82
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ The file documents changes to the PHP_CodeSniffer project.
9191
- Thanks to Juliette Reinders Folmer (@jrfnl) for the patch
9292
- Improved README syntax highlighting
9393
- Thanks to Benjamin Loison (@Benjamin-Loison) for the patch
94+
- Various documentation improvements
95+
- Thanks to Andrew Dawes (@AndrewDawes) and Juliette Reinders Folmer (@jrfnl) for the patches
9496

9597
### Removed
9698
- Removed support for installing via PEAR

src/Config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* 2: ruleset and file parsing output
2828
* 3: sniff execution output
2929
* @property bool $interactive Enable interactive checking mode.
30-
* @property bool $parallel Check files in parallel.
30+
* @property int $parallel Check files in parallel.
3131
* @property bool $cache Enable the use of the file cache.
3232
* @property bool $cacheFile A file where the cache data should be written
3333
* @property bool $colors Display colours in output.

src/Files/FileList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public function current()
199199
/**
200200
* Return the file path of the current file being processed.
201201
*
202-
* @return void
202+
* @return string|null Path name or `null` when the end of the iterator has been reached.
203203
*/
204204
#[ReturnTypeWillChange]
205205
public function key()

src/Fixer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class Fixer
7070
* If a token is being "fixed" back to its last value, the fix is
7171
* probably conflicting with another.
7272
*
73-
* @var array<int, string>
73+
* @var array<int, array<string, mixed>>
7474
*/
7575
private $oldTokenValues = [];
7676

@@ -349,7 +349,7 @@ public function getTokenContent($stackPtr)
349349
/**
350350
* Start recording actions for a changeset.
351351
*
352-
* @return void
352+
* @return void|false
353353
*/
354354
public function beginChangeset()
355355
{

src/Reports/Hgblame.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Hgblame extends VersionControl
2828
*
2929
* @param string $line Line to parse.
3030
*
31-
* @return mixed string or false if impossible to recover.
31+
* @return string|false String or FALSE if impossible to recover.
3232
*/
3333
protected function getAuthor($line)
3434
{

src/Reports/Notifysend.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public function generate(
154154
* @param int $totalErrors Total number of errors found during the run.
155155
* @param int $totalWarnings Total number of warnings found during the run.
156156
*
157-
* @return string Error message or NULL if no error/warning found.
157+
* @return string|null Error message or NULL if no error/warning found.
158158
*/
159159
protected function generateMessage($checkedFiles, $totalErrors, $totalWarnings)
160160
{

src/Ruleset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class Ruleset
4747
* The key is the regular expression and the value is the type
4848
* of ignore pattern (absolute or relative).
4949
*
50-
* @var array<string, string>
50+
* @var array<string, array>
5151
*/
5252
public $ignorePatterns = [];
5353

src/Runner.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Runner
4949
/**
5050
* Run the PHPCS script.
5151
*
52-
* @return array
52+
* @return int
5353
*/
5454
public function runPHPCS()
5555
{
@@ -151,7 +151,7 @@ public function runPHPCS()
151151
/**
152152
* Run the PHPCBF script.
153153
*
154-
* @return array
154+
* @return int
155155
*/
156156
public function runPHPCBF()
157157
{
@@ -595,7 +595,7 @@ private function run()
595595
* @param string $file The path of the file that raised the error.
596596
* @param int $line The line number the error was raised at.
597597
*
598-
* @return void
598+
* @return bool
599599
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException
600600
*/
601601
public function handleErrors($code, $message, $file, $line)

src/Sniffs/AbstractPatternSniff.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ final public function process(File $phpcsFile, $stackPtr)
250250
* @param int $stackPtr The position in the tokens stack where
251251
* the listening token type was found.
252252
*
253-
* @return array
253+
* @return array|false
254254
*/
255255
protected function processPattern($patternInfo, File $phpcsFile, $stackPtr)
256256
{
@@ -850,7 +850,7 @@ private function parse($pattern)
850850
* Creates a skip pattern.
851851
*
852852
* @param string $pattern The pattern being parsed.
853-
* @param string $from The token content that the skip pattern starts from.
853+
* @param int $from The token position that the skip pattern starts from.
854854
*
855855
* @return array The pattern step.
856856
* @see createTokenPattern()

src/Sniffs/AbstractScopeSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ abstract class AbstractScopeSniff implements Sniff
4242
/**
4343
* The type of scope opener tokens that this test wishes to listen to.
4444
*
45-
* @var string
45+
* @var array<int|string>
4646
*/
4747
private $scopeTokens = [];
4848

0 commit comments

Comments
 (0)