Reactor rule php8 ReplaceNewDateTimeNull has wrong implementation
0m3r opened this issue · 1 comments
0m3r commented
Description
I have a couple of wrong passes of the rule
- $date = new \DateTime($date);
- $now = new \DateTime();
+ $date = new \DateTime('now');
+ $now = new \DateTime('now');
$now->setTime(0, 0, 0, 0);
$minDelay = $this->getMinDelayDays();
$interval = $now->diff($date);
----------- end diff -----------
Applied rules:
* ReplaceNewDateTimeNullpublic function __construct(
#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $datetime = 'now',
#[LanguageLevelTypeAware(['8.0' => 'DateTimeZone|null'], default: 'DateTimeZone')] $timezone = null
) {}default is 'now' and it's a string so that the first argument can be empty and it's also can be variable
but in rule it's always must by string
if ($node->args[0] !== String_::class) {Expected behavior
it looks like this rule should work only if the first argument is precisely null
m2-assistant commented
Hi @0m3r. Thank you for your report.
To speed up processing of this issue, make sure that you provided sufficient information.
Add a comment to assign the issue: @magento I am working on this
- Join Magento Community Engineering Slack and ask your questions in #github channel.