From 9a3dd1ae1b3c25a75672c12ca81b23e0d1c84313 Mon Sep 17 00:00:00 2001 From: Mikko Pesari Date: Fri, 10 Oct 2025 13:33:21 +0300 Subject: [PATCH] Test RemoveNonExistingVarAnnotationRector with static variable in method --- .../skip_static_variable_in_method.php.inc | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 rules-tests/DeadCode/Rector/Node/RemoveNonExistingVarAnnotationRector/Fixture/skip_static_variable_in_method.php.inc diff --git a/rules-tests/DeadCode/Rector/Node/RemoveNonExistingVarAnnotationRector/Fixture/skip_static_variable_in_method.php.inc b/rules-tests/DeadCode/Rector/Node/RemoveNonExistingVarAnnotationRector/Fixture/skip_static_variable_in_method.php.inc new file mode 100644 index 00000000000..fb79cadee07 --- /dev/null +++ b/rules-tests/DeadCode/Rector/Node/RemoveNonExistingVarAnnotationRector/Fixture/skip_static_variable_in_method.php.inc @@ -0,0 +1,22 @@ + + */ + static $cached_result = []; + + if (!isset($cached_result[$param])) { + $cached_result[$param] = doExpensiveCalculation($param); + } + + return $cached_result[$param]; + } +}