Commit 7fde4cf6 authored by alexpott's avatar alexpott

Issue #2212427 by Mixologic, YesCT, Sutharsan, mgriego, icseh., visabhishek,...

Issue #2212427 by Mixologic, YesCT, Sutharsan, mgriego, icseh., visabhishek, znerol: Use interface instead of class name for language manager where appropriate.
parent cd65494f
......@@ -57,7 +57,7 @@ abstract class ControllerBase implements ContainerInjectionInterface {
/**
* The language manager.
*
* @var \Drupal\Core\Language\LanguageManager
* @var \Drupal\Core\Language\LanguageManagerInterface
*/
protected $languageManager;
......@@ -246,7 +246,7 @@ protected function currentUser() {
/**
* Returns the language manager service.
*
* @return \Drupal\Core\Language\LanguageManager
* @return \Drupal\Core\Language\LanguageManagerInterface
* The language manager.
*/
protected function languageManager() {
......
......@@ -272,7 +272,7 @@ public function getExtraFields($entity_type_id, $bundle);
* @return \Drupal\Core\Entity\EntityInterface
* An entity object for the translated data.
*
* @see \Drupal\Core\Language\LanguageManager::getFallbackCandidates()
* @see \Drupal\Core\Language\LanguageManagerInterface::getFallbackCandidates()
*/
public function getTranslationFromContext(EntityInterface $entity, $langcode = NULL, $context = array());
......
......@@ -10,7 +10,7 @@
use Drupal\Component\Datetime\DateTimePlus;
use Drupal\Core\Config\Config;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Language\LanguageManager;
use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\Site\Settings;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\Request;
......@@ -27,9 +27,9 @@
class FinishResponseSubscriber implements EventSubscriberInterface {
/**
* The LanguageManager object for retrieving the correct language code.
* The language manager object for retrieving the correct language code.
*
* @var LanguageManager
* @var \Drupal\Core\Language\LanguageManagerInterface
*/
protected $languageManager;
......@@ -43,12 +43,12 @@ class FinishResponseSubscriber implements EventSubscriberInterface {
/**
* Constructs a FinishResponseSubscriber object.
*
* @param LanguageManager $language_manager
* The LanguageManager object for retrieving the correct language code.
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager object for retrieving the correct language code.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* A config factory for retrieving required config objects.
*/
public function __construct(LanguageManager $language_manager, ConfigFactoryInterface $config_factory) {
public function __construct(LanguageManagerInterface $language_manager, ConfigFactoryInterface $config_factory) {
$this->languageManager = $language_manager;
$this->config = $config_factory->get('system.performance');
}
......
......@@ -12,7 +12,7 @@
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Controller\ControllerResolverInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Language\LanguageManager;
use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\Plugin\DefaultPluginManager;
use Drupal\Core\Plugin\Discovery\ContainerDerivativeDiscoveryDecorator;
use Drupal\Core\Plugin\Discovery\YamlDiscovery;
......@@ -93,7 +93,7 @@ class ContextualLinkManager extends DefaultPluginManager implements ContextualLi
* The module handler.
* @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
* The cache backend.
* @param \Drupal\Core\Language\LanguageManager $language_manager
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager.
* @param \Drupal\Core\Access\AccessManagerInterface $access_manager
* The access manager.
......@@ -102,7 +102,7 @@ class ContextualLinkManager extends DefaultPluginManager implements ContextualLi
* @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
* The request stack.
*/
public function __construct(ControllerResolverInterface $controller_resolver, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache_backend, LanguageManager $language_manager, AccessManagerInterface $access_manager, AccountInterface $account, RequestStack $request_stack) {
public function __construct(ControllerResolverInterface $controller_resolver, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache_backend, LanguageManagerInterface $language_manager, AccessManagerInterface $access_manager, AccountInterface $account, RequestStack $request_stack) {
$this->discovery = new YamlDiscovery('links.contextual', $module_handler->getModuleDirectories());
$this->discovery = new ContainerDerivativeDiscoveryDecorator($this->discovery);
$this->factory = new ContainerFactory($this);
......
......@@ -13,7 +13,7 @@
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Controller\ControllerResolverInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Language\LanguageManager;
use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\Plugin\DefaultPluginManager;
use Drupal\Core\Plugin\Discovery\ContainerDerivativeDiscoveryDecorator;
use Drupal\Core\Plugin\Discovery\YamlDiscovery;
......@@ -120,14 +120,14 @@ class LocalTaskManager extends DefaultPluginManager {
* The module handler.
* @param \Drupal\Core\Cache\CacheBackendInterface $cache
* The cache backend.
* @param \Drupal\Core\Language\LanguageManager $language_manager
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager.
* @param \Drupal\Core\Access\AccessManagerInterface $access_manager
* The access manager.
* @param \Drupal\Core\Session\AccountInterface $account
* The current user.
*/
public function __construct(ControllerResolverInterface $controller_resolver, RequestStack $request_stack, RouteProviderInterface $route_provider, RouteBuilderInterface $route_builder, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache, LanguageManager $language_manager, AccessManagerInterface $access_manager, AccountInterface $account) {
public function __construct(ControllerResolverInterface $controller_resolver, RequestStack $request_stack, RouteProviderInterface $route_provider, RouteBuilderInterface $route_builder, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache, LanguageManagerInterface $language_manager, AccessManagerInterface $access_manager, AccountInterface $account) {
$this->discovery = new YamlDiscovery('links.task', $module_handler->getModuleDirectories());
$this->discovery = new ContainerDerivativeDiscoveryDecorator($this->discovery);
$this->factory = new ContainerFactory($this);
......
......@@ -8,7 +8,7 @@
namespace Drupal\Core\Page;
use Drupal\Core\Cache\CacheableInterface;
use Drupal\Core\Language\LanguageManager;
use Drupal\Core\Language\LanguageManagerInterface;
/**
* Default page rendering engine.
......@@ -18,17 +18,17 @@ class DefaultHtmlFragmentRenderer implements HtmlFragmentRendererInterface {
/**
* The language manager.
*
* @var \Drupal\Core\Language\LanguageManager
* @var \Drupal\Core\Language\LanguageManagerInterface
*/
protected $languageManager;
/**
* Constructs a new DefaultHtmlPageRenderer.
*
* @param \Drupal\Core\Language\LanguageManager $language_manager
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager service.
*/
public function __construct(LanguageManager $language_manager) {
public function __construct(LanguageManagerInterface $language_manager) {
$this->languageManager = $language_manager;
}
......
......@@ -10,7 +10,6 @@
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\CacheDecorator\CacheDecoratorInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Language\LanguageManager;
use Drupal\Core\Language\LanguageManagerInterface;
class AliasManager implements AliasManagerInterface, CacheDecoratorInterface {
......@@ -46,7 +45,7 @@ class AliasManager implements AliasManagerInterface, CacheDecoratorInterface {
/**
* Language manager for retrieving the default langcode when none is specified.
*
* @var \Drupal\Core\Language\LanguageManager
* @var \Drupal\Core\Language\LanguageManagerInterface
*/
protected $languageManager;
......
......@@ -7,8 +7,6 @@
namespace Drupal\Core\TypedData;
use Drupal\Core\Language\LanguageManager;
/**
* Interface for translatable data.
*/
......
......@@ -12,7 +12,7 @@
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Language\LanguageManager;
use Drupal\Core\Language\LanguageManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
......@@ -30,7 +30,7 @@ class BlockContentForm extends ContentEntityForm {
/**
* The language manager.
*
* @var \Drupal\Core\Language\LanguageManager
* @var \Drupal\Core\Language\LanguageManagerInterface
*/
protected $languageManager;
......@@ -41,10 +41,10 @@ class BlockContentForm extends ContentEntityForm {
* The entity manager.
* @param \Drupal\Core\Entity\EntityStorageInterface $block_content_storage
* The custom block storage.
* @param \Drupal\Core\Language\LanguageManager $language_manager
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager.
*/
public function __construct(EntityManagerInterface $entity_manager, EntityStorageInterface $block_content_storage, LanguageManager $language_manager) {
public function __construct(EntityManagerInterface $entity_manager, EntityStorageInterface $block_content_storage, LanguageManagerInterface $language_manager) {
parent::__construct($entity_manager);
$this->blockContentStorage = $block_content_storage;
$this->languageManager = $language_manager;
......
......@@ -11,7 +11,7 @@
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\ckeditor\CKEditorPluginManager;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageManager;
use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\Render\Element;
use Drupal\editor\Plugin\EditorBase;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
......@@ -41,7 +41,7 @@ class CKEditor extends EditorBase implements ContainerFactoryPluginInterface {
/**
* The language manager.
*
* @var \Drupal\Core\Language\LanguageManager
* @var \Drupal\Core\Language\LanguageManagerInterface
*/
protected $languageManager;
......@@ -65,10 +65,10 @@ class CKEditor extends EditorBase implements ContainerFactoryPluginInterface {
* The CKEditor plugin manager.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler to invoke hooks on.
* @param \Drupal\Core\Language\LanguageManager $language_manager
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, CKEditorPluginManager $ckeditor_plugin_manager, ModuleHandlerInterface $module_handler, LanguageManager $language_manager) {
public function __construct(array $configuration, $plugin_id, $plugin_definition, CKEditorPluginManager $ckeditor_plugin_manager, ModuleHandlerInterface $module_handler, LanguageManagerInterface $language_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->ckeditorPluginManager = $ckeditor_plugin_manager;
$this->moduleHandler = $module_handler;
......
......@@ -18,7 +18,7 @@
use Drupal\Core\Field\FormatterPluginManager;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Language\LanguageManager;
use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\Render\Element;
use Drupal\Core\Session\AccountInterface;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
......@@ -106,7 +106,7 @@ class Field extends FieldPluginBase {
/**
* The language manager.
*
* @var \Drupal\Core\Language\LanguageManager
* @var \Drupal\Core\Language\LanguageManagerInterface
*/
protected $languageManager;
......@@ -123,10 +123,10 @@ class Field extends FieldPluginBase {
* The field formatter plugin manager.
* @param \Drupal\Core\Field\FormatterPluginManager $formatter_plugin_manager
* The field formatter plugin manager.
* @param \Drupal\Core\Language\LanguageManager $language_manager
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager, FormatterPluginManager $formatter_plugin_manager, LanguageManager $language_manager) {
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager, FormatterPluginManager $formatter_plugin_manager, LanguageManagerInterface $language_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->entityManager = $entity_manager;
......
......@@ -8,7 +8,7 @@
namespace Drupal\language_test\Controller;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Language\LanguageManager;
use Drupal\Core\Language\LanguageManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\HttpKernelInterface;
......@@ -28,7 +28,7 @@ class LanguageTestController implements ContainerInjectionInterface {
/**
* The language manager service.
*
* @var \Drupal\Core\Language\LanguageManager
* @var \Drupal\Core\Language\LanguageManagerInterface
*/
protected $languageManager;
......@@ -38,7 +38,7 @@ class LanguageTestController implements ContainerInjectionInterface {
* @param \Symfony\Component\HttpKernel\HttpKernelInterface $httpKernel
* An HTTP kernel.
*/
public function __construct(HttpKernelInterface $httpKernel, LanguageManager $language_manager) {
public function __construct(HttpKernelInterface $httpKernel, LanguageManagerInterface $language_manager) {
$this->httpKernel = $httpKernel;
$this->languageManager = $language_manager;
}
......
......@@ -8,7 +8,7 @@
namespace Drupal\locale\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Language\LanguageManager;
use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\locale\StringStorageInterface;
use Drupal\Core\State\StateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
......@@ -37,7 +37,7 @@ abstract class TranslateFormBase extends FormBase {
/**
* The language manager.
*
* @var \Drupal\Core\Language\LanguageManager
* @var \Drupal\Core\Language\LanguageManagerInterface
*/
protected $languageManager;
......@@ -55,10 +55,10 @@ abstract class TranslateFormBase extends FormBase {
* The locale storage.
* @param \Drupal\Core\State\StateInterface $state
* The state service.
* @param \Drupal\Core\Language\LanguageManager $language_manager
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager.
*/
public function __construct(StringStorageInterface $locale_storage, StateInterface $state, LanguageManager $language_manager) {
public function __construct(StringStorageInterface $locale_storage, StateInterface $state, LanguageManagerInterface $language_manager) {
$this->localeStorage = $locale_storage;
$this->state = $state;
$this->languageManager = $language_manager;
......
......@@ -10,7 +10,7 @@
use Drupal\Core\Field\Plugin\Field\FieldType\EmailItem;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageManager;
use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\user\UserStorageInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\DependencyInjection\ContainerInterface;
......@@ -30,7 +30,7 @@ class UserPasswordForm extends FormBase {
/**
* The language manager.
*
* @var \Drupal\Core\Language\LanguageManager
* @var \Drupal\Core\Language\LanguageManagerInterface
*/
protected $languageManager;
......@@ -39,10 +39,10 @@ class UserPasswordForm extends FormBase {
*
* @param \Drupal\user\UserStorageInterface $user_storage
* The user storage.
* @param \Drupal\Core\Language\LanguageManager $language_manager
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager.
*/
public function __construct(UserStorageInterface $user_storage, LanguageManager $language_manager) {
public function __construct(UserStorageInterface $user_storage, LanguageManagerInterface $language_manager) {
$this->userStorage = $user_storage;
$this->languageManager = $language_manager;
}
......
......@@ -10,7 +10,7 @@
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\Query\QueryFactory;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageManager;
use Drupal\Core\Language\LanguageManagerInterface;
/**
* Form controller for the profile forms.
......@@ -20,7 +20,7 @@ class ProfileForm extends AccountForm {
/**
* {@inheritdoc}
*/
public function __construct(EntityManagerInterface $entity_manager, LanguageManager $language_manager, QueryFactory $entity_query) {
public function __construct(EntityManagerInterface $entity_manager, LanguageManagerInterface $language_manager, QueryFactory $entity_query) {
parent::__construct($entity_manager, $language_manager, $entity_query);
}
......
......@@ -10,7 +10,7 @@
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\Query\QueryFactory;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageManager;
use Drupal\Core\Language\LanguageManagerInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
/**
......@@ -21,7 +21,7 @@ class RegisterForm extends AccountForm {
/**
* {@inheritdoc}
*/
public function __construct(EntityManagerInterface $entity_manager, LanguageManager $language_manager, QueryFactory $entity_query) {
public function __construct(EntityManagerInterface $entity_manager, LanguageManagerInterface $language_manager, QueryFactory $entity_query) {
parent::__construct($entity_manager, $language_manager, $entity_query);
}
......
......@@ -41,7 +41,7 @@ class ViewsDataTest extends UnitTestCase {
/**
* The mocked language manager.
*
* @var \Drupal\Core\Language\LanguageManager|\PHPUnit_Framework_MockObject_MockObject
* @var \Drupal\Core\Language\LanguageManagerInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $languageManager;
......
......@@ -26,7 +26,7 @@ class DateTest extends UnitTestCase {
/**
* The mocked language manager.
*
* @var \Drupal\Core\Language\LanguageManager|\PHPUnit_Framework_MockObject_MockObject
* @var \Drupal\Core\Language\LanguageManagerInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $languageManager;
......
......@@ -68,7 +68,7 @@ class EntityManagerTest extends UnitTestCase {
/**
* The language manager.
*
* @var \Drupal\Core\Language\LanguageManager|\PHPUnit_Framework_MockObject_MockObject
* @var \Drupal\Core\Language\LanguageManagerInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $languageManager;
......@@ -108,6 +108,7 @@ protected function setUp() {
$this->cache = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
$this->languageManager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
$this->languageManager->expects($this->any())
->method('getCurrentLanguage')
->will($this->returnValue((object) array('id' => 'en')));
......
......@@ -27,7 +27,7 @@ class TokenTest extends UnitTestCase {
/**
* The language manager used for testing.
*
* @var \Drupal\Core\Language\LanguageManager|\PHPUnit_Framework_MockObject_MockObject
* @var \Drupal\Core\Language\LanguageManagerInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $languageManager;
......@@ -51,9 +51,7 @@ class TokenTest extends UnitTestCase {
protected function setUp() {
$this->cache = $this->getMock('\Drupal\Core\Cache\CacheBackendInterface');
$this->languageManager = $this->getMockBuilder('\Drupal\Core\Language\LanguageManager')
->disableOriginalConstructor()
->getMock();
$this->languageManager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
$this->moduleHandler = $this->getMock('\Drupal\Core\Extension\ModuleHandlerInterface');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment