diff --git a/core/includes/common.inc b/core/includes/common.inc index cb67276..c2c204e 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -8,8 +8,10 @@ * a cached page are instead located in bootstrap.inc. */ +use Drupal\Component\Serialization\Json; use Drupal\Component\Utility\Bytes; use Drupal\Component\Utility\Html; +use Drupal\Component\Utility\SortArray; use Drupal\Component\Utility\UrlHelper; use Drupal\Core\Cache\Cache; use Drupal\Core\Render\Markup; @@ -575,7 +577,7 @@ function drupal_process_states(&$elements) { // element available, setting #attributes does not make sense, but a wrapper // is available, so setting #wrapper_attributes makes it work. $key = ($elements['#type'] == 'item') ? '#wrapper_attributes' : '#attributes'; - $elements[$key]['data-drupal-states'] = JSON::encode($elements['#states']); + $elements[$key]['data-drupal-states'] = Json::encode($elements['#states']); } /** @@ -1268,7 +1270,7 @@ function drupal_get_updaters() { if (!isset($updaters)) { $updaters = \Drupal::moduleHandler()->invokeAll('updater_info'); \Drupal::moduleHandler()->alter('updater_info', $updaters); - uasort($updaters, array('Drupal\Component\Utility\SortArray', 'sortByWeightElement')); + uasort($updaters, array(SortArray::class, 'sortByWeightElement')); } return $updaters; } @@ -1288,7 +1290,7 @@ function drupal_get_filetransfer_info() { if (!isset($info)) { $info = \Drupal::moduleHandler()->invokeAll('filetransfer_info'); \Drupal::moduleHandler()->alter('filetransfer_info', $info); - uasort($info, array('Drupal\Component\Utility\SortArray', 'sortByWeightElement')); + uasort($info, array(SortArray::class, 'sortByWeightElement')); } return $info; } diff --git a/core/lib/Drupal/Core/Field/BaseFieldDefinition.php b/core/lib/Drupal/Core/Field/BaseFieldDefinition.php index fb05607..37eaefc 100644 --- a/core/lib/Drupal/Core/Field/BaseFieldDefinition.php +++ b/core/lib/Drupal/Core/Field/BaseFieldDefinition.php @@ -12,6 +12,7 @@ use Drupal\Core\Field\Entity\BaseFieldOverride; use Drupal\Core\Field\TypedData\FieldItemDataDefinition; use Drupal\Core\TypedData\ListDataDefinition; +use Drupal\Core\TypedData\OptionsProviderInterface; /** * A class for defining entity fields. @@ -514,7 +515,7 @@ public function getOptionsProvider($property_name, FieldableEntityInterface $ent // If the field item class implements the interface, create an orphaned // runtime item object, so that it can be used as the options provider // without modifying the entity being worked on. - if (is_subclass_of($this->getFieldItemClass(), '\Drupal\Core\TypedData\OptionsProviderInterface')) { + if (is_subclass_of($this->getFieldItemClass(), OptionsProviderInterface::class)) { $items = $entity->get($this->getName()); return \Drupal::service('plugin.manager.field.field_type')->createFieldItem($items, 0); } diff --git a/core/modules/comment/src/Tests/CommentDefaultFormatterCacheTagsTest.php b/core/modules/comment/src/Tests/CommentDefaultFormatterCacheTagsTest.php index fd8efd7..50882d9 100644 --- a/core/modules/comment/src/Tests/CommentDefaultFormatterCacheTagsTest.php +++ b/core/modules/comment/src/Tests/CommentDefaultFormatterCacheTagsTest.php @@ -43,7 +43,7 @@ protected function setUp() { $request = Request::create('/'); $request->setSession($session); - /** @var RequestStack $stack */ + /** @var \Symfony\Component\HttpFoundation\RequestStack $stack */ $stack = $this->container->get('request_stack'); $stack->pop(); $stack->push($request); diff --git a/core/modules/config/src/Tests/CacheabilityMetadataConfigOverrideTest.php b/core/modules/config/src/Tests/CacheabilityMetadataConfigOverrideTest.php index 718911e..58d6d55 100644 --- a/core/modules/config/src/Tests/CacheabilityMetadataConfigOverrideTest.php +++ b/core/modules/config/src/Tests/CacheabilityMetadataConfigOverrideTest.php @@ -67,7 +67,7 @@ public function testConfigEntityOverride() { // Load the User login block and check that its cacheability metadata is // overridden correctly. This verifies that the metadata is correctly // applied to config entities. - /** @var EntityManagerInterface $entity_manager */ + /** @var \Drupal\Core\Entity\EntityManagerInterface $entity_manager */ $entity_manager = $this->container->get('entity.manager'); $block = $entity_manager->getStorage('block')->load('call_to_action'); diff --git a/core/modules/content_translation/src/Tests/ContentTranslationContextualLinksTest.php b/core/modules/content_translation/src/Tests/ContentTranslationContextualLinksTest.php index 301a78d..02b4ced 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationContextualLinksTest.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationContextualLinksTest.php @@ -30,7 +30,7 @@ class ContentTranslationContextualLinksTest extends WebTestBase { /** * The content type being tested. * - * @var NodeType + * @var \Drupal\node\Entity\NodeType */ protected $contentType; diff --git a/core/modules/field/src/Entity/FieldStorageConfig.php b/core/modules/field/src/Entity/FieldStorageConfig.php index d074f39..a2117f8 100644 --- a/core/modules/field/src/Entity/FieldStorageConfig.php +++ b/core/modules/field/src/Entity/FieldStorageConfig.php @@ -13,8 +13,8 @@ use Drupal\Core\Entity\FieldableEntityInterface; use Drupal\Core\Field\FieldException; use Drupal\Core\Field\FieldStorageDefinitionInterface; +use Drupal\Core\TypedData\OptionsProviderInterface; use Drupal\field\FieldStorageConfigInterface; -use Drupal\field\Entity\FieldStorageConfig; /** * Defines the Field storage configuration entity. @@ -649,7 +649,7 @@ public function getOptionsProvider($property_name, FieldableEntityInterface $ent // If the field item class implements the interface, create an orphaned // runtime item object, so that it can be used as the options provider // without modifying the entity being worked on. - if (is_subclass_of($this->getFieldItemClass(), '\Drupal\Core\TypedData\OptionsProviderInterface')) { + if (is_subclass_of($this->getFieldItemClass(), OptionsProviderInterface::class)) { $items = $entity->get($this->getName()); return \Drupal::service('plugin.manager.field.field_type')->createFieldItem($items, 0); } diff --git a/core/modules/field/src/Tests/FormatterPluginManagerTest.php b/core/modules/field/src/Tests/FormatterPluginManagerTest.php index d3c3d40..9e99a3a 100644 --- a/core/modules/field/src/Tests/FormatterPluginManagerTest.php +++ b/core/modules/field/src/Tests/FormatterPluginManagerTest.php @@ -21,7 +21,7 @@ class FormatterPluginManagerTest extends FieldUnitTestBase { * @see \Drupal\field\Tests\WidgetPluginManagerTest::testNotApplicableFallback() */ public function testNotApplicableFallback() { - /** @var FormatterPluginManager $formatter_plugin_manager */ + /** @var \Drupal\Core\Field\FormatterPluginManager $formatter_plugin_manager */ $formatter_plugin_manager = \Drupal::service('plugin.manager.field.formatter'); $base_field_definition = BaseFieldDefinition::create('test_field') diff --git a/core/modules/field/src/Tests/WidgetPluginManagerTest.php b/core/modules/field/src/Tests/WidgetPluginManagerTest.php index 3400565..dddf603 100644 --- a/core/modules/field/src/Tests/WidgetPluginManagerTest.php +++ b/core/modules/field/src/Tests/WidgetPluginManagerTest.php @@ -31,7 +31,7 @@ function testWidgetDefinitionAlter() { * @see \Drupal\field\Tests\FormatterPluginManagerTest::testNotApplicableFallback() */ public function testNotApplicableFallback() { - /** @var WidgetPluginManager $widget_plugin_manager */ + /** @var \Drupal\Core\Field\WidgetPluginManager $widget_plugin_manager */ $widget_plugin_manager = \Drupal::service('plugin.manager.field.widget'); $base_field_definition = BaseFieldDefinition::create('test_field') diff --git a/core/modules/language/src/Element/LanguageConfiguration.php b/core/modules/language/src/Element/LanguageConfiguration.php index c7f21ef..74d36aa 100644 --- a/core/modules/language/src/Element/LanguageConfiguration.php +++ b/core/modules/language/src/Element/LanguageConfiguration.php @@ -40,7 +40,7 @@ public static function processLanguageConfiguration(&$element, FormStateInterfac // Avoid validation failure since we are moving the '#options' key in the // nested 'language' select element. unset($element['#options']); - /** @var ContentLanguageSettings $default_config */ + /** @var \Drupal\language\Entity\ContentLanguageSettings $default_config */ $default_config = $element['#default_value']; $element['langcode'] = array( '#type' => 'select', diff --git a/core/modules/locale/locale.bulk.inc b/core/modules/locale/locale.bulk.inc index d3e3b79..1668003 100644 --- a/core/modules/locale/locale.bulk.inc +++ b/core/modules/locale/locale.bulk.inc @@ -7,6 +7,7 @@ use Drupal\Core\Language\LanguageInterface; use Drupal\file\FileInterface; +use Drupal\locale\Gettext; use Drupal\locale\Locale; /** @@ -207,7 +208,7 @@ function locale_translate_batch_import($file, array $options, array &$context) { // Update the seek and the number of items in the $options array(). $options['seek'] = $context['sandbox']['parse_state']['seek']; $options['items'] = $context['sandbox']['parse_state']['chunk_size']; - $report = GetText::fileToDatabase($file, $options); + $report = Gettext::fileToDatabase($file, $options); // If not yet finished with reading, mark progress based on size and // position. if ($report['seek'] < filesize($file->uri)) { diff --git a/core/modules/locale/src/Tests/LocaleConfigTranslationTest.php b/core/modules/locale/src/Tests/LocaleConfigTranslationTest.php index d3d8fda..271d804 100644 --- a/core/modules/locale/src/Tests/LocaleConfigTranslationTest.php +++ b/core/modules/locale/src/Tests/LocaleConfigTranslationTest.php @@ -8,6 +8,7 @@ namespace Drupal\locale\Tests; use Drupal\simpletest\WebTestBase; +use Drupal\Core\Language\LanguageInterface; /** * Tests translation of configuration strings. diff --git a/core/modules/migrate/src/Tests/MigrateEmbeddedDataTest.php b/core/modules/migrate/src/Tests/MigrateEmbeddedDataTest.php index e11ed1f..aa003df 100644 --- a/core/modules/migrate/src/Tests/MigrateEmbeddedDataTest.php +++ b/core/modules/migrate/src/Tests/MigrateEmbeddedDataTest.php @@ -50,7 +50,7 @@ public function testEmbeddedData() { // Validate the plugin returns the source data that was provided. $results = []; - /** @var Row $row */ + /** @var \Drupal\migrate\Row $row */ foreach ($source as $row) { $data_row = $row->getSource(); // The "data" row returned by getSource() also includes all source diff --git a/core/modules/migrate/src/Tests/MigrateEventsTest.php b/core/modules/migrate/src/Tests/MigrateEventsTest.php index 1a59d49..4157dec 100644 --- a/core/modules/migrate/src/Tests/MigrateEventsTest.php +++ b/core/modules/migrate/src/Tests/MigrateEventsTest.php @@ -83,7 +83,7 @@ public function testMigrateEvents() { $migration = Migration::create($config); - /** @var MigrationInterface $migration */ + /** @var \Drupal\migrate\Entity\MigrationInterface $migration */ $executable = new MigrateExecutable($migration, new MigrateMessage()); // As the import runs, events will be dispatched, recording the received // information in state. diff --git a/core/modules/node/src/Tests/Migrate/d6/MigrateNodeBuilderTest.php b/core/modules/node/src/Tests/Migrate/d6/MigrateNodeBuilderTest.php index d76e080..3411fcd 100644 --- a/core/modules/node/src/Tests/Migrate/d6/MigrateNodeBuilderTest.php +++ b/core/modules/node/src/Tests/Migrate/d6/MigrateNodeBuilderTest.php @@ -16,7 +16,7 @@ class MigrateNodeBuilderTest extends MigrateDrupal6TestBase { /** - * @var MigrationInterface[] + * @var \Drupal\migrate\Entity\MigrationInterface[] */ protected $builtMigrations = []; diff --git a/core/modules/node/src/Tests/NodeTypeTest.php b/core/modules/node/src/Tests/NodeTypeTest.php index c73151f..8152cf5 100644 --- a/core/modules/node/src/Tests/NodeTypeTest.php +++ b/core/modules/node/src/Tests/NodeTypeTest.php @@ -125,7 +125,7 @@ function testNodeTypeEditing() { $this->assertRaw('Body', 'Body field was found.'); // Change the name through the API - /** @var NodeTypeInterface $node_type */ + /** @var \Drupal\node\NodeTypeInterface $node_type */ $node_type = NodeType::load('page'); $node_type->set('name', 'NewBar'); $node_type->save(); diff --git a/core/modules/serialization/src/Tests/NormalizerTestBase.php b/core/modules/serialization/src/Tests/NormalizerTestBase.php index 651c79d..42c4bcc 100644 --- a/core/modules/serialization/src/Tests/NormalizerTestBase.php +++ b/core/modules/serialization/src/Tests/NormalizerTestBase.php @@ -9,6 +9,7 @@ use Drupal\KernelTests\KernelTestBase; use Drupal\field\Entity\FieldConfig; +use Drupal\field\Entity\FieldStorageConfig; abstract class NormalizerTestBase extends KernelTestBase { @@ -29,7 +30,7 @@ protected function setUp() { \Drupal::moduleHandler()->invoke('rest', 'install'); // Auto-create a field for testing. - FieldstorageConfig::create(array( + FieldStorageConfig::create(array( 'entity_type' => 'entity_test_mulrev', 'field_name' => 'field_test_text', 'type' => 'text', diff --git a/core/modules/simpletest/src/BrowserTestBase.php b/core/modules/simpletest/src/BrowserTestBase.php index 8817665..cad2bd8 100644 --- a/core/modules/simpletest/src/BrowserTestBase.php +++ b/core/modules/simpletest/src/BrowserTestBase.php @@ -7,6 +7,7 @@ namespace Drupal\simpletest; +use Behat\Mink\Driver\GoutteDriver; use Behat\Mink\Element\Element; use Behat\Mink\Mink; use Behat\Mink\Session; @@ -187,7 +188,7 @@ * * @var string. */ - protected $minkDefaultDriverClass = '\Behat\Mink\Driver\GoutteDriver'; + protected $minkDefaultDriverClass = GoutteDriver::class; /* * Mink default driver params. diff --git a/core/modules/system/src/Form/ModulesListConfirmForm.php b/core/modules/system/src/Form/ModulesListConfirmForm.php index b6f2db2..1fc6868 100644 --- a/core/modules/system/src/Form/ModulesListConfirmForm.php +++ b/core/modules/system/src/Form/ModulesListConfirmForm.php @@ -136,7 +136,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { /** * Builds the message list for the confirmation form. * - * @return MarkupInterface[] + * @return \Drupal\Component\Render\MarkupInterface[] * Array of markup for the list of messages on the form. * * @see \Drupal\system\Form\ModulesListForm::buildModuleList() diff --git a/core/modules/user/src/EventSubscriber/AccessDeniedSubscriber.php b/core/modules/user/src/EventSubscriber/AccessDeniedSubscriber.php index d4fb3df..681abc6 100644 --- a/core/modules/user/src/EventSubscriber/AccessDeniedSubscriber.php +++ b/core/modules/user/src/EventSubscriber/AccessDeniedSubscriber.php @@ -10,6 +10,7 @@ use Drupal\Core\Session\AccountInterface; use Drupal\Core\Routing\RouteMatch; use Drupal\Core\Routing\UrlGeneratorTrait; +use Drupal\Core\Routing\UrlGeneratorInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; @@ -42,7 +43,7 @@ class AccessDeniedSubscriber implements EventSubscriberInterface { * @param \Drupal\Core\Routing\UrlGeneratorInterface $url_generator * The URL generator. */ - public function __construct(AccountInterface $account, URLGeneratorInterface $url_generator) { + public function __construct(AccountInterface $account, UrlGeneratorInterface $url_generator) { $this->account = $account; $this->setUrlGenerator($url_generator); } diff --git a/core/modules/user/src/Tests/Views/UserViewsFieldAccessTest.php b/core/modules/user/src/Tests/Views/UserViewsFieldAccessTest.php index 8a18709..9c4cae0 100644 --- a/core/modules/user/src/Tests/Views/UserViewsFieldAccessTest.php +++ b/core/modules/user/src/Tests/Views/UserViewsFieldAccessTest.php @@ -8,6 +8,7 @@ namespace Drupal\user\Tests\Views; use Drupal\language\Entity\ConfigurableLanguage; +use Drupal\user\Entity\User; use Drupal\views\Tests\Handler\FieldFieldAccessTestBase; /** diff --git a/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php b/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php index a9a5652..2076895 100644 --- a/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php +++ b/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php @@ -131,7 +131,7 @@ public function testSetParameterWithUnfrozenContainer() { * * @covers ::setParameter * - * @expectedException LogicException + * @expectedException \Symfony\Component\DependencyInjection\Exception\LogicException */ public function testSetParameterWithFrozenContainer() { $this->container = new $this->containerClass($this->containerDefinition);