Skip to content

Commit

Permalink
Merge pull request #264 from PHPCSStandards/feature/various-sniffs-se…
Browse files Browse the repository at this point in the history
…t-redundant-defaults

Various sniffs: set redundant default values
  • Loading branch information
jrfnl committed Aug 26, 2023
2 parents dbf3d28 + 780c759 commit 8ffd4d8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
9 changes: 8 additions & 1 deletion Modernize/Sniffs/FunctionCalls/DirnameSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ public function process(File $phpcsFile, $stackPtr)
* PHP 5.3+: Detect use of dirname(__FILE__).
*/
if (\strtoupper($pathParam['clean']) === '__FILE__') {
$levelsValue = false;

// Determine if the issue is auto-fixable.
$hasComment = $phpcsFile->findNext(Tokens::$commentTokens, ($opener + 1), $closer);
$fixable = ($hasComment === false);
Expand Down Expand Up @@ -248,7 +250,12 @@ public function process(File $phpcsFile, $stackPtr)
*/

// Step 1: Are there comments ? If so, not auto-fixable as we don't want to remove comments.
$fixable = true;
$fixable = true;
$outerLevelsValue = false;
$innerParameters = [];
$innerLevelsParam = false;
$innerLevelsValue = false;

for ($i = ($opener + 1); $i < $closer; $i++) {
if (isset(Tokens::$commentTokens[$tokens[$i]['code']])) {
$fixable = false;
Expand Down
1 change: 1 addition & 0 deletions Universal/Sniffs/WhiteSpace/DisallowInlineTabsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public function process(File $phpcsFile, $stackPtr)
* so from here on out, we **know** there will be tabs in the content.
*/
$origContent = $token['orig_content'];
$commentOnly = '';

$multiLineComment = false;
if (($tokens[$i]['code'] === \T_COMMENT
Expand Down
6 changes: 5 additions & 1 deletion Universal/Sniffs/WhiteSpace/PrecisionAlignmentSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,11 @@ public function process(File $phpcsFile, $stackPtr)
$origContent = $tokens[$i]['orig_content'];
}

$spaces = 0;
$spaces = 0;
$length = 0;
$content = '';
$closer = '';

switch ($tokens[$i]['code']) {
case \T_WHITESPACE:
if ($this->ignoreBlankLines === true
Expand Down

0 comments on commit 8ffd4d8

Please sign in to comment.