From d034b8acab5914fa0ba97fd5d3de3a75616f6757 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Tue, 10 Feb 2026 07:07:16 +0700 Subject: [PATCH 1/2] [CodeQuality] Skip DateTime on ControllerMethodInjectionToConstructorRector --- .../Fixture/skip_date_time.php.inc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 rules-tests/CodeQuality/Rector/Class_/ControllerMethodInjectionToConstructorRector/Fixture/skip_date_time.php.inc 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 From c29245700086dbdfc108aa97596a8e8420b482f1 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Tue, 10 Feb 2026 07:07:44 +0700 Subject: [PATCH 2/2] Fix --- .../Class_/ControllerMethodInjectionToConstructorRector.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; }