Find the best Rector rule to solve your problem. Searching through 788 rules.
Found 4 rules:
Convert new DateTime() with a method call to Carbon::*()
class SomeClass
{
public function run()
{
- $date = (new \DateTime('today +20 day'))->format('Y-m-d');
+ $date = \Carbon\Carbon::today()->addDays(20)->format('Y-m-d')
}
}
Convert date() function call to Carbon::now()->format(*)
class SomeClass
{
public function run()
{
- $date = date('Y-m-d');
+ $date = \Carbon\Carbon::now()->format('Y-m-d');
}
}
Convert time() function call to Carbon::now()->getTimestamp()
class SomeClass
{
public function run()
{
- $time = time();
+ $time = \Carbon\Carbon::now()->getTimestamp();
}
}
Convert new DateTime() to Carbon::*()
-$date = new \DateTime('today');
+$date = \Carbon\Carbon::today();