replaced the Symfony\Component\Translation\TranslationInterface with the Illuminate\Contracts\Translation\Translator, deprecating the Symfony version

This commit is contained in:
Daniel Klabbers 2017-11-27 10:42:16 +01:00
parent 7b2663e0bc
commit 642332ffe2
8 changed files with 25 additions and 27 deletions

View File

@ -20,7 +20,7 @@ use Flarum\User\Exception\PermissionDeniedException;
use Illuminate\Contracts\Mail\Mailer;
use Illuminate\Mail\Message;
use Psr\Http\Message\ServerRequestInterface;
use Symfony\Component\Translation\TranslatorInterface;
use Illuminate\Contracts\Translation\Translator;
use Zend\Diactoros\Response\EmptyResponse;
class SendConfirmationEmailController implements ControllerInterface
@ -43,7 +43,7 @@ class SendConfirmationEmailController implements ControllerInterface
protected $url;
/**
* @var TranslatorInterface
* @var Translator
*/
protected $translator;
@ -51,9 +51,9 @@ class SendConfirmationEmailController implements ControllerInterface
* @param \Flarum\Settings\SettingsRepositoryInterface $settings
* @param Mailer $mailer
* @param UrlGenerator $url
* @param TranslatorInterface $translator
* @param Translator $translator
*/
public function __construct(SettingsRepositoryInterface $settings, Mailer $mailer, UrlGenerator $url, TranslatorInterface $translator)
public function __construct(SettingsRepositoryInterface $settings, Mailer $mailer, UrlGenerator $url, Translator $translator)
{
$this->settings = $settings;
$this->mailer = $mailer;

View File

@ -13,7 +13,7 @@ namespace Flarum\Api\Serializer;
use Flarum\Group\Group;
use InvalidArgumentException;
use Symfony\Component\Translation\TranslatorInterface;
use Illuminate\Contracts\Translation\Translator;
class GroupSerializer extends AbstractSerializer
{
@ -23,14 +23,14 @@ class GroupSerializer extends AbstractSerializer
protected $type = 'groups';
/**
* @var TranslatorInterface
* @var Translator
*/
private $translator;
/**
* @param TranslatorInterface $translator
* @param Translator $translator
*/
public function __construct(TranslatorInterface $translator)
public function __construct(Translator $translator)
{
$this->translator = $translator;
}

View File

@ -17,7 +17,7 @@ use Flarum\User\Exception\InvalidConfirmationTokenException;
use Flarum\User\PasswordToken;
use Illuminate\Contracts\View\Factory;
use Psr\Http\Message\ServerRequestInterface as Request;
use Symfony\Component\Translation\TranslatorInterface;
use Illuminate\Contracts\Translation\Translator;
class ResetPasswordController extends AbstractHtmlController
{
@ -27,14 +27,14 @@ class ResetPasswordController extends AbstractHtmlController
protected $view;
/**
* @var TranslatorInterface
* @var Translator
*/
protected $translator;
/**
* @param Factory $view
*/
public function __construct(Factory $view, TranslatorInterface $translator)
public function __construct(Factory $view, Translator $translator)
{
$this->view = $view;
$this->translator = $translator;

View File

@ -15,7 +15,7 @@ use Flarum\Foundation\Event\Validating;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Contracts\Validation\ValidationException;
use Illuminate\Validation\Factory;
use Symfony\Component\Translation\TranslatorInterface;
use Illuminate\Contracts\Translation\Translator;
abstract class AbstractValidator
{
@ -35,16 +35,16 @@ abstract class AbstractValidator
protected $events;
/**
* @var TranslatorInterface
* @var Translator
*/
protected $translator;
/**
* @param Factory $validator
* @param Dispatcher $events
* @param TranslatorInterface $translator
* @param Translator $translator
*/
public function __construct(Factory $validator, Dispatcher $events, TranslatorInterface $translator)
public function __construct(Factory $validator, Dispatcher $events, Translator $translator)
{
$this->validator = $validator;
$this->events = $events;

View File

@ -36,7 +36,7 @@ use Illuminate\Filesystem\Filesystem;
use Illuminate\Validation\Factory;
use PDO;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Translation\TranslatorInterface;
use Illuminate\Contracts\Translation\Translator;
class InstallCommand extends AbstractCommand
{
@ -409,7 +409,7 @@ class InstallCommand extends AbstractCommand
*/
protected function getValidator()
{
return new Factory($this->application->make(TranslatorInterface::class));
return new Factory($this->application->make(Translator::class));
}
protected function showErrors($errors)

View File

@ -16,7 +16,6 @@ use Flarum\Foundation\AbstractServiceProvider;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Contracts\Translation\Translator as TranslatorContract;
use Symfony\Component\Translation\MessageSelector;
use Symfony\Component\Translation\TranslatorInterface;
class LocaleServiceProvider extends AbstractServiceProvider
{
@ -48,7 +47,6 @@ class LocaleServiceProvider extends AbstractServiceProvider
return $translator;
});
$this->app->alias('translator', Translator::class);
$this->app->alias('translator', TranslatorInterface::class);
$this->app->alias('translator', TranslatorContract::class);
}

View File

@ -20,7 +20,7 @@ use Illuminate\Contracts\Validation\Factory;
use Illuminate\Contracts\Validation\ValidationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Mail\Message;
use Symfony\Component\Translation\TranslatorInterface;
use Illuminate\Contracts\Translation\Translator;
class RequestPasswordResetHandler
{
@ -45,7 +45,7 @@ class RequestPasswordResetHandler
protected $url;
/**
* @var TranslatorInterface
* @var Translator
*/
protected $translator;
@ -59,7 +59,7 @@ class RequestPasswordResetHandler
* @param SettingsRepositoryInterface $settings
* @param Mailer $mailer
* @param UrlGenerator $url
* @param TranslatorInterface $translator
* @param Translator $translator
* @param Factory $validatorFactory
*/
public function __construct(
@ -67,7 +67,7 @@ class RequestPasswordResetHandler
SettingsRepositoryInterface $settings,
Mailer $mailer,
UrlGenerator $url,
TranslatorInterface $translator,
Translator $translator,
Factory $validatorFactory
) {
$this->users = $users;

View File

@ -18,7 +18,7 @@ use Flarum\User\Event\Registered;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Contracts\Mail\Mailer;
use Illuminate\Mail\Message;
use Symfony\Component\Translation\TranslatorInterface;
use Illuminate\Contracts\Translation\Translator;
class EmailConfirmationMailer
{
@ -38,7 +38,7 @@ class EmailConfirmationMailer
protected $url;
/**
* @var TranslatorInterface
* @var Translator
*/
protected $translator;
@ -46,9 +46,9 @@ class EmailConfirmationMailer
* @param \Flarum\Settings\SettingsRepositoryInterface $settings
* @param Mailer $mailer
* @param UrlGenerator $url
* @param TranslatorInterface $translator
* @param Translator $translator
*/
public function __construct(SettingsRepositoryInterface $settings, Mailer $mailer, UrlGenerator $url, TranslatorInterface $translator)
public function __construct(SettingsRepositoryInterface $settings, Mailer $mailer, UrlGenerator $url, Translator $translator)
{
$this->settings = $settings;
$this->mailer = $mailer;