Skip to content

Commit

Permalink
Merge pull request #94 from PHPCSStandards/feature/various-doc-fixes
Browse files Browse the repository at this point in the history
Docs: variety of fixes
  • Loading branch information
jrfnl committed Dec 4, 2023
2 parents d84144d + 471d44f commit df71300
Show file tree
Hide file tree
Showing 73 changed files with 88 additions and 86 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ The file documents changes to the PHP_CodeSniffer project.
- Thanks to Juliette Reinders Folmer (@jrfnl) for the patch
- Improved README syntax highlighting
- Thanks to Benjamin Loison (@Benjamin-Loison) for the patch
- Various documentation improvements
- Thanks to Andrew Dawes (@AndrewDawes) and Juliette Reinders Folmer (@jrfnl) for the patches

### Removed
- Removed support for installing via PEAR
Expand Down
2 changes: 1 addition & 1 deletion src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* 2: ruleset and file parsing output
* 3: sniff execution output
* @property bool $interactive Enable interactive checking mode.
* @property bool $parallel Check files in parallel.
* @property int $parallel Check files in parallel.
* @property bool $cache Enable the use of the file cache.
* @property bool $cacheFile A file where the cache data should be written
* @property bool $colors Display colours in output.
Expand Down
2 changes: 1 addition & 1 deletion src/Files/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ public function addErrorOnLine(


/**
* Records a warning against a specific token in the file.
* Records a warning against a specific line in the file.
*
* @param string $warning The error message.
* @param int $line The line on which the warning occurred.
Expand Down
2 changes: 1 addition & 1 deletion src/Files/FileList.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public function current()
/**
* Return the file path of the current file being processed.
*
* @return void
* @return string|null Path name or `null` when the end of the iterator has been reached.
*/
#[ReturnTypeWillChange]
public function key()
Expand Down
4 changes: 2 additions & 2 deletions src/Fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class Fixer
* If a token is being "fixed" back to its last value, the fix is
* probably conflicting with another.
*
* @var array<int, string>
* @var array<int, array<string, mixed>>
*/
private $oldTokenValues = [];

Expand Down Expand Up @@ -349,7 +349,7 @@ public function getTokenContent($stackPtr)
/**
* Start recording actions for a changeset.
*
* @return void
* @return void|false
*/
public function beginChangeset()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Reports/Hgblame.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Hgblame extends VersionControl
*
* @param string $line Line to parse.
*
* @return mixed string or false if impossible to recover.
* @return string|false String or FALSE if impossible to recover.
*/
protected function getAuthor($line)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Reports/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function generateFileReport($report, File $phpcsFile, $showSources=false,


/**
* Prints the source of all errors and warnings.
* Prints the recorded metrics.
*
* @param string $cachedData Any partial report data that was returned from
* generateFileReport during the run.
Expand Down
2 changes: 1 addition & 1 deletion src/Reports/Notifysend.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public function generate(
* @param int $totalErrors Total number of errors found during the run.
* @param int $totalWarnings Total number of warnings found during the run.
*
* @return string Error message or NULL if no error/warning found.
* @return string|null Error message or NULL if no error/warning found.
*/
protected function generateMessage($checkedFiles, $totalErrors, $totalWarnings)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Ruleset.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Ruleset
* The key is the regular expression and the value is the type
* of ignore pattern (absolute or relative).
*
* @var array<string, string>
* @var array<string, array>
*/
public $ignorePatterns = [];

Expand Down
6 changes: 3 additions & 3 deletions src/Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Runner
/**
* Run the PHPCS script.
*
* @return array
* @return int
*/
public function runPHPCS()
{
Expand Down Expand Up @@ -151,7 +151,7 @@ public function runPHPCS()
/**
* Run the PHPCBF script.
*
* @return array
* @return int
*/
public function runPHPCBF()
{
Expand Down Expand Up @@ -595,7 +595,7 @@ private function run()
* @param string $file The path of the file that raised the error.
* @param int $line The line number the error was raised at.
*
* @return void
* @return bool
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException
*/
public function handleErrors($code, $message, $file, $line)
Expand Down
4 changes: 2 additions & 2 deletions src/Sniffs/AbstractPatternSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ final public function process(File $phpcsFile, $stackPtr)
* @param int $stackPtr The position in the tokens stack where
* the listening token type was found.
*
* @return array
* @return array|false
*/
protected function processPattern($patternInfo, File $phpcsFile, $stackPtr)
{
Expand Down Expand Up @@ -850,7 +850,7 @@ private function parse($pattern)
* Creates a skip pattern.
*
* @param string $pattern The pattern being parsed.
* @param string $from The token content that the skip pattern starts from.
* @param int $from The token position that the skip pattern starts from.
*
* @return array The pattern step.
* @see createTokenPattern()
Expand Down
2 changes: 1 addition & 1 deletion src/Sniffs/AbstractScopeSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ abstract class AbstractScopeSniff implements Sniff
/**
* The type of scope opener tokens that this test wishes to listen to.
*
* @var string
* @var array<int|string>
*/
private $scopeTokens = [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class DisallowShortArraySyntaxSniff implements Sniff
/**
* Registers the tokens that this sniff wants to listen for.
*
* @return int[]
* @return array<int|string>
*/
public function register()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ public function process(File $phpcsFile, $stackPtr)
/**
* Get all used variables in the incrementer part of a for statement.
*
* @param array(integer=>array) $tokens Array with all code sniffer tokens.
* @param array(string=>mixed) $token Current for loop token
* @param array<int, array> $tokens Array with all code sniffer tokens.
* @param array<string, mixed> $token Current for loop token
*
* @return string[] List of all found incrementer variables.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function register()
* @param int $stackPtr The position of the current token in the
* stack passed in $tokens.
*
* @return void
* @return void|int
*/
public function process(File $phpcsFile, $stackPtr)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Standards/Generic/Sniffs/Debug/ClosureLinterSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ class ClosureLinterSniff implements Sniff
*
* All other error codes will show warnings.
*
* @var integer
* @var array
*/
public $errorCodes = [];

/**
* A list of error codes to ignore.
*
* @var integer
* @var array
*/
public $ignoreCodes = [];

Expand Down
2 changes: 1 addition & 1 deletion src/Standards/Generic/Sniffs/Files/InlineHTMLSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function register()
* @param int $stackPtr The position of the current token in
* the stack passed in $tokens.
*
* @return int|null
* @return int|void
*/
public function process(File $phpcsFile, $stackPtr)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class OpeningFunctionBraceKernighanRitchieSniff implements Sniff
/**
* Registers the tokens that this sniff wants to listen for.
*
* @return void
* @return array<int|string>
*/
public function register()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class DisallowAlternativePHPTagsSniff implements Sniff
/**
* The current PHP version.
*
* @var integer
* @var integer|string|null
*/
private $phpVersion = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function register()
* @param int $stackPtr The position of the current token
* in the stack passed in $tokens.
*
* @return void
* @return void|int
*/
public function process(File $phpcsFile, $stackPtr)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function register()
* @param int $stackPtr The position of the current token in the
* stack passed in $tokens.
*
* @return void
* @return void|int
*/
public function process(File $phpcsFile, $stackPtr)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Standards/Generic/Sniffs/PHP/SyntaxSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function register()
* @param int $stackPtr The position of the current token in
* the stack passed in $tokens.
*
* @return void
* @return int
*/
public function process(File $phpcsFile, $stackPtr)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function register()
* @param int $stackPtr The position of the current token in the
* stack passed in $tokens.
*
* @return void
* @return int
*/
public function process(File $phpcsFile, $stackPtr)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function register()
* @param int $stackPtr The position of the current token
* in the stack passed in $tokens.
*
* @return void
* @return int
*/
public function process(File $phpcsFile, $stackPtr)
{
Expand Down Expand Up @@ -113,7 +113,7 @@ public function process(File $phpcsFile, $stackPtr)
*
* @param string $path The path to return Subversion properties on.
*
* @return array
* @return array|null
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If Subversion properties file could
* not be opened.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function register()
* @param int $stackPtr The position of the current token in
* the stack passed in $tokens.
*
* @return void
* @return void|int
*/
public function process(File $phpcsFile, $stackPtr)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function register()
* @param int $stackPtr The position of the current token in
* the stack passed in $tokens.
*
* @return void
* @return int
*/
public function process(File $phpcsFile, $stackPtr)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function register()
* @param int $stackPtr The position of the current token in
* the stack passed in $tokens.
*
* @return void
* @return int
*/
public function process(File $phpcsFile, $stackPtr)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class ScopeIndentSniff implements Sniff
* This is a cached copy of the public version of this var, which
* can be set in a ruleset file, and some core ignored tokens.
*
* @var int[]
* @var array<int|string, bool>
*/
private $ignoreIndentation = [];

Expand Down
2 changes: 1 addition & 1 deletion src/Standards/Generic/Tests/Debug/CSSLintUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class CSSLintUnitTest extends AbstractSniffUnitTest
/**
* Should this test be skipped for some reason.
*
* @return void
* @return bool
*/
protected function shouldSkipTest()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ClosureLinterUnitTest extends AbstractSniffUnitTest
/**
* Should this test be skipped for some reason.
*
* @return void
* @return bool
*/
protected function shouldSkipTest()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Standards/Generic/Tests/Debug/ESLintUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected function resetProperties()
/**
* Should this test be skipped for some reason.
*
* @return void
* @return bool
*/
protected function shouldSkipTest()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Standards/Generic/Tests/Debug/JSHintUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class JSHintUnitTest extends AbstractSniffUnitTest
/**
* Should this test be skipped for some reason.
*
* @return void
* @return bool
*/
protected function shouldSkipTest()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ExecutableFileUnitTest extends AbstractSniffUnitTest
/**
* Should this test be skipped for some reason.
*
* @return void
* @return bool
*/
protected function shouldSkipTest()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class SubversionPropertiesUnitTest extends AbstractSniffUnitTest
/**
* Should this test be skipped for some reason.
*
* @return void
* @return bool
*/
protected function shouldSkipTest()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class BrowserSpecificStylesSniff implements Sniff
/**
* Returns the token types that this sniff is interested in.
*
* @return int[]
* @return array<int|string>
*/
public function register()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function process(File $phpcsFile, $stackPtr)
* @param int $stackPtr The position in the tokens array of the
* potentially included class.
*
* @return string
* @return bool
*/
protected function getIncludedClassFromToken(
$phpcsFile,
Expand Down
4 changes: 2 additions & 2 deletions src/Standards/MySource/Sniffs/Channels/IncludeSystemSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class IncludeSystemSniff extends AbstractScopeSniff
/**
* A list of classes that don't need to be included.
*
* @var string[]
* @var array<string, bool>
*/
private $ignore = [
'self' => true,
Expand Down Expand Up @@ -286,7 +286,7 @@ protected function processTokenOutsideScope(File $phpcsFile, $stackPtr)
* @param int $stackPtr The position in the tokens array of the
* potentially included class.
*
* @return string
* @return string|false
*/
protected function getIncludedClassFromToken(File $phpcsFile, array $tokens, $stackPtr)
{
Expand Down

0 comments on commit df71300

Please sign in to comment.