Skip to content

Conversation

@tony-stark-eth
Copy link
Contributor

@tony-stark-eth tony-stark-eth commented Apr 2, 2025

Without this rector changes DateTimeInterface names.

> vendor/bin/rector '--dry-run' '--clear-cache'
 23/23 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
1 file with changes
===================

1) src/Entity/SomeEntity.php:19

    ---------- begin diff ----------
@@ @@
     private null|int $id = null;

     #[ORM\Column(type: Types::DATETIME_MUTABLE)]
-    private DateTimeInterface $someDateName;
+    private DateTimeInterface $dateTime;

@@ @@
         null|DateTimeInterface $someDateName = null
     ) {
-        $this->someDateName = $someDateName ?? \Carbon\CarbonImmutable::now();
+        $this->someDateName = $someDateName ?? \Carbon\CarbonImmutable::now();
     }

@TomasVotruba
Copy link
Member

Thanks for the fix. Could you add a test fixture as well? I recall we had this fixed before, so just to avoid any regressions in the future.

@tony-stark-eth
Copy link
Contributor Author

Thanks for the fix. Could you add a test fixture as well? I recall we had this fixed before, so just to avoid any regressions in the future.

Yeah there is a fixture in rules-tests/Naming/Rector/Class_/RenamePropertyToMatchTypeRector/Fixture/skip_date_time.php.inc but I couldn't figure out yet why it is not exposing the issue.

@samsonasik samsonasik merged commit 59d3529 into rectorphp:main Apr 3, 2025
45 checks passed
@samsonasik
Copy link
Member

Thank you @tony-stark-eth

@TomasVotruba
Copy link
Member

👍

@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2025

This pull request has been automatically locked because it has been closed for 150 days. Please open a new PR if you want to continue the work.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants