Laravel 5.3迁移
我只是升级到Laravel到5.x和使用"jenssegers/Date": "^3.0"
。Laravel 5.3迁移
所以在迁移时,似乎是一个错误:
[ErrorException] Declaration of Jenssegers\Date\Date::diffForHumans(Carbon\Carbon $since = NULL, $absolute = false) should be compatible with Carbon\Carbon::diffForHumans(Carbon\Carbon $other = NULL, $absolute = false, $short = false)
请建议可以做些什么来解决这个问题。
如果你比较current Carbon source code:
public function diffForHumans(Carbon $other = null, $absolute = false, $short = false)
与current jenssegers/Date source code:
public function diffForHumans(Carbon $since = null, $absolute = false, $short = false)
你看到的不应该有任何问题。看起来你使用的是比Jenssegers/Date更新的Carbon,并且版本不兼容。你需要更新你的jenssegers/Date。
3.2.8 seems to be the latest release,我会去那里测试。 3.2.3 seems to be the first version including the third parameter,与this commit:
Carbon\Carbon::diffForHumans(Carbon\Carbon $other = NULL, $absolute = false, $short = false) has a new third argument and lack of it in Jenssegers\Date\Date::diffForHumans is not playing nicely.
所以您的版本必须至少这一点。
其实你的问题是这个包jenssegers/date。正如你所看到Jenssegers\Date
延伸碳和线104
public function diffForHumans(Carbon $since = null, $absolute = false, $short = false)
有不同的实现比碳
public function diffForHumans(Carbon $other = null, $absolute = false)
克服这个是重新定义方法上要么类,它不建议,因为他们的方式都在供应商文件夹内。所以我想你的选择是打开一个jassegers/date的问题,或者尝试不使用那个包(如果你不使用它那么写你自己的替换)。
如果您的项目Composer.json中没有此软件包,但您使用的某个其他软件包有jassegers/date
作为依赖项,则问题可能会更加严重。您可以在每个项目依赖关系的Composer.json中的供应商处进行检查。在这种情况下,您可能会考虑使用与使用jassegers/date
作为依赖关系的包不同的包,至少在更新之前。
也许有人有更好的建议,这只是我的头顶..
附:只记得..如果你直接在你的Composer.json中使用它,你也可以分叉jassegers/date
,然后改变你自己的方法实现并使用分支版本,直到真正的版本被修复。如果您间接使用它(某些您使用的其他软件包将其作为依赖项),则会稍微复杂一点,这意味着您必须一直分叉软件包,直到达到jassegers/date
。这将是非常繁琐的工作,但应该暂时解决问题。