| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
https://carbon.nesbot.com/docs/#api-carbon-3 v3.2 版本时,进行挨个比对 |
Sorry, something went wrong.
There was a problem hiding this comment.
Before:
$res = $now->clone()->addSeconds(30)->diffInRealSeconds();
$this->assertSame(30, $res);After:
$res = $now->clone()->addSeconds(30)->floatDiffInRealSeconds();
$this->assertEquals(30, abs(round($res)));Some issues with the change:
Suggested change:
$this->assertSame(30, (int) $now->diffInSeconds($now->clone()->addSeconds(30), false));or
$this->assertEqualsWithDelta(30, $now->diffInSeconds($now->clone()->addSeconds(30), false), 0.001);
Sorry, something went wrong.
|
+1 we need this fix for Laravel-Hyperf
Suggested AdditionsCan you please also update this for hyperf/validation
And should probably do the same update for the rest of the codebase?
|
Sorry, something went wrong.
|
@kingIZZZY There are a lot of break changes between Carbon 2.0 and 3.0, and Hyperf will incorporate this PR in the next major release. |
Sorry, something went wrong.
|
Is it not good enough to implement @deminy 's suggested fixes above? Or are there definitely other tests which would fail with carbon 3? So far I just forked my own hyperf/validation & hyperf/crontab & hyperf/database to use carbon 3 in Laravel-Hyperf and it seems to be working so far, but maybe I haven't encountered all code paths using carbon yet.. |
Sorry, something went wrong.
This reverts commit 523cb18.
| Back | FazBrowse Home | New Git URL |
briannesbitt/Carbon#2948
fix #7457