Skip to content

Commit

Permalink
Merge pull request #145 from PHPCSStandards/feature/various-docs-fixes
Browse files Browse the repository at this point in the history
Docs: various small fixes
  • Loading branch information
jrfnl authored Jun 13, 2020
2 parents 4da4916 + 5c38475 commit 675e399
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 18 deletions.
5 changes: 2 additions & 3 deletions PHPCSUtils/BackCompat/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public static function getTabWidth(File $phpcsFile)
*
* @since 1.0.0
*
* @param \PHP_CodeSniffer\Files\File $phpcsFile Optional. The current file being processed.
* @param \PHP_CodeSniffer\Files\File|null $phpcsFile Optional. The current file being processed.
*
* @return string Encoding. Defaults to the PHPCS native default, which is 'utf-8'
* for PHPCS 3.x and was 'iso-8859-1' for PHPCS 2.x.
Expand Down Expand Up @@ -213,8 +213,7 @@ public static function getEncoding(File $phpcsFile = null)
*
* @since 1.0.0
*
* @param \PHP_CodeSniffer\Files\File $phpcsFile Optional. The current file
* being processed.
* @param \PHP_CodeSniffer\Files\File|null $phpcsFile Optional. The current file being processed.
*
* @return bool True if annotations should be ignored, false otherwise.
*/
Expand Down
8 changes: 4 additions & 4 deletions PHPCSUtils/Tokens/Collections.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ class Collections
* It is recommended to use the method instead of the property if a standard supports PHPCS < 3.3.0.
*
* @see \PHPCSUtils\Tokens\Collections::parameterTypeTokensBC() Related method (cross-version).
*
* @since 1.0.0
*
* @var array <int|string> => <int|string>
Expand Down Expand Up @@ -406,7 +406,7 @@ class Collections
* The method supports PHPCS 2.6.0 and up.
*
* Notable differences:
* - The method will include the `T_ARRAY_HINT` and the `T_RETURN_TYPE tokens when used with PHPCS 2.x and 3.x.
* - The method will include the `T_ARRAY_HINT` and the `T_RETURN_TYPE` tokens when used with PHPCS 2.x and 3.x.
* These token constants will no longer exist in PHPCS 4.x.
* - The method will include the `T_ARRAY` token which is needed for select arrow functions in PHPCS < 3.5.4.
*
Expand Down Expand Up @@ -580,7 +580,7 @@ public static function functionDeclarationTokens()
* It is recommended to use the method instead of the property if a standard supports PHPCS < 3.3.0.
*
* @see \PHPCSUtils\Tokens\Collections::functionDeclarationTokens() Related method (PHPCS 3.5.3+).
* @see \PHPCSUtils\Tokens\FunctionDeclarations::isArrowFunction() Arrow function verification.
* @see \PHPCSUtils\Utils\FunctionDeclarations::isArrowFunction() Arrow function verification.
*
* @since 1.0.0
*
Expand Down Expand Up @@ -661,7 +661,7 @@ public static function propertyTypeTokensBC()
* The method supports PHPCS 2.6.0 and up.
*
* Notable differences:
* - The method will include the `T_ARRAY_HINT` and the `T_RETURN_TYPE tokens when used with PHPCS 2.x and 3.x.
* - The method will include the `T_ARRAY_HINT` and the `T_RETURN_TYPE` tokens when used with PHPCS 2.x and 3.x.
* These token constants will no longer exist in PHPCS 4.x.
* - The method will include the `T_ARRAY` token which is needed for select arrow functions in PHPCS < 3.5.4.
*
Expand Down
1 change: 1 addition & 0 deletions PHPCSUtils/Utils/Arrays.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ public static function getDoubleArrowPtr(File $phpcsFile, $start, $end)

