Inject Symfony translator contract, not Laravel's

The Laravel changes with v6, and our translator is primarily an
implementation of the Symfony contract.
This commit is contained in:
Franz Liedke 2020-07-24 17:31:46 +02:00
parent e4077ab4ad
commit 7fd23ff950
No known key found for this signature in database
GPG Key ID: 9A0231A879B055F4
4 changed files with 19 additions and 14 deletions

View File

@ -15,10 +15,10 @@ use Flarum\Frontend\Document;
use Flarum\Http\UrlGenerator;
use Flarum\Settings\SettingsRepositoryInterface;
use Flarum\User\User;
use Illuminate\Contracts\Translation\Translator;
use Illuminate\Contracts\View\Factory;
use Illuminate\Support\Arr;
use Psr\Http\Message\ServerRequestInterface as Request;
use Symfony\Component\Translation\TranslatorInterface;
class Index
{
@ -42,14 +42,19 @@ class Index
*/
protected $url;
/**
* @var TranslatorInterface
*/
protected $translator;
/**
* @param Client $api
* @param Factory $view
* @param SettingsRepositoryInterface $settings
* @param UrlGenerator $url
* @param Translator $translator
* @param TranslatorInterface $translator
*/
public function __construct(Client $api, Factory $view, SettingsRepositoryInterface $settings, UrlGenerator $url, Translator $translator)
public function __construct(Client $api, Factory $view, SettingsRepositoryInterface $settings, UrlGenerator $url, TranslatorInterface $translator)
{
$this->api = $api;
$this->view = $view;

View File

@ -14,7 +14,7 @@ use Flarum\Mail\Job\SendRawEmailJob;
use Flarum\Settings\SettingsRepositoryInterface;
use Flarum\User\Event\Registered;
use Illuminate\Contracts\Queue\Queue;
use Illuminate\Contracts\Translation\Translator;
use Symfony\Component\Translation\TranslatorInterface;
class AccountActivationMailer
{
@ -34,7 +34,7 @@ class AccountActivationMailer
protected $url;
/**
* @var Translator
* @var TranslatorInterface
*/
protected $translator;
@ -42,9 +42,9 @@ class AccountActivationMailer
* @param \Flarum\Settings\SettingsRepositoryInterface $settings
* @param Queue $queue
* @param UrlGenerator $url
* @param Translator $translator
* @param TranslatorInterface $translator
*/
public function __construct(SettingsRepositoryInterface $settings, Queue $queue, UrlGenerator $url, Translator $translator)
public function __construct(SettingsRepositoryInterface $settings, Queue $queue, UrlGenerator $url, TranslatorInterface $translator)
{
$this->settings = $settings;
$this->queue = $queue;

View File

@ -15,10 +15,10 @@ use Flarum\Settings\SettingsRepositoryInterface;
use Flarum\User\PasswordToken;
use Flarum\User\UserRepository;
use Illuminate\Contracts\Queue\Queue;
use Illuminate\Contracts\Translation\Translator;
use Illuminate\Contracts\Validation\Factory;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Validation\ValidationException;
use Symfony\Component\Translation\TranslatorInterface;
class RequestPasswordResetHandler
{
@ -43,7 +43,7 @@ class RequestPasswordResetHandler
protected $url;
/**
* @var Translator
* @var TranslatorInterface
*/
protected $translator;
@ -57,7 +57,7 @@ class RequestPasswordResetHandler
* @param SettingsRepositoryInterface $settings
* @param Queue $queue
* @param UrlGenerator $url
* @param Translator $translator
* @param TranslatorInterface $translator
* @param Factory $validatorFactory
*/
public function __construct(
@ -65,7 +65,7 @@ class RequestPasswordResetHandler
SettingsRepositoryInterface $settings,
Queue $queue,
UrlGenerator $url,
Translator $translator,
TranslatorInterface $translator,
Factory $validatorFactory
) {
$this->users = $users;

View File

@ -14,7 +14,7 @@ use Flarum\Mail\Job\SendRawEmailJob;
use Flarum\Settings\SettingsRepositoryInterface;
use Flarum\User\Event\EmailChangeRequested;
use Illuminate\Contracts\Queue\Queue;
use Illuminate\Contracts\Translation\Translator;
use Symfony\Component\Translation\TranslatorInterface;
class EmailConfirmationMailer
{
@ -34,11 +34,11 @@ class EmailConfirmationMailer
protected $url;
/**
* @var Translator
* @var TranslatorInterface
*/
protected $translator;
public function __construct(SettingsRepositoryInterface $settings, Queue $queue, UrlGenerator $url, Translator $translator)
public function __construct(SettingsRepositoryInterface $settings, Queue $queue, UrlGenerator $url, TranslatorInterface $translator)
{
$this->settings = $settings;
$this->queue = $queue;