ECS = symplify/easy-coding-standard
I am getting an message when running ECS:
Unused variable $validator.
(SlevomatCodingStandard\Sniffs\Variables\UnusedVariableSniff.UnusedVariable)
For this code:
// phpcs:ignore
// @codingStandardsIgnoreLine
foreach ($this->rules as $attribute => $validator) {
I did try using the suppress comments in different setup:
Does any one know if ECS supports inline suppress comments?
In the ECS documentation I see it's only possible to suppress whole file.
PS. I know I can use array_keys(), but the goal in this case is to suppress the warnings, as in the future it can be a different one.
Or... as variant add rule to config file easy-coding-standard.yaml
services:
SlevomatCodingStandard\Sniffs\Variables\UnusedVariableSniff:
ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach: true