/*
* BC: work-around a bug in PHPCS 3.5.4 where the double arrow is incorrectly tokenized as T_STRING.
*
* @link https://github.com/squizlabs/PHP_CodeSniffer/issues/2865
*/
if ($tokens[$doubleArrow]['code'] === \T_STRING && $tokens[$doubleArrow]['content'] === '=>') {
Expand Down
4 changes: 2 additions & 2 deletions PHPCSUtils/Utils/ControlStructures.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public static function isElseIf(File $phpcsFile, $stackPtr)
* Get the scope opener and closer for a `declare` statement.
*
* A `declare` statement can be:
* - applied to the rest of the file, like `declare(ticks=1);`;
* - applied to the rest of the file, like `declare(ticks=1);`
* - applied to a limited scope using curly braces;
* - applied to a limited scope using the alternative control structure syntax.
*
Expand Down Expand Up @@ -358,7 +358,7 @@ public static function getDeclareScopeOpenClose(File $phpcsFile, $stackPtr)
* @return array
*
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified $stackPtr is not of
* type T_CATCH or doesn't exist or in case
* type T_CATCH, doesn't exist or in case
* of a parse error.
*/
public static function getCaughtExceptions(File $phpcsFile, $stackPtr)
Expand Down
4 changes: 2 additions & 2 deletions PHPCSUtils/Utils/FunctionDeclarations.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public static function getName(File $phpcsFile, $stackPtr)
* @return array
*
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified position is not a T_FUNCTION
* or T_CLOSURE token nor an arrow function.
* or T_CLOSURE token, nor an arrow function.
*/
public static function getProperties(File $phpcsFile, $stackPtr)
{
Expand Down Expand Up @@ -604,7 +604,7 @@ public static function getParameters(File $phpcsFile, $stackPtr)
* T_STRING token as those are the only two
* tokens which can be the arrow function keyword.
*
* @return bool TRUE is the token is the "fn" keyword for an arrow function. FALSE when not or
* @return bool TRUE if the token is the "fn" keyword for an arrow function. FALSE when not or
* in case of live coding/parse error.
*/
public static function isArrowFunction(File $phpcsFile, $stackPtr)
Expand Down
3 changes: 1 addition & 2 deletions PHPCSUtils/Utils/Lists.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public static function getOpenClose(File $phpcsFile, $stackPtr, $isShortList = n
* // second item in `list($a, , $b)`.
* 'is_nested_list' => bool, // Whether this is a nested list.
* 'variable' => string|false, // The base variable being assigned to or
* // FALSE in case of a nested list or avariable variable.
* // FALSE in case of a nested list or a variable variable.
* // I.e. `$a` in `list($a['key'])`.
* 'assignment_token' => int|false, // The start pointer for the assignment.
* 'assignment_end_token' => int|false, // The end pointer for the assignment.
Expand All @@ -269,7 +269,6 @@ public static function getOpenClose(File $phpcsFile, $stackPtr, $isShortList = n
* // FALSE when not a reference assignment.
* </code>
*
*
* Assignments with keys will have the following additional array indexes set:
* <code>
* 'key' => string, // The content of the key, cleaned of comments.
Expand Down
4 changes: 2 additions & 2 deletions PHPCSUtils/Utils/Numbers.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class Numbers
`ixD';

/**
* Regex to determine is a T_STRING following a T_[DL]NUMBER is part of a numeric literal sequence.
* Regex to determine if a T_STRING following a T_[DL]NUMBER is part of a numeric literal sequence.
*
* PHP cross-version compat for PHP 7.4 numeric literals with underscore separators.
*
Expand Down Expand Up @@ -144,7 +144,7 @@ class Numbers
* Helper function to deal with numeric literals, potentially with underscore separators.
*
* PHP < 7.4 does not tokenize numeric literals containing underscores correctly.
* As of PHPCS 3.5.3, PHPCS contains a back-fill, but this backfill was buggy in the initial
* As of PHPCS 3.5.3, PHPCS contains a backfill, but this backfill was buggy in the initial
* implementation. A fix for this broken backfill is included in PHPCS 3.5.4.
*
* Either way, this function provides a backfill for all PHPCS/PHP combinations where
Expand Down
2 changes: 1 addition & 1 deletion PHPCSUtils/Utils/ObjectDeclarations.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public static function getClassProperties(File $phpcsFile, $stackPtr)
* Works for classes, anonymous classes and interfaces, though it is strongly recommended
* to use the {@see \PHPCSUtils\Utils\ObjectDeclarations::findExtendedInterfaceNames()}
* method to examine interfaces instead. Interfaces can extend multiple parent interfaces,
* and that use case is not handled by this method.
* and that use-case is not handled by this method.
*
* Main differences with the PHPCS version:
* - Bugs fixed:
Expand Down
2 changes: 1 addition & 1 deletion Tests/BackCompat/BCFile/FindEndOfStatementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* With documentation contributions from:
* @author Phil Davis <phil@jankaritech.com>
*
* @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
*/
Expand Down
2 changes: 1 addition & 1 deletion phpcsutils-autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class_alias('\PHP_CodeSniffer_Exception', '\PHP_CodeSniffer\Exceptions\Tokenizer
/*
* Alias the PHPUnit 4/5 TestCase class to its PHPUnit 6+ name.
*
* This allows the both the PHPCSUtils native unit tests as well as the
* This allows both the PHPCSUtils native unit tests as well as the
* `UtilityMethodTestCase` class to work cross-version with PHPUnit
* below 6.x and above.
*
Expand Down

0 comments on commit 675e399

Please sign in to comment.