Skip to content

Commit

Permalink
Enable the ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach option of…
Browse files Browse the repository at this point in the history
… the unused variable sniff
  • Loading branch information
leofeyer committed Oct 9, 2024
1 parent e428cfc commit 8f5cae0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config/contao.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@
TernaryToNullCoalescingFixer::class,
TypeHintOrderFixer::class,
UnusedInheritedVariablePassedToClosureSniff::class,
UnusedVariableSniff::class,
UseArrowFunctionsFixer::class,
UselessAliasSniff::class,
UselessConstantTypeHintSniff::class,
Expand Down Expand Up @@ -191,4 +190,5 @@
->withConfiguredRule(StringImplicitBackslashesFixer::class, ['single_quoted' => 'ignore', 'double_quoted' => 'escape', 'heredoc' => 'escape'])
->withConfiguredRule(TrailingCommaInMultilineFixer::class, ['elements' => ['arrays', 'arguments', 'match', 'parameters'], 'after_heredoc' => true])
->withConfiguredRule(UnusedUsesSniff::class, ['searchAnnotations' => true])
->withConfiguredRule(UnusedVariableSniff::class, ['ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach' => true])
;
2 changes: 1 addition & 1 deletion src/Sniffs/ContaoFrameworkClassAliasSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function process(File $phpcsFile, $stackPtr): void
return;
}

$phpcsFile->addError(sprintf('Using the aliased class "%1$s" is deprecated. Use the original class "Contao\%1$s" instead.', $tokens[$stackPtr]['content']), $stackPtr, self::class);
$phpcsFile->addError(\sprintf('Using the aliased class "%1$s" is deprecated. Use the original class "Contao\%1$s" instead.', $tokens[$stackPtr]['content']), $stackPtr, self::class);
}

private function isContaoClass(array $tokens, int $index): bool
Expand Down

0 comments on commit 8f5cae0

Please sign in to comment.