Bug Report
| Subject |
Details |
| Rector version |
v2.0.7 |
TimeFuncCallToCarbonRector refactors $time = time(); to Carbon::now()->timestamp.
This breaks for example Phpstan validation:
time() returns int
- Carbon's
timestamp property may return float, int or string (at least, per docblock)
Minimal PHP Code Causing Issue
See https://getrector.com/demo/26b5038a-7f90-46df-bbb7-3f6143e51621
Results in:
<?php
-time();
+\Carbon\Carbon::now()->timestamp;
Expected Behaviour
Rector might be better off using Carbon's getTimestamp() method, which does return int:
<?php
-time();
+\Carbon\Carbon::now()->getTimestamp();