Skip to content

Commit

Permalink
Merge pull request #324 from PHPCSStandards/feature/various-minor-fixes
Browse files Browse the repository at this point in the history
Various minor doc fixes
  • Loading branch information
jrfnl authored Nov 9, 2024
2 parents c938bd8 + 9455319 commit 4257e46
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 11 deletions.
3 changes: 0 additions & 3 deletions Universal/Sniffs/Arrays/DuplicateArrayKeySniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ final class DuplicateArrayKeySniff extends AbstractArrayDeclarationSniff
/**
* Process every part of the array declaration.
*
* This contains the default logic for the sniff, but can be overloaded in a concrete child class
* if needed.
*
* @since 1.0.0
*
* @param \PHP_CodeSniffer\Files\File $phpcsFile The PHP_CodeSniffer file where the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public function process(File $phpcsFile, $stackPtr)
$current = $tokens[$stackPtr]['scope_opener'];
$end = $tokens[$stackPtr]['scope_closer'];

// Not searching for arrow functions as those have an implicit return, so no
// Not searching for arrow functions as those have an implicit return, so won't use the `return` keyword.
$search = Collections::functionDeclarationTokens();
$search[\T_RETURN] = \T_RETURN;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function process(File $phpcsFile, $stackPtr)
if ($tokens[$nextAfter]['code'] === \T_SEMICOLON) {
$innerScopeCloser = $nextAfter;
} else {
// Missing semi-colon. Report, but don't auto-fix.
// Missing semicolon. Report, but don't auto-fix.
$autoFixable = false;
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion Universal/Sniffs/PHP/OneStatementInShortEchoTagSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function process(File $phpcsFile, $stackPtr)
return;
}

// Semi-colon, so check for any code between it and the close tag.
// Semicolon, so check for any code between it and the close tag.
$nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($endOfStatement + 1), null, true);
if ($nextNonEmpty === false
|| $tokens[$nextNonEmpty]['code'] === \T_CLOSE_TAG
Expand Down
2 changes: 0 additions & 2 deletions Universal/Tests/UseStatements/KeywordSpacingUnitTest.2.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@
* For PHP < 8.0, it will correctly flag this as "no space" after the `use` keyword.
* For PHP 8.0+, this will no longer be flagged as keywords are allowed in namespaced names,
* so the `use` is tokenized as `T_STRING` instead of `T_USE` and won't be flagged.
*
* For this reason, there is no "fixed" file included as the test would not be able to pass on PHP 8.0+.
*/
use\Util\MyOtherClass;
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@
* For PHP < 8.0, it will correctly flag this as "no space" after the `use` keyword.
* For PHP 8.0+, this will no longer be flagged as keywords are allowed in namespaced names,
* so the `use` is tokenized as `T_STRING` instead of `T_USE` and won't be flagged.
*
* For this reason, there is no "fixed" file included as the test would not be able to pass on PHP 8.0+.
*/
use \Util\MyOtherClass;
2 changes: 1 addition & 1 deletion Universal/Tests/UseStatements/KeywordSpacingUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function getErrorList($testFile = '')

case 'KeywordSpacingUnitTest.2.inc':
return [
11 => 1,
9 => 1,
];

default:
Expand Down

0 comments on commit 4257e46

Please sign in to comment.