Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ErrorException in Date.php line 6: Declaration of Jenssegers\Date\Date::setTranslator() should be compatible with Carbon\Carbon::setTranslator #112

Closed
cschalenborgh opened this issue Mar 26, 2015 · 11 comments

Comments

@cschalenborgh
Copy link

Hi Jens,

I got this error on my Laravel 5 install after updating your library through composer. Any ideas?

ErrorException in Date.php line 6: Declaration of Jenssegers\Date\Date::setTranslator() should be compatible with Carbon\Carbon::setTranslator(Symfony\Component\Translation\TranslatorInterface $translator)
@jenssegers
Copy link
Owner

Duplicate of #108, it should already be fixed on master.

@bobbybouwmann
Copy link

It's still not working on my end! Tried dev-master as well, but that didn't do anything as well!

My laravel 5 installation pulls in Carbon 1.18.0

The error message:

Declaration of Jenssegers\Date\Date::setTranslator() should be compatible with Carbon\Carbon::setTranslator(Symfony\Component\Translation\TranslatorInterface $translator)

@jenssegers
Copy link
Owner

@bobbybouwmann
Copy link

So I opened that class on my installation and I get this

/**
 * Set the Translator implementation
 *
 * @param Translator  $translator
 */
public static function setTranslator($translator)
{
    static::$translator = $translator;
}

Edit: Oke it's working now! I guess it was cached for some reason ;) Thank you for the quick update

@jenssegers
Copy link
Owner

I created a 2.0 branch and tagged version 2.0.21 that locks down the Carbon version to <1.18. This should fix it until v3 is released.

@bobbybouwmann
Copy link

Thanks you :D

@LoveAndHappiness
Copy link

So what exactly is the fix for this now?

Edit: Just "composer update" seemed to have fixed it.

@Piusyo
Copy link

Piusyo commented Mar 1, 2018

The issue is still there, why is it closed?

@danhunsaker
Copy link

Because the current issue is a different one that only looks similar.

@Piusyo
Copy link

Piusyo commented Mar 1, 2018

Declaration of Jenssegers\Date\Date::diffForHumans() should be compatible with Carbon\Carbon::diffForHumans(Carbon
Carbon $other = NULL, $absolute = false, $short = false, $parts = 1)

@danhunsaker
Copy link

Yes. Look at #280 for the current issue. This one was about a completely different method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants