summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2016-04-30 14:11:15 (GMT)
committerAlex Pott2016-04-30 14:11:15 (GMT)
commit6ab5a3aaa140cc982f082104807a4f27cf276b18 (patch)
tree100feecf7586b39aa652a736545ff3de09bd99d1
parent3eeaeb64908b6aeca06dd23e07e9006c88d4fa91 (diff)
Issue #2715741 by Mile23, pfrenssen: Fix 'Drupal.Classes.FullyQualifiedNamespace' coding standard
-rw-r--r--core/includes/common.inc3
-rw-r--r--core/includes/form.inc7
-rw-r--r--core/lib/Drupal/Core/DrupalKernel.php6
-rw-r--r--core/lib/Drupal/Core/PageCache/DefaultRequestPolicy.php6
-rw-r--r--core/modules/aggregator/src/Tests/ItemCacheTagsTest.php3
-rw-r--r--core/modules/big_pipe/src/Tests/BigPipePlaceholderTestCases.php3
-rw-r--r--core/modules/big_pipe/src/Tests/BigPipeTest.php2
-rw-r--r--core/modules/big_pipe/tests/modules/big_pipe_test/src/BigPipeTestController.php3
-rw-r--r--core/modules/big_pipe/tests/src/Unit/Render/Placeholder/BigPipeStrategyTest.php3
-rw-r--r--core/modules/comment/src/Tests/CommentCacheTagsTest.php2
-rw-r--r--core/modules/config/tests/config_install_dependency_test/config_install_dependency_test.module4
-rw-r--r--core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module3
-rw-r--r--core/modules/field/field.module7
-rw-r--r--core/modules/field/tests/fixtures/update/drupal-8.views_entity_reference_plugins-2429191.php5
-rw-r--r--core/modules/field/tests/modules/field_test/field_test.module5
-rw-r--r--core/modules/field/tests/modules/field_third_party_test/field_third_party_test.module7
-rw-r--r--core/modules/filter/tests/src/Kernel/FilterAPITest.php6
-rw-r--r--core/modules/forum/forum.module3
-rw-r--r--core/modules/locale/locale.bulk.inc4
-rw-r--r--core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php2
-rw-r--r--core/modules/node/tests/modules/node_access_test/node_access_test.module3
-rw-r--r--core/modules/node/tests/modules/node_test/node_test.module3
-rw-r--r--core/modules/node/tests/src/Kernel/NodeFieldOverridesTest.php3
-rw-r--r--core/modules/responsive_image/responsive_image.module8
-rw-r--r--core/modules/shortcut/src/Tests/ShortcutCacheTagsTest.php3
-rw-r--r--core/modules/simpletest/src/TestBase.php3
-rw-r--r--core/modules/simpletest/src/WebTestBase.php3
-rw-r--r--core/modules/simpletest/tests/src/Unit/TestInfoParsingTest.php6
-rw-r--r--core/modules/system/src/Tests/Ajax/DialogTest.php3
-rw-r--r--core/modules/system/src/Tests/System/FloodTest.php6
-rw-r--r--core/modules/system/src/Tests/TypedData/TypedDataTest.php36
-rw-r--r--core/modules/system/system.module2
-rw-r--r--core/modules/system/tests/fixtures/update/drupal-8.block-context-manager-2354889.php7
-rw-r--r--core/modules/system/tests/fixtures/update/drupal-8.local-actions-tasks-into-blocks-507488.php3
-rw-r--r--core/modules/system/tests/fixtures/update/drupal-8.page-title-into-block-2476947.php3
-rw-r--r--core/modules/system/tests/fixtures/update/drupal-8.seven-secondary-local-tasks-block-2569529.php3
-rw-r--r--core/modules/system/tests/fixtures/update/drupal-8.site-branding-into-block-2005546.php3
-rw-r--r--core/modules/system/tests/fixtures/update/drupal-8.views-entity-views-data-2455125.php3
-rw-r--r--core/modules/system/tests/fixtures/update/drupal-8.without_automated_cron.php4
-rw-r--r--core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module48
-rw-r--r--core/modules/system/tests/modules/entity_test_operation/entity_test_operation.module3
-rw-r--r--core/modules/system/tests/modules/module_test/src/Controller/ModuleTestController.php4
-rw-r--r--core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php3
-rw-r--r--core/modules/taxonomy/tests/modules/taxonomy_crud/taxonomy_crud.module4
-rw-r--r--core/modules/views/src/Tests/Plugin/DisplayExtenderTest.php3
-rw-r--r--core/modules/views/tests/fixtures/update/argument-placeholder.php7
-rw-r--r--core/modules/views/tests/fixtures/update/duplicate-field-handler.php7
-rw-r--r--core/modules/views/tests/modules/views_test_data/views_test_data.module4
-rw-r--r--core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php21
-rw-r--r--core/modules/views_ui/views_ui.theme.inc6
-rw-r--r--core/phpcs.xml.dist1
-rw-r--r--core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php14
-rw-r--r--core/tests/Drupal/Tests/Core/DrupalKernel/DiscoverServiceProvidersTest.php5
-rw-r--r--core/tests/Drupal/Tests/Core/PageCache/NoSessionOpenTest.php4
-rw-r--r--core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php3
-rw-r--r--core/tests/bootstrap.php4
-rw-r--r--core/themes/bartik/bartik.theme3
57 files changed, 212 insertions, 121 deletions
diff --git a/core/includes/common.inc b/core/includes/common.inc
index 03af03b..feceb5b 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -14,6 +14,7 @@ use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\SortArray;
use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\Cache\Cache;
+use Drupal\Core\Render\Element\Link;
use Drupal\Core\Render\Markup;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\PhpStorage\PhpStorageFactory;
@@ -748,7 +749,7 @@ function drupal_clear_js_cache() {
* Use \Drupal\Core\Render\Element\Link::preRenderLink().
*/
function drupal_pre_render_link($element) {
- return Element\Link::preRenderLink($element);
+ return Link::preRenderLink($element);
}
/**
diff --git a/core/includes/form.inc b/core/includes/form.inc
index c110c5b..06a806b 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -7,6 +7,7 @@
use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\Render\Element;
+use Drupal\Core\Render\Element\RenderElement;
use Drupal\Core\Template\Attribute;
use Drupal\Core\Url;
use Symfony\Component\HttpFoundation\RedirectResponse;
@@ -29,7 +30,7 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
function template_preprocess_select(&$variables) {
$element = $variables['element'];
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['options'] = form_select_options($element);
@@ -191,7 +192,7 @@ function form_get_options($element, $key) {
function template_preprocess_fieldset(&$variables) {
$element = $variables['element'];
Element::setAttributes($element, array('id'));
- Element\RenderElement::setAttributes($element);
+ RenderElement::setAttributes($element);
$variables['attributes'] = isset($element['#attributes']) ? $element['#attributes'] : array();
$variables['prefix'] = isset($element['#field_prefix']) ? $element['#field_prefix'] : NULL;
$variables['suffix'] = isset($element['#field_suffix']) ? $element['#field_suffix'] : NULL;
@@ -376,7 +377,7 @@ function template_preprocess_form(&$variables) {
function template_preprocess_textarea(&$variables) {
$element = $variables['element'];
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['attributes'] = new Attribute($element['#attributes']);
$variables['value'] = $element['#value'];
diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php
index bc693cd..2df00f1 100644
--- a/core/lib/Drupal/Core/DrupalKernel.php
+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -2,6 +2,7 @@
namespace Drupal\Core;
+use Drupal\Component\Assertion\Handle;
use Drupal\Component\FileCache\FileCacheFactory;
use Drupal\Component\Utility\Unicode;
use Drupal\Component\Utility\UrlHelper;
@@ -18,6 +19,7 @@ use Drupal\Core\Http\TrustedHostsRequestFactory;
use Drupal\Core\Language\Language;
use Drupal\Core\Site\Settings;
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
+use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
use Symfony\Component\HttpFoundation\RedirectResponse;
@@ -923,7 +925,7 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
assert_options(ASSERT_ACTIVE, TRUE);
// Now synchronize PHP 5 and 7's handling of assertions as much as
// possible.
- \Drupal\Component\Assertion\Handle::register();
+ Handle::register();
// Log fatal errors to the test site directory.
ini_set('log_errors', 1);
@@ -978,7 +980,7 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
&& Settings::get('class_loader_auto_detect', TRUE)
&& extension_loaded('apc')) {
$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();
$apc_loader->register();
$this->classLoader = $apc_loader;
diff --git a/core/lib/Drupal/Core/PageCache/DefaultRequestPolicy.php b/core/lib/Drupal/Core/PageCache/DefaultRequestPolicy.php
index 731f22f..4616d98 100644
--- a/core/lib/Drupal/Core/PageCache/DefaultRequestPolicy.php
+++ b/core/lib/Drupal/Core/PageCache/DefaultRequestPolicy.php
@@ -2,6 +2,8 @@
namespace Drupal\Core\PageCache;
+use Drupal\Core\PageCache\RequestPolicy\CommandLineOrUnsafeMethod;
+use Drupal\Core\PageCache\RequestPolicy\NoSessionOpen;
use Drupal\Core\Session\SessionConfigurationInterface;
/**
@@ -20,8 +22,8 @@ class DefaultRequestPolicy extends ChainRequestPolicy {
* The session configuration.
*/
public function __construct(SessionConfigurationInterface $session_configuration) {
- $this->addPolicy(new RequestPolicy\CommandLineOrUnsafeMethod());
- $this->addPolicy(new RequestPolicy\NoSessionOpen($session_configuration));
+ $this->addPolicy(new CommandLineOrUnsafeMethod());
+ $this->addPolicy(new NoSessionOpen($session_configuration));
}
}
diff --git a/core/modules/aggregator/src/Tests/ItemCacheTagsTest.php b/core/modules/aggregator/src/Tests/ItemCacheTagsTest.php
index 46a5df7..1986cea 100644
--- a/core/modules/aggregator/src/Tests/ItemCacheTagsTest.php
+++ b/core/modules/aggregator/src/Tests/ItemCacheTagsTest.php
@@ -4,6 +4,7 @@ namespace Drupal\aggregator\Tests;
use Drupal\aggregator\Entity\Feed;
use Drupal\aggregator\Entity\Item;
+use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\system\Tests\Entity\EntityCacheTagsTestBase;
use Drupal\user\Entity\Role;
use Drupal\user\RoleInterface;
@@ -63,7 +64,7 @@ class ItemCacheTagsTest extends EntityCacheTagsTestBase {
*/
public function testEntityCreation() {
// 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.
$this->verifyRenderCache('foo', array('aggregator_feed:1'));
diff --git a/core/modules/big_pipe/src/Tests/BigPipePlaceholderTestCases.php b/core/modules/big_pipe/src/Tests/BigPipePlaceholderTestCases.php
index 4595844..1cf10d4 100644
--- a/core/modules/big_pipe/src/Tests/BigPipePlaceholderTestCases.php
+++ b/core/modules/big_pipe/src/Tests/BigPipePlaceholderTestCases.php
@@ -9,6 +9,7 @@ namespace Drupal\big_pipe\Tests;
use Drupal\big_pipe\Render\BigPipeMarkup;
use Drupal\Core\Session\AccountInterface;
+use Drupal\Core\StringTranslation\PluralTranslatableMarkup;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -93,7 +94,7 @@ class BigPipePlaceholderTestCases {
'theme' => 'classy',
'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' => [
'uid' => '1',
'permissionsHash' => $container->get('user_permissions_hash_generator')->generate($user),
diff --git a/core/modules/big_pipe/src/Tests/BigPipeTest.php b/core/modules/big_pipe/src/Tests/BigPipeTest.php
index 9ae960b..f947c46 100644
--- a/core/modules/big_pipe/src/Tests/BigPipeTest.php
+++ b/core/modules/big_pipe/src/Tests/BigPipeTest.php
@@ -361,7 +361,7 @@ class BigPipeTest extends WebTestBase {
$csrf_token_seed = unserialize(explode('_sf2_meta|', $session_data)[1])['s'];
$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);
}
/**
diff --git a/core/modules/big_pipe/tests/modules/big_pipe_test/src/BigPipeTestController.php b/core/modules/big_pipe/tests/modules/big_pipe_test/src/BigPipeTestController.php
index 2ac5a99..450a464 100644
--- a/core/modules/big_pipe/tests/modules/big_pipe_test/src/BigPipeTestController.php
+++ b/core/modules/big_pipe/tests/modules/big_pipe_test/src/BigPipeTestController.php
@@ -3,6 +3,7 @@
namespace Drupal\big_pipe_test;
use Drupal\big_pipe\Render\BigPipeMarkup;
+use Drupal\big_pipe\Tests\BigPipePlaceholderTestCases;
use Drupal\big_pipe_test\EventSubscriber\BigPipeTestSubscriber;
class BigPipeTestController {
@@ -15,7 +16,7 @@ class BigPipeTestController {
public function test() {
$build = [];
- $cases = \Drupal\big_pipe\Tests\BigPipePlaceholderTestCases::cases(\Drupal::getContainer());
+ $cases = BigPipePlaceholderTestCases::cases(\Drupal::getContainer());
// 1. HTML placeholder: status messages. Drupal renders those automatically,
// so all that we need to do in this controller is set a message.
diff --git a/core/modules/big_pipe/tests/src/Unit/Render/Placeholder/BigPipeStrategyTest.php b/core/modules/big_pipe/tests/src/Unit/Render/Placeholder/BigPipeStrategyTest.php
index 9806fbf..f0f40ba 100644
--- a/core/modules/big_pipe/tests/src/Unit/Render/Placeholder/BigPipeStrategyTest.php
+++ b/core/modules/big_pipe/tests/src/Unit/Render/Placeholder/BigPipeStrategyTest.php
@@ -3,6 +3,7 @@
namespace Drupal\Tests\big_pipe\Unit\Render\Placeholder;
use Drupal\big_pipe\Render\Placeholder\BigPipeStrategy;
+use Drupal\big_pipe\Tests\BigPipePlaceholderTestCases;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Session\SessionConfigurationInterface;
use Drupal\Tests\UnitTestCase;
@@ -61,7 +62,7 @@ class BigPipeStrategyTest extends UnitTestCase {
* @see \Drupal\big_pipe\Tests\BigPipePlaceholderTestCases
*/
public function placeholdersProvider() {
- $cases = \Drupal\big_pipe\Tests\BigPipePlaceholderTestCases::cases();
+ $cases = BigPipePlaceholderTestCases::cases();
// Generate $placeholders variable as expected by
// \Drupal\Core\Render\Placeholder\PlaceholderStrategyInterface::processPlaceholders().
diff --git a/core/modules/comment/src/Tests/CommentCacheTagsTest.php b/core/modules/comment/src/Tests/CommentCacheTagsTest.php
index e0e84c8..3c7ab00 100644
--- a/core/modules/comment/src/Tests/CommentCacheTagsTest.php
+++ b/core/modules/comment/src/Tests/CommentCacheTagsTest.php
@@ -82,7 +82,7 @@ class CommentCacheTagsTest extends EntityWithUriCacheTagsTestBase {
'entity_id' => $this->entityTestCamelid->id(),
'entity_type' => 'entity_test',
'field_name' => 'comment',
- 'status' => \Drupal\comment\CommentInterface::PUBLISHED,
+ 'status' => CommentInterface::PUBLISHED,
));
$comment->save();
diff --git a/core/modules/config/tests/config_install_dependency_test/config_install_dependency_test.module b/core/modules/config/tests/config_install_dependency_test/config_install_dependency_test.module
index 08a1697..fbf11e5 100644
--- a/core/modules/config/tests/config_install_dependency_test/config_install_dependency_test.module
+++ b/core/modules/config/tests/config_install_dependency_test/config_install_dependency_test.module
@@ -5,10 +5,12 @@
* Provides hook implementations for testing purposes.
*/
+use Drupal\Core\Entity\EntityInterface;
+
/**
* 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
// possible during module installation.
$entity->setEnforcedDependencies(['module' => ['config_install_dependency_test']]);
diff --git a/core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module b/core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module
index 0ecfee5..e20dc43 100644
--- a/core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module
+++ b/core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module
@@ -6,13 +6,14 @@
*/
use Drupal\contact\ContactFormInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Form\FormStateInterface;
/**
* 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') {
$fields = array();
diff --git a/core/modules/field/field.module b/core/modules/field/field.module
index 3f50774..5fb3ae3 100644
--- a/core/modules/field/field.module
+++ b/core/modules/field/field.module
@@ -7,6 +7,7 @@
use Drupal\Core\Config\ConfigImporter;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\DynamicallyFieldableEntityStorageInterface;
+use Drupal\field\ConfigImporterFieldPurger;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\field\FieldConfigInterface;
@@ -168,7 +169,7 @@ function field_cron() {
/**
* 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) {
// Query by filtering on the ID as this is more efficient than filtering
// on the entity_type property directly.
@@ -301,7 +302,7 @@ function _field_create_entity_from_ids($ids) {
* Implements hook_config_import_steps_alter().
*/
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()->getChangelist('delete')
);
@@ -327,7 +328,7 @@ function field_form_config_admin_import_form_alter(&$form, FormStateInterface $f
$user_input = $form_state->getUserInput();
$storage_comparer = $form_state->get('storage_comparer');
if ($storage_comparer && empty($user_input)) {
- $field_storages = \Drupal\field\ConfigImporterFieldPurger::getFieldStoragesToPurge(
+ $field_storages = ConfigImporterFieldPurger::getFieldStoragesToPurge(
$storage_comparer->getSourceStorage()->read('core.extension'),
$storage_comparer->getChangelist('delete')
);
diff --git a/core/modules/field/tests/fixtures/update/drupal-8.views_entity_reference_plugins-2429191.php b/core/modules/field/tests/fixtures/update/drupal-8.views_entity_reference_plugins-2429191.php
index ca7c51a..4ad0a77 100644
--- a/core/modules/field/tests/fixtures/update/drupal-8.views_entity_reference_plugins-2429191.php
+++ b/core/modules/field/tests/fixtures/update/drupal-8.views_entity_reference_plugins-2429191.php
@@ -8,6 +8,7 @@
use Drupal\Core\Database\Database;
use Drupal\Component\Serialization\Yaml;
+use Drupal\field\Entity\FieldStorageConfig;
$connection = Database::getConnection();
@@ -59,8 +60,8 @@ $installed = $connection->select('key_value')
->execute()
->fetchField();
$installed = unserialize($installed);
-$installed['field_ref_views_select_2429191'] = new \Drupal\field\Entity\FieldStorageConfig($field_ref_views_select_2429191);
-$installed['field_ref_autocreate_2412569'] = new \Drupal\field\Entity\FieldStorageConfig($field_ref_autocreate_2412569);
+$installed['field_ref_views_select_2429191'] = new FieldStorageConfig($field_ref_views_select_2429191);
+$installed['field_ref_autocreate_2412569'] = new FieldStorageConfig($field_ref_autocreate_2412569);
$connection->update('key_value')
->condition('collection', 'entity.definitions.installed')
->condition('name', 'node.field_storage_definitions')
diff --git a/core/modules/field/tests/modules/field_test/field_test.module b/core/modules/field/tests/modules/field_test/field_test.module
index 9c994d6..7eda288 100644
--- a/core/modules/field/tests/modules/field_test/field_test.module
+++ b/core/modules/field/tests/modules/field_test/field_test.module
@@ -13,8 +13,9 @@
* test helper functions
*/
-use Drupal\field\FieldStorageConfigInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Form\FormStateInterface;
+use Drupal\field\FieldStorageConfigInterface;
require_once __DIR__ . '/field_test.entity.inc';
require_once __DIR__ . '/field_test.field.inc';
@@ -149,7 +150,7 @@ function field_test_entity_extra_field_info_alter(&$info) {
/**
* 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])) {
$fields[$field_name]->setPropertyConstraints('value', [
'Range' => [
diff --git a/core/modules/field/tests/modules/field_third_party_test/field_third_party_test.module b/core/modules/field/tests/modules/field_third_party_test/field_third_party_test.module
index ac0ce1c..9dc2b19 100644
--- a/core/modules/field/tests/modules/field_third_party_test/field_third_party_test.module
+++ b/core/modules/field/tests/modules/field_third_party_test/field_third_party_test.module
@@ -5,12 +5,15 @@
* Test module.
*/
+use Drupal\Core\Field\FieldDefinitionInterface;
+use Drupal\Core\Field\FormatterInterface;
+use Drupal\Core\Field\WidgetInterface;
use Drupal\Core\Form\FormStateInterface;
/**
* 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(
'#type' => 'textfield',
'#title' => t('3rd party widget settings form'),
@@ -30,7 +33,7 @@ function field_third_party_test_field_widget_settings_summary_alter(&$summary, $
/**
* 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(
'#type' => 'textfield',
'#title' => t('3rd party formatter settings form'),
diff --git a/core/modules/filter/tests/src/Kernel/FilterAPITest.php b/core/modules/filter/tests/src/Kernel/FilterAPITest.php
index 49dde8a..0f9feff 100644
--- a/core/modules/filter/tests/src/Kernel/FilterAPITest.php
+++ b/core/modules/filter/tests/src/Kernel/FilterAPITest.php
@@ -207,7 +207,7 @@ class FilterAPITest extends EntityKernelTestBase {
// Test on nonsensical_restricted_html, where the allowed attribute values
// contain asterisks, which do not have any meaning, but which we also
// 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',
'name' => 'Nonsensical Restricted HTML',
'filters' => array(
@@ -468,7 +468,7 @@ class FilterAPITest extends EntityKernelTestBase {
*/
public function testDependencyRemoval() {
$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
// have custom configuration so that the filter plugin is still configured
@@ -498,7 +498,7 @@ class FilterAPITest extends EntityKernelTestBase {
// Verify the filter format still exists but the dependency and filter is
// gone.
\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());
// Use the get method since the FilterFormat::filters() method only returns
// existing plugins.
diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module
index 3722c45..42d5349 100644
--- a/core/modules/forum/forum.module
+++ b/core/modules/forum/forum.module
@@ -8,6 +8,7 @@
use Drupal\comment\CommentInterface;
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Url;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\RouteMatchInterface;
@@ -134,7 +135,7 @@ function forum_uri($forum) {
/**
* 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'])) {
$fields['taxonomy_forums']->addConstraint('ForumLeaf', []);
}
diff --git a/core/modules/locale/locale.bulk.inc b/core/modules/locale/locale.bulk.inc
index 72e8cfe..1181b50 100644
--- a/core/modules/locale/locale.bulk.inc
+++ b/core/modules/locale/locale.bulk.inc
@@ -340,7 +340,7 @@ function locale_translate_batch_refresh(&$context) {
// Clear cache and force refresh of JavaScript translations.
_locale_refresh_translations($context['sandbox']['refresh']['languages'], $next);
// 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'] = $names;
}
@@ -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()) {
$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);
}
}
diff --git a/core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php b/core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php
index ee75658..013a9ea 100644
--- a/core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php
+++ b/core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php
@@ -67,7 +67,7 @@ class LocaleConfigSubscriberTest extends KernelTestBase {
// @see locale_system_update()
locale_system_set_config_langcodes();
$langcodes = array_keys(\Drupal::languageManager()->getLanguages());
- $names = \Drupal\locale\Locale::config()->getComponentNames();
+ $names = Locale::config()->getComponentNames();
Locale::config()->updateConfigTranslations($names, $langcodes);
$this->configFactory = $this->container->get('config.factory');
diff --git a/core/modules/node/tests/modules/node_access_test/node_access_test.module b/core/modules/node/tests/modules/node_access_test/node_access_test.module
index e195ea8..56b53a9 100644
--- a/core/modules/node/tests/modules/node_access_test/node_access_test.module
+++ b/core/modules/node/tests/modules/node_access_test/node_access_test.module
@@ -19,6 +19,7 @@
* @see \Drupal\node\Tests\NodeAccessBaseTableTest
*/
+use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Access\AccessResult;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\field\Entity\FieldConfig;
@@ -144,7 +145,7 @@ function node_access_test_add_field(NodeTypeInterface $type) {
/**
* 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()
->get('node_access_test_secret_catalan') ?: 0;
if ($secret_catalan && $node->language()->getId() == 'ca') {
diff --git a/core/modules/node/tests/modules/node_test/node_test.module b/core/modules/node/tests/modules/node_test/node_test.module
index aa7d4dd..ab1777e 100644
--- a/core/modules/node/tests/modules/node_test/node_test.module
+++ b/core/modules/node/tests/modules/node_test/node_test.module
@@ -8,6 +8,7 @@
* interaction with the Node module.
*/
+use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\node\NodeInterface;
@@ -151,7 +152,7 @@ function node_test_node_update(NodeInterface $node) {
/**
* 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.
$change_view_mode = \Drupal::state()->get( 'node_test_change_view_mode') ?: '';
if ($change_view_mode) {
diff --git a/core/modules/node/tests/src/Kernel/NodeFieldOverridesTest.php b/core/modules/node/tests/src/Kernel/NodeFieldOverridesTest.php
index 2160621..aee0272 100644
--- a/core/modules/node/tests/src/Kernel/NodeFieldOverridesTest.php
+++ b/core/modules/node/tests/src/Kernel/NodeFieldOverridesTest.php
@@ -2,6 +2,7 @@
namespace Drupal\Tests\node\Kernel;
+use Drupal\user\UserInterface;
use Drupal\Core\Field\Entity\BaseFieldOverride;
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
use Drupal\node\Entity\Node;
@@ -56,7 +57,7 @@ class NodeFieldOverridesTest extends EntityKernelTestBase {
/** @var \Drupal\node\NodeInterface $node */
$node = Node::create(['type' => 'ponies']);
$owner = $node->getOwner();
- $this->assertTrue($owner instanceof \Drupal\user\UserInterface);
+ $this->assertTrue($owner instanceof UserInterface);
$this->assertEqual($owner->id(), $this->user->id());
}
diff --git a/core/modules/responsive_image/responsive_image.module b/core/modules/responsive_image/responsive_image.module
index 7df1da8..89ac37f 100644
--- a/core/modules/responsive_image/responsive_image.module
+++ b/core/modules/responsive_image/responsive_image.module
@@ -5,6 +5,8 @@
* Responsive image display formatter for image fields.
*/
+use Drupal\Core\Template\Attribute;
+use Drupal\Core\Logger\RfcLogLevel;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\image\Entity\ImageStyle;
@@ -162,7 +164,7 @@ function template_preprocess_responsive_image(&$variables) {
// execution.
if (!$responsive_image_style) {
$variables['img_element'] = [];
- \Drupal::logger('responsive_image')->log(\Drupal\Core\Logger\RfcLogLevel::ERROR, 'Failed to load responsive image style: “@style“ while displaying responsive image.', ['@style' => $variables['responsive_image_style_id']]);
+ \Drupal::logger('responsive_image')->log(RfcLogLevel::ERROR, 'Failed to load responsive image style: “@style“ while displaying responsive image.', ['@style' => $variables['responsive_image_style_id']]);
return;
}
// Retrieve all breakpoints and multipliers and reverse order of breakpoints.
@@ -411,7 +413,7 @@ function responsive_image_build_source_attributes(ImageInterface $image, array $
}
// Sort the srcset from small to large image width or multiplier.
ksort($srcset);
- $source_attributes = new \Drupal\Core\Template\Attribute(array(
+ $source_attributes = new Attribute(array(
'srcset' => implode(', ', array_unique($srcset)),
));
$media_query = trim($breakpoint->getMediaQuery());
@@ -494,7 +496,7 @@ function _responsive_image_image_style_url($style_name, $path) {
return 'data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
}
$entity = ImageStyle::load($style_name);
- if ($entity instanceof Drupal\image\Entity\ImageStyle) {
+ if ($entity instanceof ImageStyle) {
return file_url_transform_relative($entity->buildUrl($path));
}
return file_url_transform_relative(file_create_url($path));
diff --git a/core/modules/shortcut/src/Tests/ShortcutCacheTagsTest.php b/core/modules/shortcut/src/Tests/ShortcutCacheTagsTest.php
index 8fdd86c..a437ffb 100644
--- a/core/modules/shortcut/src/Tests/ShortcutCacheTagsTest.php
+++ b/core/modules/shortcut/src/Tests/ShortcutCacheTagsTest.php
@@ -2,6 +2,7 @@
namespace Drupal\shortcut\Tests;
+use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\shortcut\Entity\Shortcut;
use Drupal\system\Tests\Entity\EntityCacheTagsTestBase;
use Drupal\user\Entity\Role;
@@ -55,7 +56,7 @@ class ShortcutCacheTagsTest extends EntityCacheTagsTestBase {
public function testEntityCreation() {
// Create a cache entry that is tagged with a shortcut set cache tag.
$cache_tags = ['config:shortcut.set.default'];
- \Drupal::cache('render')->set('foo', 'bar', \Drupal\Core\Cache\CacheBackendInterface::CACHE_PERMANENT, $cache_tags);
+ \Drupal::cache('render')->set('foo', 'bar', CacheBackendInterface::CACHE_PERMANENT, $cache_tags);
// Verify a cache hit.
$this->verifyRenderCache('foo', $cache_tags);
diff --git a/core/modules/simpletest/src/TestBase.php b/core/modules/simpletest/src/TestBase.php
index b6c0868..9bc2c5b 100644
--- a/core/modules/simpletest/src/TestBase.php
+++ b/core/modules/simpletest/src/TestBase.php
@@ -2,6 +2,7 @@
namespace Drupal\simpletest;
+use Drupal\Component\Assertion\Handle;
use Drupal\Component\Render\MarkupInterface;
use Drupal\Component\Utility\Crypt;
use Drupal\Component\Utility\SafeMarkup;
@@ -1019,7 +1020,7 @@ abstract class TestBase {
// Force assertion failures to be thrown as AssertionError for PHP 5 & 7
// compatibility.
- \Drupal\Component\Assertion\Handle::register();
+ Handle::register();
set_error_handler(array($this, 'errorHandler'));
// Iterate through all the methods in this class, unless a specific list of
diff --git a/core/modules/simpletest/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php
index 71ca68e..627df29 100644
--- a/core/modules/simpletest/src/WebTestBase.php
+++ b/core/modules/simpletest/src/WebTestBase.php
@@ -27,6 +27,7 @@ use Drupal\Core\Test\AssertMailTrait;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\Yaml\Yaml as SymfonyYaml;
use Zend\Diactoros\Uri;
/**
@@ -635,7 +636,7 @@ abstract class WebTestBase extends TestBase {
copy($settings_services_file, $directory . '/services.yml');
if ($this->strictConfigSchema) {
// Add a listener to validate configuration schema on save.
- $yaml = new \Symfony\Component\Yaml\Yaml();
+ $yaml = new SymfonyYaml();
$content = file_get_contents($directory . '/services.yml');
$services = $yaml->parse($content);
$services['services']['simpletest.config_schema_checker'] = [
diff --git a/core/modules/simpletest/tests/src/Unit/TestInfoParsingTest.php b/core/modules/simpletest/tests/src/Unit/TestInfoParsingTest.php
index b96ea79..9a69d78 100644
--- a/core/modules/simpletest/tests/src/Unit/TestInfoParsingTest.php
+++ b/core/modules/simpletest/tests/src/Unit/TestInfoParsingTest.php
@@ -25,7 +25,7 @@ class TestInfoParsingTest extends UnitTestCase {
* @dataProvider infoParserProvider
*/
public function testTestInfoParser($expected, $classname, $doc_comment = NULL) {
- $info = \Drupal\simpletest\TestDiscovery::getTestInfo($classname, $doc_comment);
+ $info = TestDiscovery::getTestInfo($classname, $doc_comment);
$this->assertEquals($expected, $info);
}
@@ -245,7 +245,7 @@ class TestInfoParsingTest extends UnitTestCase {
* Bulk delete storages and fields, and clean up afterwards.
*/
EOT;
- \Drupal\simpletest\TestDiscovery::getTestInfo($classname, $doc_comment);
+ TestDiscovery::getTestInfo($classname, $doc_comment);
}
/**
@@ -258,7 +258,7 @@ EOT;
* @group field
*/
EOT;
- $info = \Drupal\simpletest\TestDiscovery::getTestInfo($classname, $doc_comment);
+ $info = TestDiscovery::getTestInfo($classname, $doc_comment);
$this->assertEmpty($info['description']);
}
diff --git a/core/modules/system/src/Tests/Ajax/DialogTest.php b/core/modules/system/src/Tests/Ajax/DialogTest.php
index fdde6d0..80b4650 100644
--- a/core/modules/system/src/Tests/Ajax/DialogTest.php
+++ b/core/modules/system/src/Tests/Ajax/DialogTest.php
@@ -2,6 +2,7 @@
namespace Drupal\system\Tests\Ajax;
+use Drupal\ajax_test\Controller\AjaxTestController;
use Drupal\Core\EventSubscriber\MainContentViewSubscriber;
use Drupal\Core\Form\FormBuilderInterface;
use Drupal\Core\Url;
@@ -29,7 +30,7 @@ class DialogTest extends AjaxTestBase {
$this->drupalGet('ajax-test/dialog');
// Set up variables for this test.
- $dialog_renderable = \Drupal\ajax_test\Controller\AjaxTestController::dialogContents();
+ $dialog_renderable = AjaxTestController::dialogContents();
$dialog_contents = \Drupal::service('renderer')->renderRoot($dialog_renderable);
$modal_expected_response = array(
'command' => 'openDialog',
diff --git a/core/modules/system/src/Tests/System/FloodTest.php b/core/modules/system/src/Tests/System/FloodTest.php
index 59f4852..a3a3368 100644
--- a/core/modules/system/src/Tests/System/FloodTest.php
+++ b/core/modules/system/src/Tests/System/FloodTest.php
@@ -2,6 +2,8 @@
namespace Drupal\system\Tests\System;
+use Drupal\Core\Flood\DatabaseBackend;
+use Drupal\Core\Flood\MemoryBackend;
use Drupal\simpletest\WebTestBase;
use Symfony\Component\HttpFoundation\Request;
@@ -59,7 +61,7 @@ class FloodTest extends WebTestBase {
$name = 'flood_test_cleanup';
$request_stack = \Drupal::service('request_stack');
- $flood = new \Drupal\Core\Flood\MemoryBackend($request_stack);
+ $flood = new MemoryBackend($request_stack);
// Register expired event.
$flood->register($name, $window_expired);
// Verify event is not allowed.
@@ -87,7 +89,7 @@ class FloodTest extends WebTestBase {
$connection = \Drupal::service('database');
$request_stack = \Drupal::service('request_stack');
- $flood = new \Drupal\Core\Flood\DatabaseBackend($connection, $request_stack);
+ $flood = new DatabaseBackend($connection, $request_stack);
// Register expired event.
$flood->register($name, $window_expired);
// Verify event is not allowed.
diff --git a/core/modules/system/src/Tests/TypedData/TypedDataTest.php b/core/modules/system/src/Tests/TypedData/TypedDataTest.php
index 2f22533..9903240 100644
--- a/core/modules/system/src/Tests/TypedData/TypedDataTest.php
+++ b/core/modules/system/src/Tests/TypedData/TypedDataTest.php
@@ -2,14 +2,22 @@
namespace Drupal\system\Tests\TypedData;
+use Drupal\Core\Datetime\DrupalDateTime;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\TypedData\DataDefinition;
use Drupal\Core\TypedData\ListDataDefinition;
use Drupal\Core\TypedData\MapDataDefinition;
+use Drupal\Core\TypedData\Type\BinaryInterface;
+use Drupal\Core\TypedData\Type\BooleanInterface;
+use Drupal\Core\TypedData\Type\DateTimeInterface;
+use Drupal\Core\TypedData\Type\DurationInterface;
+use Drupal\Core\TypedData\Type\FloatInterface;
+use Drupal\Core\TypedData\Type\IntegerInterface;
+use Drupal\Core\TypedData\Type\StringInterface;
+use Drupal\Core\TypedData\Type\UriInterface;
use Drupal\Core\TypedData\TypedDataInterface;
use Drupal\file\Entity\File;
use Drupal\simpletest\KernelTestBase;
-use Drupal\Core\Datetime\DrupalDateTime;
/**
* Tests the functionality of all core data types.
@@ -49,7 +57,7 @@ class TypedDataTest extends KernelTestBase {
$definition = DataDefinition::create($definition['type']);
}
$data = $this->typedDataManager->create($definition, $value, $name);
- $this->assertTrue($data instanceof \Drupal\Core\TypedData\TypedDataInterface, 'Typed data object is an instance of the typed data interface.');
+ $this->assertTrue($data instanceof TypedDataInterface, 'Typed data object is an instance of the typed data interface.');
return $data;
}
@@ -59,7 +67,7 @@ class TypedDataTest extends KernelTestBase {
public function testGetAndSet() {
// Boolean type.
$typed_data = $this->createTypedData(array('type' => 'boolean'), TRUE);
- $this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\BooleanInterface, 'Typed data object is an instance of BooleanInterface.');
+ $this->assertTrue($typed_data instanceof BooleanInterface, 'Typed data object is an instance of BooleanInterface.');
$this->assertTrue($typed_data->getValue() === TRUE, 'Boolean value was fetched.');
$this->assertEqual($typed_data->validate()->count(), 0);
$typed_data->setValue(FALSE);
@@ -75,7 +83,7 @@ class TypedDataTest extends KernelTestBase {
// String type.
$value = $this->randomString();
$typed_data = $this->createTypedData(array('type' => 'string'), $value);
- $this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\StringInterface, 'Typed data object is an instance of StringInterface.');
+ $this->assertTrue($typed_data instanceof StringInterface, 'Typed data object is an instance of StringInterface.');
$this->assertTrue($typed_data->getValue() === $value, 'String value was fetched.');
$this->assertEqual($typed_data->validate()->count(), 0);
$new_value = $this->randomString();
@@ -93,7 +101,7 @@ class TypedDataTest extends KernelTestBase {
// Integer type.
$value = rand();
$typed_data = $this->createTypedData(array('type' => 'integer'), $value);
- $this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\IntegerInterface, 'Typed data object is an instance of IntegerInterface.');
+ $this->assertTrue($typed_data instanceof IntegerInterface, 'Typed data object is an instance of IntegerInterface.');
$this->assertTrue($typed_data->getValue() === $value, 'Integer value was fetched.');
$this->assertEqual($typed_data->validate()->count(), 0);
$new_value = rand();
@@ -110,7 +118,7 @@ class TypedDataTest extends KernelTestBase {
// Float type.
$value = 123.45;
$typed_data = $this->createTypedData(array('type' => 'float'), $value);
- $this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\FloatInterface, 'Typed data object is an instance of FloatInterface.');
+ $this->assertTrue($typed_data instanceof FloatInterface, 'Typed data object is an instance of FloatInterface.');
$this->assertTrue($typed_data->getValue() === $value, 'Float value was fetched.');
$this->assertEqual($typed_data->validate()->count(), 0);
$new_value = 678.90;
@@ -127,7 +135,7 @@ class TypedDataTest extends KernelTestBase {
// Date Time type.
$value = '2014-01-01T20:00:00+00:00';
$typed_data = $this->createTypedData(array('type' => 'datetime_iso8601'), $value);
- $this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\DateTimeInterface, 'Typed data object is an instance of DateTimeInterface.');
+ $this->assertTrue($typed_data instanceof DateTimeInterface, 'Typed data object is an instance of DateTimeInterface.');
$this->assertTrue($typed_data->getValue() == $value, 'Date value was fetched.');
$this->assertEqual($typed_data->getValue(), $typed_data->getDateTime()->format('c'), 'Value representation of a date is ISO 8601');
$this->assertEqual($typed_data->validate()->count(), 0);
@@ -153,7 +161,7 @@ class TypedDataTest extends KernelTestBase {
// Timestamp type.
$value = REQUEST_TIME;
$typed_data = $this->createTypedData(array('type' => 'timestamp'), $value);
- $this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\DateTimeInterface, 'Typed data object is an instance of DateTimeInterface.');
+ $this->assertTrue($typed_data instanceof DateTimeInterface, 'Typed data object is an instance of DateTimeInterface.');
$this->assertTrue($typed_data->getValue() == $value, 'Timestamp value was fetched.');
$this->assertEqual($typed_data->validate()->count(), 0);
$new_value = REQUEST_TIME + 1;
@@ -176,7 +184,7 @@ class TypedDataTest extends KernelTestBase {
// DurationIso8601 type.
$value = 'PT20S';
$typed_data = $this->createTypedData(array('type' => 'duration_iso8601'), $value);
- $this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\DurationInterface, 'Typed data object is an instance of DurationInterface.');
+ $this->assertTrue($typed_data instanceof DurationInterface, 'Typed data object is an instance of DurationInterface.');
$this->assertIdentical($typed_data->getValue(), $value, 'DurationIso8601 value was fetched.');
$this->assertEqual($typed_data->validate()->count(), 0);
$typed_data->setValue('P40D');
@@ -200,7 +208,7 @@ class TypedDataTest extends KernelTestBase {
// Time span type.
$value = 20;
$typed_data = $this->createTypedData(array('type' => 'timespan'), $value);
- $this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\DurationInterface, 'Typed data object is an instance of DurationInterface.');
+ $this->assertTrue($typed_data instanceof DurationInterface, 'Typed data object is an instance of DurationInterface.');
$this->assertIdentical($typed_data->getValue(), $value, 'Time span value was fetched.');
$this->assertEqual($typed_data->validate()->count(), 0);
$typed_data->setValue(60 * 60 * 4);
@@ -223,7 +231,7 @@ class TypedDataTest extends KernelTestBase {
// URI type.
$uri = 'http://example.com/foo/';
$typed_data = $this->createTypedData(array('type' => 'uri'), $uri);
- $this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\UriInterface, 'Typed data object is an instance of UriInterface.');
+ $this->assertTrue($typed_data instanceof UriInterface, 'Typed data object is an instance of UriInterface.');
$this->assertTrue($typed_data->getValue() === $uri, 'URI value was fetched.');
$this->assertEqual($typed_data->validate()->count(), 0);
$typed_data->setValue($uri . 'bar.txt');
@@ -251,7 +259,7 @@ class TypedDataTest extends KernelTestBase {
// Email type.
$value = $this->randomString();
$typed_data = $this->createTypedData(array('type' => 'email'), $value);
- $this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\StringInterface, 'Typed data object is an instance of StringInterface.');
+ $this->assertTrue($typed_data instanceof StringInterface, 'Typed data object is an instance of StringInterface.');
$this->assertIdentical($typed_data->getValue(), $value, 'Email value was fetched.');
$new_value = 'test@example.com';
$typed_data->setValue($new_value);
@@ -266,7 +274,7 @@ class TypedDataTest extends KernelTestBase {
// Binary type.
$typed_data = $this->createTypedData(array('type' => 'binary'), $files[0]->getFileUri());
- $this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\BinaryInterface, 'Typed data object is an instance of BinaryInterface.');
+ $this->assertTrue($typed_data instanceof BinaryInterface, 'Typed data object is an instance of BinaryInterface.');
$this->assertTrue(is_resource($typed_data->getValue()), 'Binary value was fetched.');
$this->assertEqual($typed_data->validate()->count(), 0);
// Try setting by URI.
@@ -441,7 +449,7 @@ class TypedDataTest extends KernelTestBase {
// Test iterating.
$count = 0;
foreach ($typed_data as $item) {
- $this->assertTrue($item instanceof \Drupal\Core\TypedData\TypedDataInterface);
+ $this->assertTrue($item instanceof TypedDataInterface);
$count++;
}
$this->assertEqual($count, 3);
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 3033a11..7872252 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -1254,7 +1254,7 @@ function system_get_module_admin_tasks($module, array $info) {
$access_manager = \Drupal::service('access_manager');
if ($access_manager->checkNamedRoute('user.admin_permissions', array(), \Drupal::currentUser())) {
/** @var \Drupal\Core\Url $url */
- $url = new \Drupal\Core\Url('user.admin_permissions');
+ $url = new Url('user.admin_permissions');
$url->setOption('fragment', 'module-' . $module);
$admin_tasks["user.admin_permissions.$module"] = array(
'title' => t('Configure @module permissions', array('@module' => $info['name'])),
diff --git a/core/modules/system/tests/fixtures/update/drupal-8.block-context-manager-2354889.php b/core/modules/system/tests/fixtures/update/drupal-8.block-context-manager-2354889.php
index 23b67e5..34474bf 100644
--- a/core/modules/system/tests/fixtures/update/drupal-8.block-context-manager-2354889.php
+++ b/core/modules/system/tests/fixtures/update/drupal-8.block-context-manager-2354889.php
@@ -6,19 +6,20 @@
* upgrade path of https://www.drupal.org/node/2354889.
*/
+use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
// A custom block with visibility settings.
-$block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2354889.yml'));
+$block_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2354889.yml'));
// A custom block without any visibility settings.
-$block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.secondtestfor2354889.yml'));
+$block_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/block.block.secondtestfor2354889.yml'));
// A custom block with visibility settings that contain a non-existing context
// mapping.
-$block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.thirdtestfor2354889.yml'));
+$block_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/block.block.thirdtestfor2354889.yml'));
foreach ($block_configs as $block_config) {
$connection->insert('config')
diff --git a/core/modules/system/tests/fixtures/update/drupal-8.local-actions-tasks-into-blocks-507488.php b/core/modules/system/tests/fixtures/update/drupal-8.local-actions-tasks-into-blocks-507488.php
index 986362f..33861a0 100644
--- a/core/modules/system/tests/fixtures/update/drupal-8.local-actions-tasks-into-blocks-507488.php
+++ b/core/modules/system/tests/fixtures/update/drupal-8.local-actions-tasks-into-blocks-507488.php
@@ -6,12 +6,13 @@
* upgrade path of https://www.drupal.org/node/507488.
*/
+use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
// Structure of a custom block with visibility settings.
-$block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor507488.yml'));
+$block_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor507488.yml'));
foreach ($block_configs as $block_config) {
$connection->insert('config')
diff --git a/core/modules/system/tests/fixtures/update/drupal-8.page-title-into-block-2476947.php b/core/modules/system/tests/fixtures/update/drupal-8.page-title-into-block-2476947.php
index ae3e777..b259ccc 100644
--- a/core/modules/system/tests/fixtures/update/drupal-8.page-title-into-block-2476947.php
+++ b/core/modules/system/tests/fixtures/update/drupal-8.page-title-into-block-2476947.php
@@ -6,12 +6,13 @@
* upgrade path of https://www.drupal.org/node/2476947.
*/
+use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
// Structure of a custom block with visibility settings.
-$block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2476947.yml'));
+$block_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2476947.yml'));
foreach ($block_configs as $block_config) {
$connection->insert('config')
diff --git a/core/modules/system/tests/fixtures/update/drupal-8.seven-secondary-local-tasks-block-2569529.php b/core/modules/system/tests/fixtures/update/drupal-8.seven-secondary-local-tasks-block-2569529.php
index 474a085..f19c07c 100644
--- a/core/modules/system/tests/fixtures/update/drupal-8.seven-secondary-local-tasks-block-2569529.php
+++ b/core/modules/system/tests/fixtures/update/drupal-8.seven-secondary-local-tasks-block-2569529.php
@@ -6,12 +6,13 @@
* upgrade path of https://www.drupal.org/node/507488.
*/
+use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
// Structure of a custom block with visibility settings.
-$block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2569529.yml'));
+$block_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2569529.yml'));
foreach ($block_configs as $block_config) {
$connection->insert('config')
diff --git a/core/modules/system/tests/fixtures/update/drupal-8.site-branding-into-block-2005546.php b/core/modules/system/tests/fixtures/update/drupal-8.site-branding-into-block-2005546.php
index 576762d..c632060 100644
--- a/core/modules/system/tests/fixtures/update/drupal-8.site-branding-into-block-2005546.php
+++ b/core/modules/system/tests/fixtures/update/drupal-8.site-branding-into-block-2005546.php
@@ -6,12 +6,13 @@
* upgrade path of https://www.drupal.org/node/2005546.
*/
+use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
// Structure of a custom block with visibility settings.
-$block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2005546.yml'));
+$block_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2005546.yml'));
foreach ($block_configs as $block_config) {
$connection->insert('config')
diff --git a/core/modules/system/tests/fixtures/update/drupal-8.views-entity-views-data-2455125.php b/core/modules/system/tests/fixtures/update/drupal-8.views-entity-views-data-2455125.php
index 2d8da45..fe72370 100644
--- a/core/modules/system/tests/fixtures/update/drupal-8.views-entity-views-data-2455125.php
+++ b/core/modules/system/tests/fixtures/update/drupal-8.views-entity-views-data-2455125.php
@@ -6,6 +6,7 @@
* upgrade path of https://www.drupal.org/node/2455125.
*/
+use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
@@ -13,7 +14,7 @@ $connection = Database::getConnection();
// Structure of a view with timestamp fields.
$views_configs = [];
-$views_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/drupal-8.views-entity-views-data-2455125.yml'));
+$views_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/drupal-8.views-entity-views-data-2455125.yml'));
foreach ($views_configs as $views_config) {
$connection->insert('config')
diff --git a/core/modules/system/tests/fixtures/update/drupal-8.without_automated_cron.php b/core/modules/system/tests/fixtures/update/drupal-8.without_automated_cron.php
index 87b6355..b245f74 100644
--- a/core/modules/system/tests/fixtures/update/drupal-8.without_automated_cron.php
+++ b/core/modules/system/tests/fixtures/update/drupal-8.without_automated_cron.php
@@ -5,7 +5,9 @@
* Test fixture.
*/
-$connection = Drupal\Core\Database\Database::getConnection();
+use Drupal\Core\Database\Database;
+
+$connection = Database::getConnection();
$config = $connection;
$connection->merge('config')
diff --git a/core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module b/core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module
index 3e47088..ecde048 100644
--- a/core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module
+++ b/core/modules/system/tests/modules/ajax_forms_test/ajax_forms_test.module
@@ -5,8 +5,22 @@
* Simpletest mock module for Ajax forms testing.
*/
-use Drupal\Core\Ajax;
+use Drupal\Core\Ajax\AddCssCommand;
+use Drupal\Core\Ajax\AfterCommand;
use Drupal\Core\Ajax\AjaxResponse;
+use Drupal\Core\Ajax\AlertCommand;
+use Drupal\Core\Ajax\AppendCommand;
+use Drupal\Core\Ajax\BeforeCommand;
+use Drupal\Core\Ajax\ChangedCommand;
+use Drupal\Core\Ajax\CssCommand;
+use Drupal\Core\Ajax\DataCommand;
+use Drupal\Core\Ajax\HtmlCommand;
+use Drupal\Core\Ajax\InsertCommand;
+use Drupal\Core\Ajax\InvokeCommand;
+use Drupal\Core\Ajax\PrependCommand;
+use Drupal\Core\Ajax\RemoveCommand;
+use Drupal\Core\Ajax\RestripeCommand;
+use Drupal\Core\Ajax\SettingsCommand;
use Drupal\Core\Form\FormStateInterface;
/**
@@ -16,7 +30,7 @@ function ajax_forms_test_advanced_commands_after_callback($form, FormStateInterf
$selector = '#after_div';
$response = new AjaxResponse();
- $response->addCommand(new Ajax\AfterCommand($selector, "This will be placed after"));
+ $response->addCommand(new AfterCommand($selector, "This will be placed after"));
return $response;
}
@@ -25,7 +39,7 @@ function ajax_forms_test_advanced_commands_after_callback($form, FormStateInterf
*/
function ajax_forms_test_advanced_commands_alert_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
- $response->addCommand(new Ajax\AlertCommand('Alert'));
+ $response->addCommand(new AlertCommand('Alert'));
return $response;
}
@@ -35,7 +49,7 @@ function ajax_forms_test_advanced_commands_alert_callback($form, FormStateInterf
function ajax_forms_test_advanced_commands_append_callback($form, FormStateInterface $form_state) {
$selector = '#append_div';
$response = new AjaxResponse();
- $response->addCommand(new Ajax\AppendCommand($selector, "Appended text"));
+ $response->addCommand(new AppendCommand($selector, "Appended text"));
return $response;
}
@@ -45,7 +59,7 @@ function ajax_forms_test_advanced_commands_append_callback($form, FormStateInter
function ajax_forms_test_advanced_commands_before_callback($form, FormStateInterface $form_state) {
$selector = '#before_div';
$response = new AjaxResponse();
- $response->addCommand(new Ajax\BeforeCommand($selector, "Before text"));
+ $response->addCommand(new BeforeCommand($selector, "Before text"));
return $response;
}
@@ -54,7 +68,7 @@ function ajax_forms_test_advanced_commands_before_callback($form, FormStateInter
*/
function ajax_forms_test_advanced_commands_changed_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
- $response->addCommand(new Ajax\ChangedCommand('#changed_div'));
+ $response->addCommand(new ChangedCommand('#changed_div'));
return $response;
}
@@ -63,7 +77,7 @@ function ajax_forms_test_advanced_commands_changed_callback($form, FormStateInte
*/
function ajax_forms_test_advanced_commands_changed_asterisk_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
- $response->addCommand(new Ajax\ChangedCommand('#changed_div', '#changed_div_mark_this'));
+ $response->addCommand(new ChangedCommand('#changed_div', '#changed_div_mark_this'));
return $response;
}
@@ -75,7 +89,7 @@ function ajax_forms_test_advanced_commands_css_callback($form, FormStateInterfac
$color = 'blue';
$response = new AjaxResponse();
- $response->addCommand(new Ajax\CssCommand($selector, array('background-color' => $color)));
+ $response->addCommand(new CssCommand($selector, array('background-color' => $color)));
return $response;
}
@@ -85,7 +99,7 @@ function ajax_forms_test_advanced_commands_css_callback($form, FormStateInterfac
function ajax_forms_test_advanced_commands_data_callback($form, FormStateInterface $form_state) {
$selector = '#data_div';
$response = new AjaxResponse();
- $response->addCommand(new Ajax\DataCommand($selector, 'testkey', 'testvalue'));
+ $response->addCommand(new DataCommand($selector, 'testkey', 'testvalue'));
return $response;
}
@@ -94,7 +108,7 @@ function ajax_forms_test_advanced_commands_data_callback($form, FormStateInterfa
*/
function ajax_forms_test_advanced_commands_invoke_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
- $response->addCommand(new Ajax\InvokeCommand('#invoke_div', 'addClass', array('error')));
+ $response->addCommand(new InvokeCommand('#invoke_div', 'addClass', array('error')));
return $response;
}
@@ -103,7 +117,7 @@ function ajax_forms_test_advanced_commands_invoke_callback($form, FormStateInter
*/
function ajax_forms_test_advanced_commands_html_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
- $response->addCommand(new Ajax\HtmlCommand('#html_div', 'replacement text'));
+ $response->addCommand(new HtmlCommand('#html_div', 'replacement text'));
return $response;
}
@@ -112,7 +126,7 @@ function ajax_forms_test_advanced_commands_html_callback($form, FormStateInterfa
*/
function ajax_forms_test_advanced_commands_insert_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
- $response->addCommand(new Ajax\InsertCommand('#insert_div', 'insert replacement text'));
+ $response->addCommand(new InsertCommand('#insert_div', 'insert replacement text'));
return $response;
}
@@ -121,7 +135,7 @@ function ajax_forms_test_advanced_commands_insert_callback($form, FormStateInter
*/
function ajax_forms_test_advanced_commands_prepend_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
- $response->addCommand(new Ajax\PrependCommand('#prepend_div', "prepended text"));
+ $response->addCommand(new PrependCommand('#prepend_div', "prepended text"));
return $response;
}
@@ -130,7 +144,7 @@ function ajax_forms_test_advanced_commands_prepend_callback($form, FormStateInte
*/
function ajax_forms_test_advanced_commands_remove_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
- $response->addCommand(new Ajax\RemoveCommand('#remove_text'));
+ $response->addCommand(new RemoveCommand('#remove_text'));
return $response;
}
@@ -139,7 +153,7 @@ function ajax_forms_test_advanced_commands_remove_callback($form, FormStateInter
*/
function ajax_forms_test_advanced_commands_restripe_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
- $response->addCommand(new Ajax\RestripeCommand('#restripe_table'));
+ $response->addCommand(new RestripeCommand('#restripe_table'));
return $response;
}
@@ -149,7 +163,7 @@ function ajax_forms_test_advanced_commands_restripe_callback($form, FormStateInt
function ajax_forms_test_advanced_commands_settings_callback($form, FormStateInterface $form_state) {
$setting['ajax_forms_test']['foo'] = 42;
$response = new AjaxResponse();
- $response->addCommand(new Ajax\SettingsCommand($setting));
+ $response->addCommand(new SettingsCommand($setting));
return $response;
}
@@ -158,7 +172,7 @@ function ajax_forms_test_advanced_commands_settings_callback($form, FormStateInt
*/
function ajax_forms_test_advanced_commands_add_css_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
- $response->addCommand(new Ajax\AddCssCommand('my/file.css'));
+ $response->addCommand(new AddCssCommand('my/file.css'));
return $response;
}
diff --git a/core/modules/system/tests/modules/entity_test_operation/entity_test_operation.module b/core/modules/system/tests/modules/entity_test_operation/entity_test_operation.module
index bdea7ba..2b050ea 100644
--- a/core/modules/system/tests/modules/entity_test_operation/entity_test_operation.module
+++ b/core/modules/system/tests/modules/entity_test_operation/entity_test_operation.module
@@ -5,12 +5,13 @@
* Contains hook implementations for Entity Operation Test Module.
*/
+use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Url;
/**
* Implements hook_entity_operation().
*/
-function entity_test_operation_entity_operation(\Drupal\Core\Entity\EntityInterface $entity) {
+function entity_test_operation_entity_operation(EntityInterface $entity) {
return [
'test' => [
'title' => t('Front page'),
diff --git a/core/modules/system/tests/modules/module_test/src/Controller/ModuleTestController.php b/core/modules/system/tests/modules/module_test/src/Controller/ModuleTestController.php
index 040674f..5bdb22a 100644
--- a/core/modules/system/tests/modules/module_test/src/Controller/ModuleTestController.php
+++ b/core/modules/system/tests/modules/module_test/src/Controller/ModuleTestController.php
@@ -2,6 +2,8 @@
namespace Drupal\module_test\Controller;
+use Drupal\module_autoload_test\SomeClass;
+
/**
* Controller routines for module_test routes.
*/
@@ -38,7 +40,7 @@ class ModuleTestController {
public function testClassLoading() {
$markup = NULL;
if (class_exists('Drupal\module_autoload_test\SomeClass')) {
- $obj = new \Drupal\module_autoload_test\SomeClass();
+ $obj = new SomeClass();
$markup = $obj->testMethod();
}
return ['#markup' => $markup];
diff --git a/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php b/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php
index d691beb..9beac7a 100644
--- a/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php
+++ b/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php
@@ -2,6 +2,7 @@
namespace Drupal\Tests\system\Kernel\Extension;
+use Drupal\Core\Extension\MissingDependencyException;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use \Drupal\Core\Extension\ModuleUninstallValidatorException;
use Drupal\entity_test\Entity\EntityTest;
@@ -121,7 +122,7 @@ class ModuleHandlerTest extends KernelTestBase {
$result = $this->moduleInstaller()->install(array('color'));
$this->fail(t('ModuleInstaller::install() throws an exception if dependencies are missing.'));
}
- catch (\Drupal\Core\Extension\MissingDependencyException $e) {
+ catch (MissingDependencyException $e) {
$this->pass(t('ModuleInstaller::install() throws an exception if dependencies are missing.'));
}
diff --git a/core/modules/taxonomy/tests/modules/taxonomy_crud/taxonomy_crud.module b/core/modules/taxonomy/tests/modules/taxonomy_crud/taxonomy_crud.module
index 442ca09..dbe8781 100644
--- a/core/modules/taxonomy/tests/modules/taxonomy_crud/taxonomy_crud.module
+++ b/core/modules/taxonomy/tests/modules/taxonomy_crud/taxonomy_crud.module
@@ -5,9 +5,11 @@
* Provides hook implementations for testing purposes.
*/
+use Drupal\taxonomy\VocabularyInterface;
+
/**
* Implements hook_ENTITY_TYPE_presave() for taxonomy_vocabulary entities.
*/
-function taxonomy_crud_taxonomy_vocabulary_presave(\Drupal\taxonomy\VocabularyInterface $vocabulary) {
+function taxonomy_crud_taxonomy_vocabulary_presave(VocabularyInterface $vocabulary) {
$vocabulary->setThirdPartySetting('taxonomy_crud', 'foo', 'bar');
}
diff --git a/core/modules/views/src/Tests/Plugin/DisplayExtenderTest.php b/core/modules/views/src/Tests/Plugin/DisplayExtenderTest.php
index 844143a..33c3713 100644
--- a/core/modules/views/src/Tests/Plugin/DisplayExtenderTest.php
+++ b/core/modules/views/src/Tests/Plugin/DisplayExtenderTest.php
@@ -2,6 +2,7 @@
namespace Drupal\views\Tests\Plugin;
+use Drupal\views_test_data\Plugin\views\display_extender\DisplayExtenderTest as DisplayExtenderTestData;
use Drupal\views\Views;
/**
@@ -38,7 +39,7 @@ class DisplayExtenderTest extends PluginTestBase {
$this->assertEqual(count($view->display_handler->getExtenders()), 1, 'Make sure that only one extender is initialized.');
$display_extender = $view->display_handler->getExtenders()['display_extender_test'];
- $this->assertTrue($display_extender instanceof \Drupal\views_test_data\Plugin\views\display_extender\DisplayExtenderTest, 'Make sure the right class got initialized.');
+ $this->assertTrue($display_extender instanceof DisplayExtenderTestData, 'Make sure the right class got initialized.');
$view->preExecute();
$this->assertTrue($display_extender->testState['preExecute'], 'Make sure the display extender was able to react on preExecute.');
diff --git a/core/modules/views/tests/fixtures/update/argument-placeholder.php b/core/modules/views/tests/fixtures/update/argument-placeholder.php
index 525299c..03181bb 100644
--- a/core/modules/views/tests/fixtures/update/argument-placeholder.php
+++ b/core/modules/views/tests/fixtures/update/argument-placeholder.php
@@ -5,12 +5,15 @@
* Text fixture.
*/
-$connection = Drupal\Core\Database\Database::getConnection();
+use Drupal\Component\Serialization\Yaml;
+use Drupal\Core\Database\Database;
+
+$connection = Database::getConnection();
$connection->insert('config')
->fields(array(
'collection' => '',
'name' => 'views.view.test_token_view',
- 'data' => serialize(\Drupal\Component\Serialization\Yaml::decode(file_get_contents('core/modules/views/tests/modules/views_test_config/test_views/views.view.test_token_view.yml'))),
+ 'data' => serialize(Yaml::decode(file_get_contents('core/modules/views/tests/modules/views_test_config/test_views/views.view.test_token_view.yml'))),
))
->execute();
diff --git a/core/modules/views/tests/fixtures/update/duplicate-field-handler.php b/core/modules/views/tests/fixtures/update/duplicate-field-handler.php
index 69aa8e8..32e74fb 100644
--- a/core/modules/views/tests/fixtures/update/duplicate-field-handler.php
+++ b/core/modules/views/tests/fixtures/update/duplicate-field-handler.php
@@ -5,12 +5,15 @@
* Test fixture.
*/
-$connection = Drupal\Core\Database\Database::getConnection();
+use Drupal\Component\Serialization\Yaml;
+use Drupal\Core\Database\Database;
+
+$connection = Database::getConnection();
$connection->insert('config')
->fields(array(
'collection' => '',
'name' => 'views.view.test_duplicate_field_handlers',
- 'data' => serialize(\Drupal\Component\Serialization\Yaml::decode(file_get_contents('core/modules/views/tests/modules/views_test_config/test_views/views.view.test_duplicate_field_handlers.yml'))),
+ 'data' => serialize(Yaml::decode(file_get_contents('core/modules/views/tests/modules/views_test_config/test_views/views.view.test_duplicate_field_handlers.yml'))),
))
->execute();
diff --git a/core/modules/views/tests/modules/views_test_data/views_test_data.module b/core/modules/views/tests/modules/views_test_data/views_test_data.module
index f041651d..bd917c7 100644
--- a/core/modules/views/tests/modules/views_test_data/views_test_data.module
+++ b/core/modules/views/tests/modules/views_test_data/views_test_data.module
@@ -5,6 +5,8 @@
* Helper module for Views tests.
*/
+use Drupal\Core\Form\FormStateInterface;
+
/**
* Access callback for the generic handler test.
*
@@ -126,6 +128,6 @@ function views_test_data_test_pre_render_function($element) {
/**
* Implements hook_form_BASE_FORM_ID_alter().
*/
-function views_test_data_form_views_form_test_form_multiple_default_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
+function views_test_data_form_views_form_test_form_multiple_default_alter(&$form, FormStateInterface $form_state, $form_id) {
drupal_set_message(t('Test base form ID with Views forms and arguments.'));
}
diff --git a/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php b/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php
index 58344bf..93bd049 100644
--- a/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php
+++ b/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php
@@ -3,17 +3,20 @@
namespace Drupal\views_ui\Form\Ajax;
use Drupal\Component\Utility\Html;
+use Drupal\Core\Ajax\AjaxResponse;
+use Drupal\Core\Ajax\CloseModalDialogCommand;
use Drupal\Core\Ajax\OpenModalDialogCommand;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormState;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\BubbleableMetadata;
use Drupal\Core\Render\RenderContext;
+use Drupal\views\Ajax\HighlightCommand;
+use Drupal\views\Ajax\ReplaceTitleCommand;
+use Drupal\views\Ajax\ShowButtonsCommand;
+use Drupal\views\Ajax\TriggerPreviewCommand;
use Drupal\views\ViewEntityInterface;
-use Drupal\views\Ajax;
-use Drupal\views_ui\Ajax as AjaxUI;
-use Drupal\Core\Ajax\AjaxResponse;
-use Drupal\Core\Ajax\CloseModalDialogCommand;
+use Drupal\views_ui\Ajax\SetFormCommand;
use Symfony\Component\HttpFoundation\RedirectResponse;
/**
@@ -151,10 +154,10 @@ abstract class ViewsFormBase extends FormBase implements ViewsFormInterface {
else {
$response = new AjaxResponse();
$response->addCommand(new CloseModalDialogCommand());
- $response->addCommand(new Ajax\ShowButtonsCommand(!empty($view->changed)));
- $response->addCommand(new Ajax\TriggerPreviewCommand());
+ $response->addCommand(new ShowButtonsCommand(!empty($view->changed)));
+ $response->addCommand(new TriggerPreviewCommand());
if ($page_title = $form_state->get('page_title')) {
- $response->addCommand(new Ajax\ReplaceTitleCommand($page_title));
+ $response->addCommand(new ReplaceTitleCommand($page_title));
}
}
// If this form was for view-wide changes, there's no need to regenerate
@@ -248,10 +251,10 @@ abstract class ViewsFormBase extends FormBase implements ViewsFormInterface {
// Usually this happens at the same path, but custom paths may be
// specified in $form_state.
$form_url = $form_state->has('url') ? $form_state->get('url')->toString() : $this->url('<current>');
- $response->addCommand(new AjaxUI\SetFormCommand($form_url));
+ $response->addCommand(new SetFormCommand($form_url));
if ($section = $form_state->get('#section')) {
- $response->addCommand(new Ajax\HighlightCommand('.' . Html::cleanCssIdentifier($section)));
+ $response->addCommand(new HighlightCommand('.' . Html::cleanCssIdentifier($section)));
}
return $response;
diff --git a/core/modules/views_ui/views_ui.theme.inc b/core/modules/views_ui/views_ui.theme.inc
index f9b165a..3b58678 100644
--- a/core/modules/views_ui/views_ui.theme.inc
+++ b/core/modules/views_ui/views_ui.theme.inc
@@ -8,6 +8,8 @@
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Form\FormState;
use Drupal\Core\Render\Element;
+use Drupal\Core\Render\Element\Checkboxes;
+use Drupal\Core\Render\Element\Radios;
use Drupal\Core\Url;
/**
@@ -88,8 +90,8 @@ function template_preprocess_views_ui_build_group_filter_form(&$variables) {
// Prepare default selectors.
$form_state = new FormState();
- $form['default_group'] = Element\Radios::processRadios($form['default_group'], $form_state, $form);
- $form['default_group_multiple'] = Element\Checkboxes::processCheckboxes($form['default_group_multiple'], $form_state, $form);
+ $form['default_group'] = Radios::processRadios($form['default_group'], $form_state, $form);
+ $form['default_group_multiple'] = Checkboxes::processCheckboxes($form['default_group_multiple'], $form_state, $form);
$form['default_group']['All']['#title'] = '';
$rows[] = array(
diff --git a/core/phpcs.xml.dist b/core/phpcs.xml.dist
index 9a5581c..975c31f 100644
--- a/core/phpcs.xml.dist
+++ b/core/phpcs.xml.dist
@@ -13,6 +13,7 @@
<!-- Only include specific sniffs that pass. This ensures that, if new sniffs are added, HEAD does not fail.-->
<!-- Drupal sniffs -->
<rule ref="Drupal.Classes.ClassCreateInstance"/>
+ <rule ref="Drupal.Classes.FullyQualifiedNamespace"/>
<rule ref="Drupal.Classes.UnusedUseStatement"/>
<rule ref="Drupal.CSS.ClassDefinitionNameSpacing"/>
<rule ref="Drupal.CSS.ColourDefinition"/>
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php
index ec3f87a..8532014 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php
@@ -3,12 +3,16 @@
namespace Drupal\KernelTests\Core\Entity;
use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Entity\TypedData\EntityDataDefinition;
+use Drupal\Core\Entity\TypedData\EntityDataDefinitionInterface;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Field\FieldDefinitionInterface;
-use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\FieldItemInterface;
+use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\TypedData\ComplexDataDefinitionInterface;
+use Drupal\Core\TypedData\ComplexDataInterface;
use Drupal\Core\TypedData\DataDefinitionInterface;
+use Drupal\Core\TypedData\ListInterface;
use Drupal\Core\TypedData\Type\StringInterface;
use Drupal\Core\TypedData\TypedDataInterface;
use Drupal\node\Entity\Node;
@@ -420,7 +424,7 @@ class EntityFieldTest extends EntityKernelTestBase {
$this->assertEqual($value_definition->getDataType(), 'string');
// Test deriving metadata from references.
- $entity_definition = \Drupal\Core\Entity\TypedData\EntityDataDefinition::create($entity_type);
+ $entity_definition = EntityDataDefinition::create($entity_type);
$langcode_key = $this->entityManager->getDefinition($entity_type)->getKey('langcode');
$reference_definition = $entity_definition->getPropertyDefinition($langcode_key)
->getPropertyDefinition('language')
@@ -431,7 +435,7 @@ class EntityFieldTest extends EntityKernelTestBase {
->getPropertyDefinition('entity')
->getTargetDefinition();
- $this->assertTrue($reference_definition instanceof \Drupal\Core\Entity\TypedData\EntityDataDefinitionInterface, 'Definition of the referenced user retrieved.');
+ $this->assertTrue($reference_definition instanceof EntityDataDefinitionInterface, 'Definition of the referenced user retrieved.');
$this->assertEqual($reference_definition->getEntityTypeId(), 'user', 'Referenced entity is of type "user".');
// Test propagating down.
@@ -583,12 +587,12 @@ class EntityFieldTest extends EntityKernelTestBase {
// Recurse until a certain depth is reached if possible.
if ($depth < 7) {
- if ($wrapper instanceof \Drupal\Core\TypedData\ListInterface) {
+ if ($wrapper instanceof ListInterface) {
foreach ($wrapper as $item) {
$this->getContainedStrings($item, $depth + 1, $strings);
}
}
- elseif ($wrapper instanceof \Drupal\Core\TypedData\ComplexDataInterface) {
+ elseif ($wrapper instanceof ComplexDataInterface) {
foreach ($wrapper as $property) {
$this->getContainedStrings($property, $depth + 1, $strings);
}
diff --git a/core/tests/Drupal/Tests/Core/DrupalKernel/DiscoverServiceProvidersTest.php b/core/tests/Drupal/Tests/Core/DrupalKernel/DiscoverServiceProvidersTest.php
index be04507..164da9d 100644
--- a/core/tests/Drupal/Tests/Core/DrupalKernel/DiscoverServiceProvidersTest.php
+++ b/core/tests/Drupal/Tests/Core/DrupalKernel/DiscoverServiceProvidersTest.php
@@ -2,6 +2,7 @@
namespace Drupal\Tests\Core\DrupalKernel;
+use Composer\Autoload\ClassLoader;
use Drupal\Core\DrupalKernel;
use Drupal\Core\Site\Settings;
use Drupal\Tests\UnitTestCase;
@@ -24,7 +25,7 @@ class DiscoverServiceProvidersTest extends UnitTestCase {
),
));
- $kernel = new DrupalKernel('prod', new \Composer\Autoload\ClassLoader());
+ $kernel = new DrupalKernel('prod', new ClassLoader());
$kernel->discoverServiceProviders();
$expect = array(
@@ -44,7 +45,7 @@ class DiscoverServiceProvidersTest extends UnitTestCase {
*/
public function testDiscoverServiceNoContainerYamls() {
new Settings([]);
- $kernel = new DrupalKernel('prod', new \Composer\Autoload\ClassLoader());
+ $kernel = new DrupalKernel('prod', new ClassLoader());
$kernel->discoverServiceProviders();
$expect = [
diff --git a/core/tests/Drupal/Tests/Core/PageCache/NoSessionOpenTest.php b/core/tests/Drupal/Tests/Core/PageCache/NoSessionOpenTest.php
index 1af6afb..aa1f5d7 100644
--- a/core/tests/Drupal/Tests/Core/PageCache/NoSessionOpenTest.php
+++ b/core/tests/Drupal/Tests/Core/PageCache/NoSessionOpenTest.php
@@ -2,8 +2,8 @@
namespace Drupal\Tests\Core\PageCache;
+use Drupal\Core\PageCache\RequestPolicy\NoSessionOpen;
use Drupal\Core\PageCache\RequestPolicyInterface;
-use Drupal\Core\PageCache\RequestPolicy;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\HttpFoundation\Request;
@@ -29,7 +29,7 @@ class NoSessionOpenTest extends UnitTestCase {
protected function setUp() {
$this->sessionConfiguration = $this->getMock('Drupal\Core\Session\SessionConfigurationInterface');
- $this->policy = new RequestPolicy\NoSessionOpen($this->sessionConfiguration);
+ $this->policy = new NoSessionOpen($this->sessionConfiguration);
}
/**
diff --git a/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php b/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php
index ded278e..ebafab0 100644
--- a/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php
+++ b/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php
@@ -2,6 +2,7 @@
namespace Drupal\Tests\Core\ParamConverter;
+use Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException;
use Drupal\Core\ParamConverter\EntityConverter;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\Routing\Route;
@@ -116,7 +117,7 @@ class EntityConverterTest extends UnitTestCase {
$this->entityManager->expects($this->once())
->method('getStorage')
->with('invalid_id')
- ->willThrowException(new \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException('invalid_id'));
+ ->willThrowException(new InvalidPluginDefinitionException('invalid_id'));
$this->entityConverter->convert('id', ['type' => 'entity:invalid_id'], 'foo', ['foo' => 'id']);
}
diff --git a/core/tests/bootstrap.php b/core/tests/bootstrap.php
index ad02e5f..49e350a 100644
--- a/core/tests/bootstrap.php
+++ b/core/tests/bootstrap.php
@@ -7,6 +7,8 @@
* @see phpunit.xml.dist
*/
+use Drupal\Component\Assertion\Handle;
+
/**
* Finds all valid extension directories recursively within a given directory.
*
@@ -141,4 +143,4 @@ date_default_timezone_set('Australia/Sydney');
// runtime assertions. By default this setting is on. Here we make a call to
// make PHP 5 and 7 handle assertion failures the same way, but this call does
// not turn runtime assertions on if they weren't on already.
-\Drupal\Component\Assertion\Handle::register();
+Handle::register();
diff --git a/core/themes/bartik/bartik.theme b/core/themes/bartik/bartik.theme
index 3d3ca12..b1b3308 100644
--- a/core/themes/bartik/bartik.theme
+++ b/core/themes/bartik/bartik.theme
@@ -5,6 +5,7 @@
* Functions to support theming in the Bartik theme.
*/
+use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Template\Attribute;
/**
@@ -113,7 +114,7 @@ function bartik_theme_suggestions_form_alter(array &$suggestions, array $variabl
/**
* Implements hook_form_alter() to add classes to the search form.
*/
-function bartik_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
+function bartik_form_alter(&$form, FormStateInterface $form_state, $form_id) {
if (in_array($form_id, ['search_block_form', 'search_form'])) {
$key = ($form_id == 'search_block_form') ? 'actions' : 'basic';
if (!isset($form[$key]['submit']['#attributes'])) {