diff --git a/rules-tests/CodeQuality/Rector/Class_/ControllerMethodInjectionToConstructorRector/Fixture/skip_date_time.php.inc b/rules-tests/CodeQuality/Rector/Class_/ControllerMethodInjectionToConstructorRector/Fixture/skip_date_time.php.inc new file mode 100644 index 000000000..1c62e6d1b --- /dev/null +++ b/rules-tests/CodeQuality/Rector/Class_/ControllerMethodInjectionToConstructorRector/Fixture/skip_date_time.php.inc @@ -0,0 +1,19 @@ + \ No newline at end of file diff --git a/rules/CodeQuality/Rector/Class_/ControllerMethodInjectionToConstructorRector.php b/rules/CodeQuality/Rector/Class_/ControllerMethodInjectionToConstructorRector.php index baf9d2a71..15686c4ce 100644 --- a/rules/CodeQuality/Rector/Class_/ControllerMethodInjectionToConstructorRector.php +++ b/rules/CodeQuality/Rector/Class_/ControllerMethodInjectionToConstructorRector.php @@ -164,7 +164,10 @@ public function refactor(Node $node): ?Node continue; } - if ($this->isObjectType($param->type, new ObjectType(SymfonyClass::USER_INTERFACE))) { + if ($this->nodeTypeResolver->isObjectTypes( + $param->type, + [new ObjectType(SymfonyClass::USER_INTERFACE), new ObjectType('DateTimeInterface')] + )) { continue; }