Commit 6ab5a3aa authored by alexpott's avatar alexpott

Issue #2715741 by Mile23, pfrenssen: Fix 'Drupal.Classes.FullyQualifiedNamespace' coding standard

parent 3eeaeb64
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
use Drupal\Component\Utility\SortArray; use Drupal\Component\Utility\SortArray;
use Drupal\Component\Utility\UrlHelper; use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\Cache;
use Drupal\Core\Render\Element\Link;
use Drupal\Core\Render\Markup; use Drupal\Core\Render\Markup;
use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\PhpStorage\PhpStorageFactory; use Drupal\Core\PhpStorage\PhpStorageFactory;
...@@ -748,7 +749,7 @@ function drupal_clear_js_cache() { ...@@ -748,7 +749,7 @@ function drupal_clear_js_cache() {
* Use \Drupal\Core\Render\Element\Link::preRenderLink(). * Use \Drupal\Core\Render\Element\Link::preRenderLink().
*/ */
function drupal_pre_render_link($element) { function drupal_pre_render_link($element) {
return Element\Link::preRenderLink($element); return Link::preRenderLink($element);
} }
/** /**
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
use Drupal\Component\Utility\UrlHelper; use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\Render\Element; use Drupal\Core\Render\Element;
use Drupal\Core\Render\Element\RenderElement;
use Drupal\Core\Template\Attribute; use Drupal\Core\Template\Attribute;
use Drupal\Core\Url; use Drupal\Core\Url;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
...@@ -29,7 +30,7 @@ ...@@ -29,7 +30,7 @@
function template_preprocess_select(&$variables) { function template_preprocess_select(&$variables) {
$element = $variables['element']; $element = $variables['element'];
Element::setAttributes($element, array('id', 'name', 'size')); Element::setAttributes($element, array('id', 'name', 'size'));
Element\RenderElement::setAttributes($element, array('form-select')); RenderElement::setAttributes($element, array('form-select'));
$variables['attributes'] = $element['#attributes']; $variables['attributes'] = $element['#attributes'];
$variables['options'] = form_select_options($element); $variables['options'] = form_select_options($element);
...@@ -191,7 +192,7 @@ function form_get_options($element, $key) { ...@@ -191,7 +192,7 @@ function form_get_options($element, $key) {
function template_preprocess_fieldset(&$variables) { function template_preprocess_fieldset(&$variables) {
$element = $variables['element']; $element = $variables['element'];
Element::setAttributes($element, array('id')); Element::setAttributes($element, array('id'));
Element\RenderElement::setAttributes($element); RenderElement::setAttributes($element);
$variables['attributes'] = isset($element['#attributes']) ? $element['#attributes'] : array(); $variables['attributes'] = isset($element['#attributes']) ? $element['#attributes'] : array();
$variables['prefix'] = isset($element['#field_prefix']) ? $element['#field_prefix'] : NULL; $variables['prefix'] = isset($element['#field_prefix']) ? $element['#field_prefix'] : NULL;
$variables['suffix'] = isset($element['#field_suffix']) ? $element['#field_suffix'] : NULL; $variables['suffix'] = isset($element['#field_suffix']) ? $element['#field_suffix'] : NULL;
...@@ -376,7 +377,7 @@ function template_preprocess_form(&$variables) { ...@@ -376,7 +377,7 @@ function template_preprocess_form(&$variables) {
function template_preprocess_textarea(&$variables) { function template_preprocess_textarea(&$variables) {
$element = $variables['element']; $element = $variables['element'];
Element::setAttributes($element, array('id', 'name', 'rows', 'cols', 'placeholder')); Element::setAttributes($element, array('id', 'name', 'rows', 'cols', 'placeholder'));
Element\RenderElement::setAttributes($element, array('form-textarea')); RenderElement::setAttributes($element, array('form-textarea'));
$variables['wrapper_attributes'] = new Attribute(); $variables['wrapper_attributes'] = new Attribute();
$variables['attributes'] = new Attribute($element['#attributes']); $variables['attributes'] = new Attribute($element['#attributes']);
$variables['value'] = $element['#value']; $variables['value'] = $element['#value'];
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace Drupal\Core; namespace Drupal\Core;
use Drupal\Component\Assertion\Handle;
use Drupal\Component\FileCache\FileCacheFactory; use Drupal\Component\FileCache\FileCacheFactory;
use Drupal\Component\Utility\Unicode; use Drupal\Component\Utility\Unicode;
use Drupal\Component\Utility\UrlHelper; use Drupal\Component\Utility\UrlHelper;
...@@ -18,6 +19,7 @@ ...@@ -18,6 +19,7 @@
use Drupal\Core\Language\Language; use Drupal\Core\Language\Language;
use Drupal\Core\Site\Settings; use Drupal\Core\Site\Settings;
use Symfony\Cmf\Component\Routing\RouteObjectInterface; use Symfony\Cmf\Component\Routing\RouteObjectInterface;
use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
...@@ -923,7 +925,7 @@ public static function bootEnvironment() { ...@@ -923,7 +925,7 @@ public static function bootEnvironment() {
assert_options(ASSERT_ACTIVE, TRUE); assert_options(ASSERT_ACTIVE, TRUE);
// Now synchronize PHP 5 and 7's handling of assertions as much as // Now synchronize PHP 5 and 7's handling of assertions as much as
// possible. // possible.
\Drupal\Component\Assertion\Handle::register(); Handle::register();
// Log fatal errors to the test site directory. // Log fatal errors to the test site directory.
ini_set('log_errors', 1); ini_set('log_errors', 1);
...@@ -978,7 +980,7 @@ protected function initializeSettings(Request $request) { ...@@ -978,7 +980,7 @@ protected function initializeSettings(Request $request) {
&& Settings::get('class_loader_auto_detect', TRUE) && Settings::get('class_loader_auto_detect', TRUE)
&& extension_loaded('apc')) { && extension_loaded('apc')) {
$prefix = Settings::getApcuPrefix('class_loader', $this->root); $prefix = Settings::getApcuPrefix('class_loader', $this->root);
$apc_loader = new \Symfony\Component\ClassLoader\ApcClassLoader($prefix, $this->classLoader); $apc_loader = new ApcClassLoader($prefix, $this->classLoader);
$this->classLoader->unregister(); $this->classLoader->unregister();
$apc_loader->register(); $apc_loader->register();
$this->classLoader = $apc_loader; $this->classLoader = $apc_loader;
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
namespace Drupal\Core\PageCache; namespace Drupal\Core\PageCache;
use Drupal\Core\PageCache\RequestPolicy\CommandLineOrUnsafeMethod;
use Drupal\Core\PageCache\RequestPolicy\NoSessionOpen;
use Drupal\Core\Session\SessionConfigurationInterface; use Drupal\Core\Session\SessionConfigurationInterface;
/** /**
...@@ -20,8 +22,8 @@ class DefaultRequestPolicy extends ChainRequestPolicy { ...@@ -20,8 +22,8 @@ class DefaultRequestPolicy extends ChainRequestPolicy {
* The session configuration. * The session configuration.
*/ */
public function __construct(SessionConfigurationInterface $session_configuration) { public function __construct(SessionConfigurationInterface $session_configuration) {
$this->addPolicy(new RequestPolicy\CommandLineOrUnsafeMethod()); $this->addPolicy(new CommandLineOrUnsafeMethod());
$this->addPolicy(new RequestPolicy\NoSessionOpen($session_configuration)); $this->addPolicy(new NoSessionOpen($session_configuration));
} }
} }
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
use Drupal\aggregator\Entity\Feed; use Drupal\aggregator\Entity\Feed;
use Drupal\aggregator\Entity\Item; use Drupal\aggregator\Entity\Item;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\system\Tests\Entity\EntityCacheTagsTestBase; use Drupal\system\Tests\Entity\EntityCacheTagsTestBase;
use Drupal\user\Entity\Role; use Drupal\user\Entity\Role;
use Drupal\user\RoleInterface; use Drupal\user\RoleInterface;
...@@ -63,7 +64,7 @@ protected function createEntity() { ...@@ -63,7 +64,7 @@ protected function createEntity() {
*/ */
public function testEntityCreation() { public function testEntityCreation() {
// Create a cache entry that is tagged with a feed cache tag. // Create a cache entry that is tagged with a feed cache tag.
\Drupal::cache('render')->set('foo', 'bar', \Drupal\Core\Cache\CacheBackendInterface::CACHE_PERMANENT, $this->entity->getCacheTags()); \Drupal::cache('render')->set('foo', 'bar', CacheBackendInterface::CACHE_PERMANENT, $this->entity->getCacheTags());
// Verify a cache hit. // Verify a cache hit.
$this->verifyRenderCache('foo', array('aggregator_feed:1')); $this->verifyRenderCache('foo', array('aggregator_feed:1'));
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
use Drupal\big_pipe\Render\BigPipeMarkup; use Drupal\big_pipe\Render\BigPipeMarkup;
use Drupal\Core\Session\AccountInterface; use Drupal\Core\Session\AccountInterface;
use Drupal\Core\StringTranslation\PluralTranslatableMarkup;
use Drupal\Core\Url; use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
...@@ -93,7 +94,7 @@ public static function cases(ContainerInterface $container = NULL, AccountInterf ...@@ -93,7 +94,7 @@ public static function cases(ContainerInterface $container = NULL, AccountInterf
'theme' => 'classy', 'theme' => 'classy',
'libraries' => 'big_pipe/big_pipe,classy/base,classy/messages,core/drupal.active-link,core/html5shiv,core/normalize,system/base', 'libraries' => 'big_pipe/big_pipe,classy/base,classy/messages,core/drupal.active-link,core/html5shiv,core/normalize,system/base',
], ],
'pluralDelimiter' => \Drupal\Core\StringTranslation\PluralTranslatableMarkup::DELIMITER, 'pluralDelimiter' => PluralTranslatableMarkup::DELIMITER,
'user' => [ 'user' => [
'uid' => '1', 'uid' => '1',
'permissionsHash' => $container->get('user_permissions_hash_generator')->generate($user), 'permissionsHash' => $container->get('user_permissions_hash_generator')->generate($user),
......
...@@ -361,7 +361,7 @@ protected function getTestCases() { ...@@ -361,7 +361,7 @@ protected function getTestCases() {
$csrf_token_seed = unserialize(explode('_sf2_meta|', $session_data)[1])['s']; $csrf_token_seed = unserialize(explode('_sf2_meta|', $session_data)[1])['s'];
$this->container->get('session_manager.metadata_bag')->setCsrfTokenSeed($csrf_token_seed); $this->container->get('session_manager.metadata_bag')->setCsrfTokenSeed($csrf_token_seed);
return \Drupal\big_pipe\Tests\BigPipePlaceholderTestCases::cases($this->container, $this->rootUser); return BigPipePlaceholderTestCases::cases($this->container, $this->rootUser);
} }
/** /**
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace Drupal\big_pipe_test; namespace Drupal\big_pipe_test;
use Drupal\big_pipe\Render\BigPipeMarkup; use Drupal\big_pipe\Render\BigPipeMarkup;
use Drupal\big_pipe\Tests\BigPipePlaceholderTestCases;
use Drupal\big_pipe_test\EventSubscriber\BigPipeTestSubscriber; use Drupal\big_pipe_test\EventSubscriber\BigPipeTestSubscriber;
class BigPipeTestController { class BigPipeTestController {
...@@ -15,7 +16,7 @@ class BigPipeTestController { ...@@ -15,7 +16,7 @@ class BigPipeTestController {
public function test() { public function test() {
$build = []; $build = [];
$cases = \Drupal\big_pipe\Tests\BigPipePlaceholderTestCases::cases(\Drupal::getContainer()); $cases = BigPipePlaceholderTestCases::cases(\Drupal::getContainer());
// 1. HTML placeholder: status messages. Drupal renders those automatically, // 1. HTML placeholder: status messages. Drupal renders those automatically,
// so all that we need to do in this controller is set a message. // so all that we need to do in this controller is set a message.
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace Drupal\Tests\big_pipe\Unit\Render\Placeholder; namespace Drupal\Tests\big_pipe\Unit\Render\Placeholder;
use Drupal\big_pipe\Render\Placeholder\BigPipeStrategy; use Drupal\big_pipe\Render\Placeholder\BigPipeStrategy;
use Drupal\big_pipe\Tests\BigPipePlaceholderTestCases;
use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Session\SessionConfigurationInterface; use Drupal\Core\Session\SessionConfigurationInterface;
use Drupal\Tests\UnitTestCase; use Drupal\Tests\UnitTestCase;
...@@ -61,7 +62,7 @@ public function testProcessPlaceholders(array $placeholders, $method, $route_mat ...@@ -61,7 +62,7 @@ public function testProcessPlaceholders(array $placeholders, $method, $route_mat
* @see \Drupal\big_pipe\Tests\BigPipePlaceholderTestCases * @see \Drupal\big_pipe\Tests\BigPipePlaceholderTestCases
*/ */
public function placeholdersProvider() { public function placeholdersProvider() {
$cases = \Drupal\big_pipe\Tests\BigPipePlaceholderTestCases::cases(); $cases = BigPipePlaceholderTestCases::cases();
// Generate $placeholders variable as expected by // Generate $placeholders variable as expected by
// \Drupal\Core\Render\Placeholder\PlaceholderStrategyInterface::processPlaceholders(). // \Drupal\Core\Render\Placeholder\PlaceholderStrategyInterface::processPlaceholders().
......
...@@ -82,7 +82,7 @@ protected function createEntity() { ...@@ -82,7 +82,7 @@ protected function createEntity() {
'entity_id' => $this->entityTestCamelid->id(), 'entity_id' => $this->entityTestCamelid->id(),
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
'field_name' => 'comment', 'field_name' => 'comment',
'status' => \Drupal\comment\CommentInterface::PUBLISHED, 'status' => CommentInterface::PUBLISHED,
)); ));
$comment->save(); $comment->save();
......
...@@ -5,10 +5,12 @@ ...@@ -5,10 +5,12 @@
* Provides hook implementations for testing purposes. * Provides hook implementations for testing purposes.
*/ */
use Drupal\Core\Entity\EntityInterface;
/** /**
* Implements hook_ENTITY_TYPE_create. * Implements hook_ENTITY_TYPE_create.
*/ */
function config_install_dependency_test_config_test_create(\Drupal\Core\Entity\EntityInterface $entity) { function config_install_dependency_test_config_test_create(EntityInterface $entity) {
// Add an enforced dependency on this module so that we can test if this is // Add an enforced dependency on this module so that we can test if this is
// possible during module installation. // possible during module installation.
$entity->setEnforcedDependencies(['module' => ['config_install_dependency_test']]); $entity->setEnforcedDependencies(['module' => ['config_install_dependency_test']]);
......
...@@ -6,13 +6,14 @@ ...@@ -6,13 +6,14 @@
*/ */
use Drupal\contact\ContactFormInterface; use Drupal\contact\ContactFormInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\FormStateInterface;
/** /**
* Implements hook_entity_base_field_info(). * Implements hook_entity_base_field_info().
*/ */
function contact_storage_test_entity_base_field_info(\Drupal\Core\Entity\EntityTypeInterface $entity_type) { function contact_storage_test_entity_base_field_info(EntityTypeInterface $entity_type) {
if ($entity_type->id() == 'contact_message') { if ($entity_type->id() == 'contact_message') {
$fields = array(); $fields = array();
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
use Drupal\Core\Config\ConfigImporter; use Drupal\Core\Config\ConfigImporter;
use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\DynamicallyFieldableEntityStorageInterface; use Drupal\Core\Entity\DynamicallyFieldableEntityStorageInterface;
use Drupal\field\ConfigImporterFieldPurger;
use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig; use Drupal\field\Entity\FieldStorageConfig;
use Drupal\field\FieldConfigInterface; use Drupal\field\FieldConfigInterface;
...@@ -168,7 +169,7 @@ function field_cron() { ...@@ -168,7 +169,7 @@ function field_cron() {
/** /**
* Implements hook_entity_field_storage_info(). * Implements hook_entity_field_storage_info().
*/ */
function field_entity_field_storage_info(\Drupal\Core\Entity\EntityTypeInterface $entity_type) { function field_entity_field_storage_info(EntityTypeInterface $entity_type) {
if (\Drupal::entityManager()->getStorage($entity_type->id()) instanceof DynamicallyFieldableEntityStorageInterface) { if (\Drupal::entityManager()->getStorage($entity_type->id()) instanceof DynamicallyFieldableEntityStorageInterface) {
// Query by filtering on the ID as this is more efficient than filtering // Query by filtering on the ID as this is more efficient than filtering
// on the entity_type property directly. // on the entity_type property directly.
...@@ -301,7 +302,7 @@ function _field_create_entity_from_ids($ids) { ...@@ -301,7 +302,7 @@ function _field_create_entity_from_ids($ids) {
* Implements hook_config_import_steps_alter(). * Implements hook_config_import_steps_alter().
*/ */
function field_config_import_steps_alter(&$sync_steps, ConfigImporter $config_importer) { function field_config_import_steps_alter(&$sync_steps, ConfigImporter $config_importer) {
$field_storages = \Drupal\field\ConfigImporterFieldPurger::getFieldStoragesToPurge( $field_storages = ConfigImporterFieldPurger::getFieldStoragesToPurge(
$config_importer->getStorageComparer()->getSourceStorage()->read('core.extension'), $config_importer->getStorageComparer()->getSourceStorage()->read('core.extension'),
$config_importer->getStorageComparer()->getChangelist('delete') $config_importer->getStorageComparer()->getChangelist('delete')
); );
...@@ -327,7 +328,7 @@ function field_form_config_admin_import_form_alter(&$form, FormStateInterface $f ...@@ -327,7 +328,7 @@ function field_form_config_admin_import_form_alter(&$form, FormStateInterface $f
$user_input = $form_state->getUserInput(); $user_input = $form_state->getUserInput();
$storage_comparer = $form_state->get('storage_comparer'); $storage_comparer = $form_state->get('storage_comparer');
if ($storage_comparer && empty($user_input)) { if ($storage_comparer && empty($user_input)) {
$field_storages = \Drupal\field\ConfigImporterFieldPurger::getFieldStoragesToPurge( $field_storages = ConfigImporterFieldPurger::getFieldStoragesToPurge(
$storage_comparer->getSourceStorage()->read('core.extension'), $storage_comparer->getSourceStorage()->read('core.extension'),
$storage_comparer->getChangelist('delete') $storage_comparer->getChangelist('delete')
); );
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
use Drupal\Core\Database\Database; use Drupal\Core\Database\Database;
use Drupal\Component\Serialization\Yaml; use Drupal\Component\Serialization\Yaml;
use Drupal\field\Entity\FieldStorageConfig;
$connection = Database::getConnection(); $connection = Database::getConnection();
...@@ -59,8 +60,8 @@ ...@@ -59,8 +60,8 @@
->execute() ->execute()
->fetchField(); ->fetchField();
$installed = unserialize($installed); $installed = unserialize($installed);
$installed['field_ref_views_select_2429191'] = new \Drupal\field\Entity\FieldStorageConfig($field_ref_views_select_2429191); $installed['field_ref_views_select_2429191'] = new FieldStorageConfig($field_ref_views_select_2429191);
$installed['field_ref_autocreate_2412569'] = new \Drupal\field\Entity\FieldStorageConfig($field_ref_autocreate_2412569); $installed['field_ref_autocreate_2412569'] = new FieldStorageConfig($field_ref_autocreate_2412569);
$connection->update('key_value') $connection->update('key_value')
->condition('collection', 'entity.definitions.installed') ->condition('collection', 'entity.definitions.installed')
->condition('name', 'node.field_storage_definitions') ->condition('name', 'node.field_storage_definitions')
......
...@@ -13,8 +13,9 @@ ...@@ -13,8 +13,9 @@
* test helper functions * test helper functions
*/ */
use Drupal\field\FieldStorageConfigInterface; use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\FormStateInterface;
use Drupal\field\FieldStorageConfigInterface;
require_once __DIR__ . '/field_test.entity.inc'; require_once __DIR__ . '/field_test.entity.inc';
require_once __DIR__ . '/field_test.field.inc'; require_once __DIR__ . '/field_test.field.inc';
...@@ -149,7 +150,7 @@ function field_test_entity_extra_field_info_alter(&$info) { ...@@ -149,7 +150,7 @@ function field_test_entity_extra_field_info_alter(&$info) {
/** /**
* Implements hook_entity_bundle_field_info_alter(). * Implements hook_entity_bundle_field_info_alter().
*/ */
function field_test_entity_bundle_field_info_alter(&$fields, \Drupal\Core\Entity\EntityTypeInterface $entity_type, $bundle) { function field_test_entity_bundle_field_info_alter(&$fields, EntityTypeInterface $entity_type, $bundle) {
if (($field_name = \Drupal::state()->get('field_test_set_constraint', FALSE)) && $entity_type->id() == 'entity_test' && $bundle == 'entity_test' && !empty($fields[$field_name])) { if (($field_name = \Drupal::state()->get('field_test_set_constraint', FALSE)) && $entity_type->id() == 'entity_test' && $bundle == 'entity_test' && !empty($fields[$field_name])) {
$fields[$field_name]->setPropertyConstraints('value', [ $fields[$field_name]->setPropertyConstraints('value', [
'Range' => [ 'Range' => [
......
...@@ -5,12 +5,15 @@ ...@@ -5,12 +5,15 @@
* Test module. * Test module.
*/ */
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Field\FormatterInterface;
use Drupal\Core\Field\WidgetInterface;
use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\FormStateInterface;
/** /**
* Implements hook_field_widget_third_party_settings_form(). * Implements hook_field_widget_third_party_settings_form().
*/ */
function field_third_party_test_field_widget_third_party_settings_form(\Drupal\Core\Field\WidgetInterface $plugin, \Drupal\Core\Field\FieldDefinitionInterface $field_definition, $form_mode, $form, FormStateInterface $form_state) { function field_third_party_test_field_widget_third_party_settings_form(WidgetInterface $plugin, FieldDefinitionInterface $field_definition, $form_mode, $form, FormStateInterface $form_state) {
$element['field_test_widget_third_party_settings_form'] = array( $element['field_test_widget_third_party_settings_form'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('3rd party widget settings form'), '#title' => t('3rd party widget settings form'),
...@@ -30,7 +33,7 @@ function field_third_party_test_field_widget_settings_summary_alter(&$summary, $ ...@@ -30,7 +33,7 @@ function field_third_party_test_field_widget_settings_summary_alter(&$summary, $
/** /**
* Implements hook_field_formatter_third_party_settings_form(). * Implements hook_field_formatter_third_party_settings_form().
*/ */
function field_third_party_test_field_formatter_third_party_settings_form(\Drupal\Core\Field\FormatterInterface $plugin, \Drupal\Core\Field\FieldDefinitionInterface $field_definition, $view_mode, $form, FormStateInterface $form_state) { function field_third_party_test_field_formatter_third_party_settings_form(FormatterInterface $plugin, FieldDefinitionInterface $field_definition, $view_mode, $form, FormStateInterface $form_state) {
$element['field_test_field_formatter_third_party_settings_form'] = array( $element['field_test_field_formatter_third_party_settings_form'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('3rd party formatter settings form'), '#title' => t('3rd party formatter settings form'),
......
...@@ -207,7 +207,7 @@ function testFilterFormatAPI() { ...@@ -207,7 +207,7 @@ function testFilterFormatAPI() {
// Test on nonsensical_restricted_html, where the allowed attribute values // Test on nonsensical_restricted_html, where the allowed attribute values
// contain asterisks, which do not have any meaning, but which we also // contain asterisks, which do not have any meaning, but which we also
// cannot prevent because configuration can be modified outside of forms. // cannot prevent because configuration can be modified outside of forms.
$nonsensical_restricted_html = \Drupal\filter\Entity\FilterFormat::create(array( $nonsensical_restricted_html = FilterFormat::create(array(
'format' => 'nonsensical_restricted_html', 'format' => 'nonsensical_restricted_html',
'name' => 'Nonsensical Restricted HTML', 'name' => 'Nonsensical Restricted HTML',
'filters' => array( 'filters' => array(
...@@ -468,7 +468,7 @@ public function assertFilterFormatViolation(ConstraintViolationListInterface $vi ...@@ -468,7 +468,7 @@ public function assertFilterFormatViolation(ConstraintViolationListInterface $vi
*/ */
public function testDependencyRemoval() { public function testDependencyRemoval() {
$this->installSchema('user', array('users_data')); $this->installSchema('user', array('users_data'));
$filter_format = \Drupal\filter\Entity\FilterFormat::load('filtered_html'); $filter_format = FilterFormat::load('filtered_html');
// Disable the filter_test_restrict_tags_and_attributes filter plugin but // Disable the filter_test_restrict_tags_and_attributes filter plugin but
// have custom configuration so that the filter plugin is still configured // have custom configuration so that the filter plugin is still configured
...@@ -498,7 +498,7 @@ public function testDependencyRemoval() { ...@@ -498,7 +498,7 @@ public function testDependencyRemoval() {
// Verify the filter format still exists but the dependency and filter is // Verify the filter format still exists but the dependency and filter is
// gone. // gone.
\Drupal::entityManager()->getStorage('filter_format')->resetCache(); \Drupal::entityManager()->getStorage('filter_format')->resetCache();
$filter_format = \Drupal\filter\Entity\FilterFormat::load('filtered_html'); $filter_format = FilterFormat::load('filtered_html');
$this->assertEqual([], $filter_format->getDependencies()); $this->assertEqual([], $filter_format->getDependencies());
// Use the get method since the FilterFormat::filters() method only returns // Use the get method since the FilterFormat::filters() method only returns
// existing plugins. // existing plugins.
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
use Drupal\comment\CommentInterface; use Drupal\comment\CommentInterface;
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface; use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Url; use Drupal\Core\Url;
use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Routing\RouteMatchInterface;
...@@ -134,7 +135,7 @@ function forum_uri($forum) { ...@@ -134,7 +135,7 @@ function forum_uri($forum) {
/** /**
* Implements hook_entity_bundle_field_info_alter(). * Implements hook_entity_bundle_field_info_alter().
*/ */
function forum_entity_bundle_field_info_alter(&$fields, \Drupal\Core\Entity\EntityTypeInterface $entity_type, $bundle) { function forum_entity_bundle_field_info_alter(&$fields, EntityTypeInterface $entity_type, $bundle) {
if ($entity_type->id() == 'node' && !empty($fields['taxonomy_forums'])) { if ($entity_type->id() == 'node' && !empty($fields['taxonomy_forums'])) {
$fields['taxonomy_forums']->addConstraint('ForumLeaf', []); $fields['taxonomy_forums']->addConstraint('ForumLeaf', []);
} }
......
...@@ -340,7 +340,7 @@ function locale_translate_batch_refresh(&$context) { ...@@ -340,7 +340,7 @@ function locale_translate_batch_refresh(&$context) {
// Clear cache and force refresh of JavaScript translations. // Clear cache and force refresh of JavaScript translations.
_locale_refresh_translations($context['sandbox']['refresh']['languages'], $next); _locale_refresh_translations($context['sandbox']['refresh']['languages'], $next);
// Check whether we need to refresh configuration objects. // Check whether we need to refresh configuration objects.
if ($names = \Drupal\locale\Locale::config()->getStringNames($next)) { if ($names = Locale::config()->getStringNames($next)) {
$context['sandbox']['refresh']['names_finished'] = $context['finished']; $context['sandbox']['refresh']['names_finished'] = $context['finished'];
$context['sandbox']['refresh']['names'] = $names; $context['sandbox']['refresh']['names'] = $names;
} }
...@@ -533,7 +533,7 @@ function locale_translate_delete_translation_files(array $projects = array(), ar ...@@ -533,7 +533,7 @@ function locale_translate_delete_translation_files(array $projects = array(), ar
*/ */
function locale_config_batch_update_components(array $options, array $langcodes = array(), array $components = array()) { function locale_config_batch_update_components(array $options, array $langcodes = array(), array $components = array()) {
$langcodes = $langcodes ? $langcodes : array_keys(\Drupal::languageManager()->getLanguages()); $langcodes = $langcodes ? $langcodes : array_keys(\Drupal::languageManager()->getLanguages());
if ($langcodes && $names = \Drupal\locale\Locale::config()->getComponentNames($components)) { if ($langcodes && $names = Locale::config()->getComponentNames($components)) {
return locale_config_batch_build($names, $langcodes, $options); return locale_config_batch_build($names, $langcodes, $options);
} }
} }
......
...@@ -67,7 +67,7 @@ protected function setUp() { ...@@ -67,7 +67,7 @@ protected function setUp() {
// @see locale_system_update() // @see locale_system_update()
locale_system_set_config_langcodes(); locale_system_set_config_langcodes();
$langcodes = array_keys(\Drupal::languageManager()->getLanguages()); $langcodes = array_keys(\Drupal::languageManager()->getLanguages());
$names = \Drupal\locale\Locale::config()->getComponentNames(); $names = Locale::config()->getComponentNames();
Locale::config()->updateConfigTranslations($names, $langcodes); Locale::config()->updateConfigTranslations($names, $langcodes);
$this->configFactory = $this->container->get('config.factory'); $this->configFactory = $this->container->get('config.factory');
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
* @see \Drupal\node\Tests\NodeAccessBaseTableTest * @see \Drupal\node\Tests\NodeAccessBaseTableTest
*/ */
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Access\AccessResult; use Drupal\Core\Access\AccessResult;
use Drupal\field\Entity\FieldStorageConfig; use Drupal\field\Entity\FieldStorageConfig;
use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldConfig;
...@@ -144,7 +145,7 @@ function node_access_test_add_field(NodeTypeInterface $type) { ...@@ -144,7 +145,7 @@ function node_access_test_add_field(NodeTypeInterface $type) {
/** /**
* Implements hook_node_access(). * Implements hook_node_access().
*/ */
function node_access_test_node_access(\Drupal\node\NodeInterface $node, $op, \Drupal\Core\Session\AccountInterface $account) { function node_access_test_node_access(NodeInterface $node, $op, AccountInterface $account) {
$secret_catalan = \Drupal::state() $secret_catalan = \Drupal::state()
->get('node_access_test_secret_catalan') ?: 0; ->get('node_access_test_secret_catalan') ?: 0;
if ($secret_catalan && $node->language()->getId() == 'ca') { if ($secret_catalan && $node->language()->getId() == 'ca') {
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
* interaction with the Node module. * interaction with the Node module.
*/ */
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface; use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Session\AccountInterface; use Drupal\Core\Session\AccountInterface;
use Drupal\node\NodeInterface; use Drupal\node\NodeInterface;
...@@ -151,7 +152,7 @@ function node_test_node_update(NodeInterface $node) { ...@@ -151,7 +152,7 @@ function node_test_node_update(NodeInterface $node) {
/** /**
* Implements hook_entity_view_mode_alter(). * Implements hook_entity_view_mode_alter().
*/ */
function node_test_entity_view_mode_alter(&$view_mode, Drupal\Core\Entity\EntityInterface $entity, $context) { function node_test_entity_view_mode_alter(&$view_mode, EntityInterface $entity, $context) {
// Only alter the view mode if we are on the test callback. // Only alter the view mode if we are on the test callback.
$change_view_mode = \Drupal::state()->get( 'node_test_change_view_mode') ?: ''; $change_view_mode = \Drupal::state()->get( 'node_test_change_view_mode') ?: '';
if ($change_view_mode) { if ($change_view_mode) {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace Drupal\Tests\node\Kernel; namespace Drupal\Tests\node\Kernel;
use Drupal\user\UserInterface;
use Drupal\Core\Field\Entity\BaseFieldOverride; use Drupal\Core\Field\Entity\BaseFieldOverride;
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase; use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
use Drupal\node\Entity\Node; use Drupal\node\Entity\Node;
...@@ -56,7 +57,7 @@ public function testFieldOverrides() { ...@@ -56,7 +57,7 @@ public function testFieldOverrides() {
/** @var \Drupal\node\NodeInterface $node */ /** @var \Drupal\node\NodeInterface $node */
$node = Node::create(['type' => 'ponies']); $node = Node::create(['type' => 'ponies']);