From d4a432e7e490695a11daa32bce6bf20ab0d075f6 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Wed, 12 Jul 2023 09:58:44 +0200 Subject: [PATCH] Fix StrictArrayParamDimFetchRector on `is_*` calls (#4486) * StrictArrayParamDimFetchRector failing test * Rename string_array_union.php.inc to skip_string_array_union.php.inc * more failling tests * fix * fix * Update StrictArrayParamDimFetchRector.php --- .../Fixture/skip_is_bool.php.inc | 20 +++++++++++++++++++ .../Fixture/skip_is_float.php.inc | 20 +++++++++++++++++++ .../Fixture/skip_is_int.php.inc | 20 +++++++++++++++++++ .../Fixture/skip_is_string.php.inc | 20 +++++++++++++++++++ .../StrictArrayParamDimFetchRector.php | 2 +- 5 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/StrictArrayParamDimFetchRector/Fixture/skip_is_bool.php.inc create mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/StrictArrayParamDimFetchRector/Fixture/skip_is_float.php.inc create mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/StrictArrayParamDimFetchRector/Fixture/skip_is_int.php.inc create mode 100644 rules-tests/TypeDeclaration/Rector/ClassMethod/StrictArrayParamDimFetchRector/Fixture/skip_is_string.php.inc diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/StrictArrayParamDimFetchRector/Fixture/skip_is_bool.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/StrictArrayParamDimFetchRector/Fixture/skip_is_bool.php.inc new file mode 100644 index 00000000000..aed2e1e3b06 --- /dev/null +++ b/rules-tests/TypeDeclaration/Rector/ClassMethod/StrictArrayParamDimFetchRector/Fixture/skip_is_bool.php.inc @@ -0,0 +1,20 @@ +isName($node, 'is_array')) { + if ($node instanceof FuncCall && $this->isNames($node, ['is_array', 'is_string', 'is_int', 'is_bool', 'is_float'])) { $firstArg = $node->getArgs()[0]; if ($this->isName($firstArg->value, $paramName)) { return NodeTraverser::STOP_TRAVERSAL;