Skip to content

Commit

Permalink
Fix mutable datatime rules
Browse files Browse the repository at this point in the history
  • Loading branch information
bastien-phi committed Jan 2, 2025
1 parent fab1144 commit 842d072
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Rules/NoMutableDateTimeStaticCallRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 [];
}
Expand Down
4 changes: 4 additions & 0 deletions src/Rules/NoMutableDateTimeUseRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 [];
}
Expand Down
4 changes: 4 additions & 0 deletions src/Rules/NoNewMutableDateTimeRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 [];
}
Expand Down

0 comments on commit 842d072

Please sign in to comment.