diff --git a/src/Rules/NoMutableDateTimeStaticCallRule.php b/src/Rules/NoMutableDateTimeStaticCallRule.php index c489841..b4840b9 100644 --- a/src/Rules/NoMutableDateTimeStaticCallRule.php +++ b/src/Rules/NoMutableDateTimeStaticCallRule.php @@ -38,6 +38,10 @@ public function processNode(Node $node, Scope $scope): array $class = $node->class->toString(); + if (!$this->reflectionProvider->hasClass($class)) { + return []; + } + if ($this->isAllowed($class)) { return []; } diff --git a/src/Rules/NoMutableDateTimeUseRule.php b/src/Rules/NoMutableDateTimeUseRule.php index 5777766..22905c3 100644 --- a/src/Rules/NoMutableDateTimeUseRule.php +++ b/src/Rules/NoMutableDateTimeUseRule.php @@ -34,6 +34,10 @@ public function processNode(Node $node, Scope $scope): array { $class = $node->name->toString(); + if (!$this->reflectionProvider->hasClass($class)) { + return []; + } + if ($this->isAllowed($class)) { return []; } diff --git a/src/Rules/NoNewMutableDateTimeRule.php b/src/Rules/NoNewMutableDateTimeRule.php index f7ceff0..ee533fd 100644 --- a/src/Rules/NoNewMutableDateTimeRule.php +++ b/src/Rules/NoNewMutableDateTimeRule.php @@ -38,6 +38,10 @@ public function processNode(Node $node, Scope $scope): array $class = $node->class->toString(); + if (!$this->reflectionProvider->hasClass($class)) { + return []; + } + if ($this->isAllowed($class)) { return []; }