Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: variety of fixes #3910

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PHP_CodeSniffer is a set of two PHP scripts; the main `phpcs` script that tokeni

[![Build Status](https://github.com/squizlabs/PHP_CodeSniffer/workflows/Validate/badge.svg?branch=master)](https://github.com/squizlabs/PHP_CodeSniffer/actions)
[![Build Status](https://github.com/squizlabs/PHP_CodeSniffer/workflows/Test/badge.svg?branch=master)](https://github.com/squizlabs/PHP_CodeSniffer/actions)
[![Code consistency](http://squizlabs.github.io/PHP_CodeSniffer/analysis/squizlabs/PHP_CodeSniffer/grade.svg)](http://squizlabs.github.io/PHP_CodeSniffer/analysis/squizlabs/PHP_CodeSniffer)
[![Code consistency](https://squizlabs.github.io/PHP_CodeSniffer/analysis/squizlabs/PHP_CodeSniffer/grade.svg)](http://squizlabs.github.io/PHP_CodeSniffer/analysis/squizlabs/PHP_CodeSniffer)
[![Join the chat at https://gitter.im/squizlabs/PHP_CodeSniffer](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/squizlabs/PHP_CodeSniffer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

## Requirements
Expand Down Expand Up @@ -65,7 +65,7 @@ You will then be able to run PHP_CodeSniffer from the tools directory:
./tools/phpcbf -h
```
### PEAR
If you use PEAR, you can install PHP_CodeSniffer using the PEAR installer. This will make the `phpcs` and `phpcbf` commands immediately available for use. To install PHP_CodeSniffer using the PEAR installer, first ensure you have [installed PEAR](http://pear.php.net/manual/en/installation.getting.php) and then run the following command:
If you use PEAR, you can install PHP_CodeSniffer using the PEAR installer. This will make the `phpcs` and `phpcbf` commands immediately available for use. To install PHP_CodeSniffer using the PEAR installer, first ensure you have [installed PEAR](https://pear.php.net/manual/en/installation.getting.php) and then run the following command:
```bash
pear install PHP_CodeSniffer
```
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-phar.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @author Greg Sherwood <[email protected]>
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
* @link http://pear.php.net/package/PHP_CodeSniffer
* @link https://pear.php.net/package/PHP_CodeSniffer
*/

use PHP_CodeSniffer\Config;
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 @@ -739,7 +739,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 @@ -66,7 +66,7 @@ protected function tearDown()
/**
* 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
Loading
Loading