diff --git a/rules/DeadCode/SideEffect/SideEffectNodeDetector.php b/rules/DeadCode/SideEffect/SideEffectNodeDetector.php index f4033c9b271..9d92202e7ac 100644 --- a/rules/DeadCode/SideEffect/SideEffectNodeDetector.php +++ b/rules/DeadCode/SideEffect/SideEffectNodeDetector.php @@ -53,17 +53,17 @@ public function detect(Expr $expr): bool return true; } - $exprStaticType = $this->nodeTypeResolver->getType($expr); - if ($exprStaticType instanceof ConstantType) { - return false; - } - foreach (self::SIDE_EFFECT_NODE_TYPES as $sideEffectNodeType) { if ($expr instanceof $sideEffectNodeType) { return false; } } + $exprStaticType = $this->nodeTypeResolver->getType($expr); + if ($exprStaticType instanceof ConstantType) { + return false; + } + if ($expr instanceof FuncCall) { return ! $this->pureFunctionDetector->detect($expr); }