From 408797453c22e56a14bd5d1a8ded9da8454bdf33 Mon Sep 17 00:00:00 2001 From: David Spilka Date: Fri, 22 Apr 2022 09:23:56 +0200 Subject: [PATCH] Fix property ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - v releasu v7.0.19 slevomat/coding-standard došlo ke změně používání property ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach, která nyní musí být boolean (viz: https://github.com/slevomat/coding-standard/commit/78d5c137dcf378e178b739462313b88f4f054a7d#diff-cab409323a53ecb0e91f7121aed69b589d5a85274a4a7541033cc235db9ca2c2) - před touto úpravou se vyhazovala chyba "Fatal error: Uncaught TypeError: SlevomatCodingStandard\Sniffs\Variables\UnusedVariableSniff::isValueInForeachAndErrorIsIgnored(): Return value must be of type bool, string returned in .../vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Variables/UnusedVariableSniff.php:528" --- src/PeckaCodingStandard/ruleset.xml | 2 +- tests/Success/Variables/UnusedVariable.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PeckaCodingStandard/ruleset.xml b/src/PeckaCodingStandard/ruleset.xml index 52ee8bf..0eac47e 100644 --- a/src/PeckaCodingStandard/ruleset.xml +++ b/src/PeckaCodingStandard/ruleset.xml @@ -87,7 +87,7 @@ - + diff --git a/tests/Success/Variables/UnusedVariable.php b/tests/Success/Variables/UnusedVariable.php index 958b7db..dc539e0 100644 --- a/tests/Success/Variables/UnusedVariable.php +++ b/tests/Success/Variables/UnusedVariable.php @@ -5,5 +5,5 @@ echo $hello; foreach ([] as $k => $v) { - echo $v; + echo $k; }