From f6ae58526c0678a968d151b0223ae57e686e150b Mon Sep 17 00:00:00 2001 From: Nathaniel Catchpole <catch@35733.no-reply.drupal.org> Date: Sun, 28 Aug 2016 18:16:36 +0100 Subject: [PATCH] Issue #2572801 by alexpott, vprocessor, andriyun, andypost, chishah92, Mile23, attiks, hussainweb, klausi, dawehner, pfrenssen: Fix 'Drupal.WhiteSpace.ScopeIndent' coding standard --- core/includes/update.inc | 2 +- .../Drupal/Component/Utility/SortArray.php | 6 +- .../Core/Config/Entity/Query/QueryFactory.php | 4 +- .../Database/Driver/pgsql/Install/Tasks.php | 2 +- .../Core/Database/StatementInterface.php | 8 +- .../Core/DependencyInjection/Container.php | 2 +- .../ReferenceAccessConstraintValidator.php | 8 +- .../Drupal/Core/Entity/Query/Sql/Query.php | 2 +- core/lib/Drupal/Core/Entity/entity.api.php | 6 +- .../Drupal/Core/Field/AllowedTagsXssTrait.php | 2 +- core/lib/Drupal/Core/Field/FieldItemList.php | 2 +- .../Field/FieldType/EntityReferenceItem.php | 2 +- .../Core/File/MimeType/MimeTypeGuesser.php | 2 +- core/lib/Drupal/Core/Form/FormState.php | 2 +- .../ImageToolkitOperationBase.php | 2 +- .../Core/Installer/Form/SiteSettingsForm.php | 2 +- .../lib/Drupal/Core/Mail/MailFormatHelper.php | 4 +- core/lib/Drupal/Core/Mail/MailInterface.php | 4 +- .../Core/Menu/ContextualLinkManager.php | 4 +- .../Menu/DefaultMenuLinkTreeManipulators.php | 2 +- .../Drupal/Core/Menu/LocalActionDefault.php | 2 +- .../lib/Drupal/Core/Menu/LocalTaskManager.php | 2 +- core/lib/Drupal/Core/Path/AliasManager.php | 2 +- .../Core/Plugin/Context/ContextDefinition.php | 4 +- core/lib/Drupal/Core/Render/theme.api.php | 2 +- .../Core/StreamWrapper/PublicStream.php | 2 +- .../TypedData/DataDefinitionInterface.php | 2 +- .../lib/Drupal/Core/Utility/ThemeRegistry.php | 2 +- core/modules/aggregator/src/Entity/Item.php | 2 +- .../src/FeedAccessControlHandler.php | 2 - .../AggregatorTitleFormatter.php | 14 +-- .../src/Plugin/migrate/process/BlockTheme.php | 10 +- .../block/src/Tests/BlockCacheTest.php | 2 +- .../block/src/Tests/BlockFormInBlockTest.php | 2 +- .../Kernel/Migrate/d7/MigrateBlockTest.php | 2 +- core/modules/book/src/Tests/BookTest.php | 86 ++++++------- .../comment/src/Form/CommentAdminOverview.php | 8 +- .../src/Unit/CommentStatisticsUnitTest.php | 5 +- .../src/ConfigEntityMapper.php | 2 +- .../contact/src/ContactFormEditForm.php | 4 +- .../tests/drupal-7.contact.database.php | 4 +- core/modules/datetime/datetime.module | 2 +- .../FieldWidget/DateTimeDatelistWidget.php | 16 +-- .../datetime/src/Tests/DateTimeFieldTest.php | 2 +- core/modules/dblog/src/Tests/DbLogTest.php | 16 +-- .../source/d6/FieldInstancePerViewMode.php | 6 +- ...erenceFieldTranslatedReferenceViewTest.php | 2 +- .../field_ui/src/Form/FieldConfigEditForm.php | 2 +- core/modules/file/src/Entity/File.php | 2 +- .../filter/src/Plugin/FilterInterface.php | 32 ++--- .../image/src/Tests/ImageFieldWidgetTest.php | 2 +- .../src/Tests/ImageStylesPathAndUrlTest.php | 6 +- .../Migrate/d6/MigrateImageCacheTest.php | 98 +++++++-------- .../src/Plugin/migrate/cckfield/LinkField.php | 10 +- .../locale/src/StringDatabaseStorage.php | 6 +- .../src/Entity/MenuLinkContent.php | 2 +- core/modules/menu_ui/src/Tests/MenuTest.php | 2 +- .../src/Event/MigratePreRowSaveEvent.php | 2 +- .../modules/migrate/src/MigrateExecutable.php | 58 ++++++--- .../tests/src/Unit/MigrateSourceTest.php | 2 +- .../Plugin/migrate/source/DrupalSqlBase.php | 14 +-- core/modules/node/node.module | 4 +- .../node/src/NodeTypeAccessControlHandler.php | 3 +- ...NodeAccessLanguageAwareCombinationTest.php | 44 +++---- .../src/Tests/NodeAccessLanguageAwareTest.php | 44 +++---- .../node/src/Tests/NodeAccessLanguageTest.php | 28 ++--- .../src/Tests/NodeFieldMultilingualTest.php | 2 +- .../Plugin/Field/FieldType/ListItemBase.php | 10 +- core/modules/rest/src/Tests/RESTTestBase.php | 18 +-- .../src/Tests/Views/StyleSerializerTest.php | 4 +- .../src/Normalizer/NormalizerBase.php | 2 +- .../src/Form/ShortcutSetDeleteForm.php | 2 +- core/modules/simpletest/src/TestBase.php | 2 +- .../src/Tests/Ajax/AjaxFormPageCacheTest.php | 100 +++++++-------- .../Tests/Form/ElementsVerticalTabsTest.php | 6 +- .../system/src/Tests/Theme/EngineTwigTest.php | 2 +- .../src/Tests/Update/UpdatePathTestBase.php | 2 +- .../src/Tests/Update/UpdateScriptTest.php | 8 +- core/modules/system/system.install | 8 +- ...upal-8.views-entity-views-data-2455125.php | 8 +- .../src/Render/MainContent/JsonRenderer.php | 22 ++-- .../src/HttpKernel/TestMiddleware.php | 44 +++---- .../src/Plugin/DefaultsTestPluginManager.php | 12 +- .../src/Kernel/Scripts/DbCommandBaseTest.php | 8 +- .../taxonomy/src/TermAccessControlHandler.php | 3 - .../tests/src/Kernel/ForwardRevisionTest.php | 6 +- .../src/Plugin/migrate/cckfield/TextField.php | 1 - .../modules/toolbar_test/toolbar_test.module | 2 +- .../tour/src/Tests/TourCacheTagsTest.php | 2 +- core/modules/update/src/Form/UpdateReady.php | 2 +- .../modules/update/src/UpdateSettingsForm.php | 2 +- core/modules/update/update.module | 2 +- .../migrate/process/d6/UserUpdate7002.php | 10 +- .../src/Plugin/views/field/Permissions.php | 12 -- .../user/src/Plugin/views/filter/Name.php | 6 +- .../user/src/Tests/RestRegisterUserTest.php | 23 +--- .../modules/user/src/Tests/UserBlocksTest.php | 8 +- .../user/src/Tests/UserPasswordResetTest.php | 4 +- .../drupal-8.user-email-token-2587275.php | 4 +- .../tests/src/Unit/PermissionHandlerTest.php | 53 ++++---- .../src/Unit/Plugin/Core/Entity/UserTest.php | 2 +- core/modules/user/user.module | 2 +- .../views/src/Plugin/views/area/Entity.php | 2 +- .../views/src/Plugin/views/area/View.php | 62 +++++----- .../views/src/Plugin/views/display/Block.php | 8 +- .../views/display/DisplayPluginBase.php | 10 +- .../Plugin/views/filter/FilterPluginBase.php | 10 +- .../views/src/Plugin/views/pager/Mini.php | 2 +- .../views/src/Plugin/views/pager/Some.php | 2 +- .../src/Plugin/views/sort/SortPluginBase.php | 3 +- .../Entity/FieldEntityTranslationTest.php | 117 ++++++++---------- .../src/Plugin/views/query/QueryTest.php | 2 +- .../src/Kernel/Handler/FilterNumericTest.php | 2 +- .../src/Kernel/Handler/FilterStringTest.php | 2 +- .../tests/src/Kernel/Handler/SortDateTest.php | 110 ++++++++-------- .../views/tests/src/Kernel/ModuleTest.php | 2 +- .../tests/src/Unit/EntityViewsDataTest.php | 4 +- .../views_ui/src/Tests/CustomBooleanTest.php | 2 +- core/modules/views_ui/src/ViewUI.php | 6 +- core/phpcs.xml.dist | 1 + .../Drupal/KernelTests/AssertConfigTrait.php | 1 - .../Core/Database/DatabaseTestBase.php | 10 +- .../Core/Entity/EntityQueryTest.php | 2 +- .../Core/Menu/MenuLinkTreeTest.php | 20 +-- .../Drupal/KernelTests/KernelTestBaseTest.php | 2 +- core/tests/Drupal/Tests/BrowserTestBase.php | 2 +- .../ProxyBuilder/ProxyBuilderTest.php | 2 +- .../Component/Utility/SafeMarkupTest.php | 2 +- .../Core/Asset/LibraryDiscoveryParserTest.php | 2 +- .../Core/Cache/CacheableMetadataTest.php | 16 +-- .../Sql/SqlContentEntityStorageTest.php | 12 +- .../Core/Form/FormStateDecoratorBaseTest.php | 4 +- .../Core/Menu/LocalActionManagerTest.php | 6 +- .../Tests/Core/Menu/LocalTaskManagerTest.php | 2 +- .../Core/Render/Element/MachineNameTest.php | 8 +- .../Core/Render/RendererBubblingTest.php | 6 +- .../Core/Routing/RedirectDestinationTest.php | 2 +- .../Tests/Core/Session/UserSessionTest.php | 4 +- .../Drupal/Tests/Core/Site/SettingsTest.php | 10 +- .../ReverseProxyMiddlewareTest.php | 6 +- .../TranslatableMarkupTest.php | 4 +- core/tests/Drupal/Tests/Core/UrlTest.php | 2 +- .../Core/Utility/UnroutedUrlAssemblerTest.php | 10 +- 143 files changed, 751 insertions(+), 769 deletions(-) diff --git a/core/includes/update.inc b/core/includes/update.inc index 2c020db6b2fb..213d15d2fef9 100644 --- a/core/includes/update.inc +++ b/core/includes/update.inc @@ -707,7 +707,7 @@ function update_language_list($flags = LanguageInterface::STATE_CONFIGURABLE) { // Initialize master language list. if (!isset($languages)) { // Initialize local language list cache. - $languages = array(); + $languages = array(); // Fill in master language list based on current configuration. $default = \Drupal::languageManager()->getDefaultLanguage(); diff --git a/core/lib/Drupal/Component/Utility/SortArray.php b/core/lib/Drupal/Component/Utility/SortArray.php index 044a21492fcb..2ef6223f73d2 100644 --- a/core/lib/Drupal/Component/Utility/SortArray.php +++ b/core/lib/Drupal/Component/Utility/SortArray.php @@ -81,9 +81,9 @@ public static function sortByTitleElement($a, $b) { * @return int * The comparison result for uasort(). */ - public static function sortByTitleProperty($a, $b) { - return static::sortByKeyString($a, $b, '#title'); - } + public static function sortByTitleProperty($a, $b) { + return static::sortByKeyString($a, $b, '#title'); + } /** * Sorts a string array item by an arbitrary key. diff --git a/core/lib/Drupal/Core/Config/Entity/Query/QueryFactory.php b/core/lib/Drupal/Core/Config/Entity/Query/QueryFactory.php index 80a41c4f0362..0327e902b385 100644 --- a/core/lib/Drupal/Core/Config/Entity/Query/QueryFactory.php +++ b/core/lib/Drupal/Core/Config/Entity/Query/QueryFactory.php @@ -66,8 +66,8 @@ public function get(EntityTypeInterface $entity_type, $conjunction) { /** * {@inheritdoc} */ - public function getAggregate(EntityTypeInterface $entity_type, $conjunction) { - throw new QueryException('Aggregation over configuration entities is not supported'); + public function getAggregate(EntityTypeInterface $entity_type, $conjunction) { + throw new QueryException('Aggregation over configuration entities is not supported'); } /** diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php index 95ff52716fea..7e78b1405d3e 100644 --- a/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php +++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php @@ -65,7 +65,7 @@ protected function connect() { $this->pass('Drupal can CONNECT to the database ok.'); } catch (\Exception $e) { - // Attempt to create the database if it is not found. + // Attempt to create the database if it is not found. if ($e->getCode() == Connection::DATABASE_NOT_FOUND) { // Remove the database string from connection info. $connection_info = Database::getConnectionInfo(); diff --git a/core/lib/Drupal/Core/Database/StatementInterface.php b/core/lib/Drupal/Core/Database/StatementInterface.php index 5bc9e48ef79f..971d031e032b 100644 --- a/core/lib/Drupal/Core/Database/StatementInterface.php +++ b/core/lib/Drupal/Core/Database/StatementInterface.php @@ -90,7 +90,7 @@ public function rowCount(); * If $mode is PDO::FETCH_CLASS, the optional arguments to pass to the * constructor. */ - public function setFetchMode($mode, $a1 = NULL, $a2 = array()); + public function setFetchMode($mode, $a1 = NULL, $a2 = array()); /** * Fetches the next row from a result set. @@ -109,7 +109,7 @@ public function setFetchMode($mode, $a1 = NULL, $a2 = array()); * @return * A result, formatted according to $mode. */ - public function fetch($mode = NULL, $cursor_orientation = NULL, $cursor_offset = NULL); + public function fetch($mode = NULL, $cursor_orientation = NULL, $cursor_offset = NULL); /** * Returns a single field from the next record of a result set. @@ -128,7 +128,7 @@ public function fetchField($index = 0); * The object will be of the class specified by StatementInterface::setFetchMode() * or stdClass if not specified. */ - public function fetchObject(); + public function fetchObject(); /** * Fetches the next row and returns it as an associative array. @@ -155,7 +155,7 @@ public function fetchAssoc(); * @return * An array of results. */ - function fetchAll($mode = NULL, $column_index = NULL, $constructor_arguments = NULL); + function fetchAll($mode = NULL, $column_index = NULL, $constructor_arguments = NULL); /** * Returns an entire single column of a result set as an indexed array. diff --git a/core/lib/Drupal/Core/DependencyInjection/Container.php b/core/lib/Drupal/Core/DependencyInjection/Container.php index 157f576ed456..4a491225b0cc 100644 --- a/core/lib/Drupal/Core/DependencyInjection/Container.php +++ b/core/lib/Drupal/Core/DependencyInjection/Container.php @@ -14,7 +14,7 @@ class Container extends DrupalContainer { * {@inheritdoc} */ public function set($id, $service, $scope = ContainerInterface::SCOPE_CONTAINER) { - parent::set($id, $service, $scope); + parent::set($id, $service, $scope); // Ensure that the _serviceId property is set on synthetic services as well. if (isset($this->services[$id]) && is_object($this->services[$id]) && !isset($this->services[$id]->_serviceId)) { diff --git a/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/ReferenceAccessConstraintValidator.php b/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/ReferenceAccessConstraintValidator.php index ab8d64c228df..c57478197bbe 100644 --- a/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/ReferenceAccessConstraintValidator.php +++ b/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/ReferenceAccessConstraintValidator.php @@ -33,10 +33,10 @@ public function validate($value, Constraint $constraint) { $referenced_entities = $existing_entity->{$value->getFieldDefinition()->getName()}->referencedEntities(); // Check permission if we are not already referencing the entity. foreach ($referenced_entities as $ref) { - if (isset($referenced_entities[$ref->id()])) { - $check_permission = FALSE; - break; - } + if (isset($referenced_entities[$ref->id()])) { + $check_permission = FALSE; + break; + } } } // We check that the current user had access to view any newly added diff --git a/core/lib/Drupal/Core/Entity/Query/Sql/Query.php b/core/lib/Drupal/Core/Entity/Query/Sql/Query.php index 2d5df2d1a24d..78f831aff3fb 100644 --- a/core/lib/Drupal/Core/Entity/Query/Sql/Query.php +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Query.php @@ -225,7 +225,7 @@ protected function finish() { if ($this->range) { $this->sqlQuery->range($this->range['start'], $this->range['length']); } - foreach ($this->sqlGroupBy as $field) { + foreach ($this->sqlGroupBy as $field) { $this->sqlQuery->groupBy($field); } foreach ($this->sqlFields as $field) { diff --git a/core/lib/Drupal/Core/Entity/entity.api.php b/core/lib/Drupal/Core/Entity/entity.api.php index 36873845c759..60ae7413ff51 100644 --- a/core/lib/Drupal/Core/Entity/entity.api.php +++ b/core/lib/Drupal/Core/Entity/entity.api.php @@ -893,9 +893,9 @@ function hook_ENTITY_TYPE_storage_load(array $entities) { * @see hook_ENTITY_TYPE_presave() */ function hook_entity_presave(Drupal\Core\Entity\EntityInterface $entity) { - if ($entity instanceof ContentEntityInterface && $entity->isTranslatable()) { - $route_match = \Drupal::routeMatch(); - \Drupal::service('content_translation.synchronizer')->synchronizeFields($entity, $entity->language()->getId(), $route_match->getParameter('source_langcode')); + if ($entity instanceof ContentEntityInterface && $entity->isTranslatable()) { + $route_match = \Drupal::routeMatch(); + \Drupal::service('content_translation.synchronizer')->synchronizeFields($entity, $entity->language()->getId(), $route_match->getParameter('source_langcode')); } } diff --git a/core/lib/Drupal/Core/Field/AllowedTagsXssTrait.php b/core/lib/Drupal/Core/Field/AllowedTagsXssTrait.php index 4b6d710ce139..427d7f407fc4 100644 --- a/core/lib/Drupal/Core/Field/AllowedTagsXssTrait.php +++ b/core/lib/Drupal/Core/Field/AllowedTagsXssTrait.php @@ -30,7 +30,7 @@ trait AllowedTagsXssTrait { * valid UTF-8. */ public function fieldFilterXss($string) { - return FieldFilteredMarkup::create($string); + return FieldFilteredMarkup::create($string); } /** diff --git a/core/lib/Drupal/Core/Field/FieldItemList.php b/core/lib/Drupal/Core/Field/FieldItemList.php index ebdb2762acb4..97dd493195af 100644 --- a/core/lib/Drupal/Core/Field/FieldItemList.php +++ b/core/lib/Drupal/Core/Field/FieldItemList.php @@ -257,7 +257,7 @@ public function view($display_options = array()) { /** * {@inheritdoc} */ - public function generateSampleItems($count = 1) { + public function generateSampleItems($count = 1) { $field_definition = $this->getFieldDefinition(); $field_type_class = \Drupal::service('plugin.manager.field.field_type')->getPluginClass($field_definition->getType()); for ($delta = 0; $delta < $count; $delta++) { diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php index e8832f31adfd..398d260886bc 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php @@ -617,7 +617,7 @@ public static function settingsAjaxSubmit($form, FormStateInterface $form_state) $form_state->setRebuild(); } - /** + /** * {@inheritdoc} */ public static function getPreconfiguredOptions() { diff --git a/core/lib/Drupal/Core/File/MimeType/MimeTypeGuesser.php b/core/lib/Drupal/Core/File/MimeType/MimeTypeGuesser.php index 72df780a8151..85d0261631f3 100644 --- a/core/lib/Drupal/Core/File/MimeType/MimeTypeGuesser.php +++ b/core/lib/Drupal/Core/File/MimeType/MimeTypeGuesser.php @@ -31,7 +31,7 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface { */ protected $sortedGuessers = NULL; - /** + /** * The stream wrapper manager. * * @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface diff --git a/core/lib/Drupal/Core/Form/FormState.php b/core/lib/Drupal/Core/Form/FormState.php index ca7355dceb61..33ca1fafba06 100644 --- a/core/lib/Drupal/Core/Form/FormState.php +++ b/core/lib/Drupal/Core/Form/FormState.php @@ -648,7 +648,7 @@ public function disableRedirect($no_redirect = TRUE) { * {@inheritdoc} */ public function isRedirectDisabled() { - return $this->no_redirect; + return $this->no_redirect; } /** diff --git a/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationBase.php b/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationBase.php index af1b2c95dbd7..2a1e61ec30e0 100644 --- a/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationBase.php +++ b/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationBase.php @@ -123,7 +123,7 @@ protected function prepareArguments(array $arguments) { // Use the default value if the argument is not passed in. if (!array_key_exists($id, $arguments)) { - $arguments[$id] = $argument['default']; + $arguments[$id] = $argument['default']; } } } diff --git a/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php b/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php index c6a3840e64fe..f5d1c7fe5063 100644 --- a/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php +++ b/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php @@ -37,7 +37,7 @@ class SiteSettingsForm extends FormBase { public function __construct($site_path, RendererInterface $renderer) { $this->sitePath = $site_path; $this->renderer = $renderer; -} + } /** * {@inheritdoc} diff --git a/core/lib/Drupal/Core/Mail/MailFormatHelper.php b/core/lib/Drupal/Core/Mail/MailFormatHelper.php index 080b32617ac8..3dffe830c204 100644 --- a/core/lib/Drupal/Core/Mail/MailFormatHelper.php +++ b/core/lib/Drupal/Core/Mail/MailFormatHelper.php @@ -202,8 +202,7 @@ public static function htmlToText($string, $allowed_tags = NULL) { // Ensure blank new-line. $chunk = ''; } - - // Fall-through. + // Intentional fall-through to the processing for '/li' and '/dd'. case '/li': case '/dd': array_pop($indent); @@ -212,6 +211,7 @@ public static function htmlToText($string, $allowed_tags = NULL) { case '/h3': case '/h4': array_pop($indent); + // Intentional fall-through to the processing for '/h5' and '/h6'. case '/h5': case '/h6': // Ensure blank new-line. diff --git a/core/lib/Drupal/Core/Mail/MailInterface.php b/core/lib/Drupal/Core/Mail/MailInterface.php index 1435ff9c276b..fbde1b86dc76 100644 --- a/core/lib/Drupal/Core/Mail/MailInterface.php +++ b/core/lib/Drupal/Core/Mail/MailInterface.php @@ -30,7 +30,7 @@ interface MailInterface { * * @see \Drupal\Core\Mail\MailManagerInterface */ - public function format(array $message); + public function format(array $message); /** * Sends a message composed by \Drupal\Core\Mail\MailManagerInterface->mail(). @@ -60,6 +60,6 @@ public function format(array $message); * @return bool * TRUE if the mail was successfully accepted for delivery, otherwise FALSE. */ - public function mail(array $message); + public function mail(array $message); } diff --git a/core/lib/Drupal/Core/Menu/ContextualLinkManager.php b/core/lib/Drupal/Core/Menu/ContextualLinkManager.php index 29803ad5007e..e264036fc4c9 100644 --- a/core/lib/Drupal/Core/Menu/ContextualLinkManager.php +++ b/core/lib/Drupal/Core/Menu/ContextualLinkManager.php @@ -126,11 +126,11 @@ protected function getDiscovery() { public function processDefinition(&$definition, $plugin_id) { parent::processDefinition($definition, $plugin_id); - // If there is no route name, this is a broken definition. + // If there is no route name, this is a broken definition. if (empty($definition['route_name'])) { throw new PluginException(sprintf('Contextual link plugin (%s) definition must include "route_name".', $plugin_id)); } - // If there is no group name, this is a broken definition. + // If there is no group name, this is a broken definition. if (empty($definition['group'])) { throw new PluginException(sprintf('Contextual link plugin (%s) definition must include "group".', $plugin_id)); } diff --git a/core/lib/Drupal/Core/Menu/DefaultMenuLinkTreeManipulators.php b/core/lib/Drupal/Core/Menu/DefaultMenuLinkTreeManipulators.php index 43c4468286c6..71590832dd8a 100644 --- a/core/lib/Drupal/Core/Menu/DefaultMenuLinkTreeManipulators.php +++ b/core/lib/Drupal/Core/Menu/DefaultMenuLinkTreeManipulators.php @@ -37,7 +37,7 @@ class DefaultMenuLinkTreeManipulators { * * @var \Drupal\Core\Entity\Query\QueryFactory */ - protected $queryFactory; + protected $queryFactory; /** * Constructs a \Drupal\Core\Menu\DefaultMenuLinkTreeManipulators object. diff --git a/core/lib/Drupal/Core/Menu/LocalActionDefault.php b/core/lib/Drupal/Core/Menu/LocalActionDefault.php index faa20a892770..bfa088e0adb9 100644 --- a/core/lib/Drupal/Core/Menu/LocalActionDefault.php +++ b/core/lib/Drupal/Core/Menu/LocalActionDefault.php @@ -24,7 +24,7 @@ class LocalActionDefault extends PluginBase implements LocalActionInterface, Con * * @var \Drupal\Core\Routing\RouteProviderInterface */ - protected $routeProvider; + protected $routeProvider; /** * Constructs a LocalActionDefault object. diff --git a/core/lib/Drupal/Core/Menu/LocalTaskManager.php b/core/lib/Drupal/Core/Menu/LocalTaskManager.php index ec1df5c2fa2d..26b2ed5b164c 100644 --- a/core/lib/Drupal/Core/Menu/LocalTaskManager.php +++ b/core/lib/Drupal/Core/Menu/LocalTaskManager.php @@ -158,7 +158,7 @@ protected function getDiscovery() { */ public function processDefinition(&$definition, $plugin_id) { parent::processDefinition($definition, $plugin_id); - // If there is no route name, this is a broken definition. + // If there is no route name, this is a broken definition. if (empty($definition['route_name'])) { throw new PluginException(sprintf('Plugin (%s) definition must include "route_name"', $plugin_id)); } diff --git a/core/lib/Drupal/Core/Path/AliasManager.php b/core/lib/Drupal/Core/Path/AliasManager.php index 0368d43c2a0f..3a31917310d4 100644 --- a/core/lib/Drupal/Core/Path/AliasManager.php +++ b/core/lib/Drupal/Core/Path/AliasManager.php @@ -283,7 +283,7 @@ protected function pathAliasWhitelistRebuild($path = NULL) { if (!empty($path)) { if ($this->whitelist->get(strtok($path, '/'))) { return; - } + } } $this->whitelist->clear(); } diff --git a/core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php b/core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php index 37f7bbc914a7..71cfaa1048ad 100644 --- a/core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php +++ b/core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php @@ -85,7 +85,7 @@ public static function create($data_type = 'any') { * * @param string $data_type * The required data type. - * @param mixed string|null $label + * @param string|null $label * The label of this context definition for the UI. * @param bool $required * Whether the context definition is required. @@ -245,7 +245,7 @@ public function getDataDefinition() { ->setDescription($this->getDescription()) ->setRequired($this->isRequired()); $constraints = $definition->getConstraints() + $this->getConstraints(); - $definition->setConstraints($constraints); + $definition->setConstraints($constraints); return $definition; } diff --git a/core/lib/Drupal/Core/Render/theme.api.php b/core/lib/Drupal/Core/Render/theme.api.php index 61cafc33cc2f..322761eee868 100644 --- a/core/lib/Drupal/Core/Render/theme.api.php +++ b/core/lib/Drupal/Core/Render/theme.api.php @@ -555,7 +555,7 @@ function hook_form_system_theme_settings_alter(&$form, \Drupal\Core\Form\FormSta * The name of the theme hook. */ function hook_preprocess(&$variables, $hook) { - static $hooks; + static $hooks; // Add contextual links to the variables, if the user has permission. diff --git a/core/lib/Drupal/Core/StreamWrapper/PublicStream.php b/core/lib/Drupal/Core/StreamWrapper/PublicStream.php index 52f05e4db80e..f2783530958e 100644 --- a/core/lib/Drupal/Core/StreamWrapper/PublicStream.php +++ b/core/lib/Drupal/Core/StreamWrapper/PublicStream.php @@ -66,7 +66,7 @@ public function getExternalUrl() { public static function baseUrl() { $settings_base_url = Settings::get('file_public_base_url', ''); if ($settings_base_url) { - return (string) $settings_base_url; + return (string) $settings_base_url; } else { return $GLOBALS['base_url'] . '/' . static::basePath(); diff --git a/core/lib/Drupal/Core/TypedData/DataDefinitionInterface.php b/core/lib/Drupal/Core/TypedData/DataDefinitionInterface.php index 4ae187b34428..64d779c317b9 100644 --- a/core/lib/Drupal/Core/TypedData/DataDefinitionInterface.php +++ b/core/lib/Drupal/Core/TypedData/DataDefinitionInterface.php @@ -44,7 +44,7 @@ interface DataDefinitionInterface { * If an unsupported data type gets passed to the class; e.g., 'string' to a * definition class handling 'entity:* data types. */ - public static function createFromDataType($data_type); + public static function createFromDataType($data_type); /** * Returns the data type of the data. diff --git a/core/lib/Drupal/Core/Utility/ThemeRegistry.php b/core/lib/Drupal/Core/Utility/ThemeRegistry.php index 919571c666c7..8dbf42e242df 100644 --- a/core/lib/Drupal/Core/Utility/ThemeRegistry.php +++ b/core/lib/Drupal/Core/Utility/ThemeRegistry.php @@ -53,7 +53,7 @@ function __construct($cid, CacheBackendInterface $cache, LockBackendInterface $l $this->tags = $tags; $this->persistable = $modules_loaded && \Drupal::hasRequest() && \Drupal::request()->isMethod('GET'); - // @todo: Implement lazyload. + // @todo: Implement lazyload. $this->cacheLoaded = TRUE; if ($this->persistable && $cached = $this->cache->get($this->cid)) { diff --git a/core/modules/aggregator/src/Entity/Item.php b/core/modules/aggregator/src/Entity/Item.php index 330aacb5c401..2a2c195ad2e3 100644 --- a/core/modules/aggregator/src/Entity/Item.php +++ b/core/modules/aggregator/src/Entity/Item.php @@ -54,7 +54,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { ->setDescription(t('The ID of the feed item.')); $fields['langcode']->setLabel(t('Language code')) - ->setDescription(t('The feed item language code.')); + ->setDescription(t('The feed item language code.')); $fields['fid'] = BaseFieldDefinition::create('entity_reference') ->setLabel(t('Source feed')) diff --git a/core/modules/aggregator/src/FeedAccessControlHandler.php b/core/modules/aggregator/src/FeedAccessControlHandler.php index 3f11da9031f2..334265a782b7 100644 --- a/core/modules/aggregator/src/FeedAccessControlHandler.php +++ b/core/modules/aggregator/src/FeedAccessControlHandler.php @@ -21,11 +21,9 @@ protected function checkAccess(EntityInterface $entity, $operation, AccountInter switch ($operation) { case 'view': return AccessResult::allowedIfHasPermission($account, 'access news feeds'); - break; default: return AccessResult::allowedIfHasPermission($account, 'administer news feeds'); - break; } } diff --git a/core/modules/aggregator/src/Plugin/Field/FieldFormatter/AggregatorTitleFormatter.php b/core/modules/aggregator/src/Plugin/Field/FieldFormatter/AggregatorTitleFormatter.php index 346ea2626b9d..25e33e9774fc 100644 --- a/core/modules/aggregator/src/Plugin/Field/FieldFormatter/AggregatorTitleFormatter.php +++ b/core/modules/aggregator/src/Plugin/Field/FieldFormatter/AggregatorTitleFormatter.php @@ -60,17 +60,17 @@ public function viewElements(FieldItemListInterface $items, $langcode) { } foreach ($items as $delta => $item) { - if ($this->getSetting('display_as_link') && $url_string) { - $elements[$delta] = [ + if ($this->getSetting('display_as_link') && $url_string) { + $elements[$delta] = [ '#type' => 'link', '#title' => $item->value, '#url' => Url::fromUri($url_string), - ]; - } - else { - $elements[$delta] = ['#markup' => $item->value]; - } + ]; } + else { + $elements[$delta] = ['#markup' => $item->value]; + } + } return $elements; } diff --git a/core/modules/block/src/Plugin/migrate/process/BlockTheme.php b/core/modules/block/src/Plugin/migrate/process/BlockTheme.php index d040ce631409..bc1d98b8d46a 100644 --- a/core/modules/block/src/Plugin/migrate/process/BlockTheme.php +++ b/core/modules/block/src/Plugin/migrate/process/BlockTheme.php @@ -24,11 +24,11 @@ class BlockTheme extends ProcessPluginBase implements ContainerFactoryPluginInte */ protected $configFactory; - /** - * Contains the system.theme configuration object. - * - * @var \Drupal\Core\Config\Config - */ + /** + * Contains the system.theme configuration object. + * + * @var \Drupal\Core\Config\Config + */ protected $themeConfig; /** diff --git a/core/modules/block/src/Tests/BlockCacheTest.php b/core/modules/block/src/Tests/BlockCacheTest.php index f7745394fc7c..898858021e5f 100644 --- a/core/modules/block/src/Tests/BlockCacheTest.php +++ b/core/modules/block/src/Tests/BlockCacheTest.php @@ -63,7 +63,7 @@ protected function setUp() { $this->normalUserAlt->save(); // Enable our test block. - $this->block = $this->drupalPlaceBlock('test_cache'); + $this->block = $this->drupalPlaceBlock('test_cache'); } /** diff --git a/core/modules/block/src/Tests/BlockFormInBlockTest.php b/core/modules/block/src/Tests/BlockFormInBlockTest.php index 73c75919f5c0..20d24b21a393 100644 --- a/core/modules/block/src/Tests/BlockFormInBlockTest.php +++ b/core/modules/block/src/Tests/BlockFormInBlockTest.php @@ -25,7 +25,7 @@ protected function setUp() { parent::setUp(); // Enable our test block. - $this->drupalPlaceBlock('test_form_in_block'); + $this->drupalPlaceBlock('test_form_in_block'); } /** diff --git a/core/modules/block/tests/src/Kernel/Migrate/d7/MigrateBlockTest.php b/core/modules/block/tests/src/Kernel/Migrate/d7/MigrateBlockTest.php index 49be0ee03ac9..b98f46f1cf5d 100644 --- a/core/modules/block/tests/src/Kernel/Migrate/d7/MigrateBlockTest.php +++ b/core/modules/block/tests/src/Kernel/Migrate/d7/MigrateBlockTest.php @@ -13,7 +13,7 @@ */ class MigrateBlockTest extends MigrateDrupal7TestBase { - /** + /** * {@inheritdoc} */ public static $modules = [ diff --git a/core/modules/book/src/Tests/BookTest.php b/core/modules/book/src/Tests/BookTest.php index 7ebec63613a1..015899295bc7 100644 --- a/core/modules/book/src/Tests/BookTest.php +++ b/core/modules/book/src/Tests/BookTest.php @@ -526,49 +526,49 @@ function testNavigationBlockOnAccessModuleInstalled() { /** * Tests the access for deleting top-level book nodes. */ - function testBookDelete() { - $node_storage = $this->container->get('entity.manager')->getStorage('node'); - $nodes = $this->createBook(); - $this->drupalLogin($this->adminUser); - $edit = array(); - - // Test access to delete top-level and child book nodes. - $this->drupalGet('node/' . $this->book->id() . '/outline/remove'); - $this->assertResponse('403', 'Deleting top-level book node properly forbidden.'); - $this->drupalPostForm('node/' . $nodes[4]->id() . '/outline/remove', $edit, t('Remove')); - $node_storage->resetCache(array($nodes[4]->id())); - $node4 = $node_storage->load($nodes[4]->id()); - $this->assertTrue(empty($node4->book), 'Deleting child book node properly allowed.'); - - // Delete all child book nodes and retest top-level node deletion. - foreach ($nodes as $node) { - $nids[] = $node->id(); - } - entity_delete_multiple('node', $nids); - $this->drupalPostForm('node/' . $this->book->id() . '/outline/remove', $edit, t('Remove')); - $node_storage->resetCache(array($this->book->id())); - $node = $node_storage->load($this->book->id()); - $this->assertTrue(empty($node->book), 'Deleting childless top-level book node properly allowed.'); - - // Tests directly deleting a book parent. - $nodes = $this->createBook(); - $this->drupalLogin($this->adminUser); - $this->drupalGet($this->book->urlInfo('delete-form')); - $this->assertRaw(t('%title is part of a book outline, and has associated child pages. If you proceed with deletion, the child pages will be relocated automatically.', ['%title' => $this->book->label()])); - // Delete parent, and visit a child page. - $this->drupalPostForm($this->book->urlInfo('delete-form'), [], t('Delete')); - $this->drupalGet($nodes[0]->urlInfo()); - $this->assertResponse(200); - $this->assertText($nodes[0]->label()); - // The book parents should be updated. - $node_storage = \Drupal::entityTypeManager()->getStorage('node'); - $node_storage->resetCache(); - $child = $node_storage->load($nodes[0]->id()); - $this->assertEqual($child->id(), $child->book['bid'], 'Child node book ID updated when parent is deleted.'); - // 3rd-level children should now be 2nd-level. - $second = $node_storage->load($nodes[1]->id()); - $this->assertEqual($child->id(), $second->book['bid'], '3rd-level child node is now second level when top-level node is deleted.'); - } + function testBookDelete() { + $node_storage = $this->container->get('entity.manager')->getStorage('node'); + $nodes = $this->createBook(); + $this->drupalLogin($this->adminUser); + $edit = array(); + + // Test access to delete top-level and child book nodes. + $this->drupalGet('node/' . $this->book->id() . '/outline/remove'); + $this->assertResponse('403', 'Deleting top-level book node properly forbidden.'); + $this->drupalPostForm('node/' . $nodes[4]->id() . '/outline/remove', $edit, t('Remove')); + $node_storage->resetCache(array($nodes[4]->id())); + $node4 = $node_storage->load($nodes[4]->id()); + $this->assertTrue(empty($node4->book), 'Deleting child book node properly allowed.'); + + // Delete all child book nodes and retest top-level node deletion. + foreach ($nodes as $node) { + $nids[] = $node->id(); + } + entity_delete_multiple('node', $nids); + $this->drupalPostForm('node/' . $this->book->id() . '/outline/remove', $edit, t('Remove')); + $node_storage->resetCache(array($this->book->id())); + $node = $node_storage->load($this->book->id()); + $this->assertTrue(empty($node->book), 'Deleting childless top-level book node properly allowed.'); + + // Tests directly deleting a book parent. + $nodes = $this->createBook(); + $this->drupalLogin($this->adminUser); + $this->drupalGet($this->book->urlInfo('delete-form')); + $this->assertRaw(t('%title is part of a book outline, and has associated child pages. If you proceed with deletion, the child pages will be relocated automatically.', ['%title' => $this->book->label()])); + // Delete parent, and visit a child page. + $this->drupalPostForm($this->book->urlInfo('delete-form'), [], t('Delete')); + $this->drupalGet($nodes[0]->urlInfo()); + $this->assertResponse(200); + $this->assertText($nodes[0]->label()); + // The book parents should be updated. + $node_storage = \Drupal::entityTypeManager()->getStorage('node'); + $node_storage->resetCache(); + $child = $node_storage->load($nodes[0]->id()); + $this->assertEqual($child->id(), $child->book['bid'], 'Child node book ID updated when parent is deleted.'); + // 3rd-level children should now be 2nd-level. + $second = $node_storage->load($nodes[1]->id()); + $this->assertEqual($child->id(), $second->book['bid'], '3rd-level child node is now second level when top-level node is deleted.'); + } /** * Tests re-ordering of books. diff --git a/core/modules/comment/src/Form/CommentAdminOverview.php b/core/modules/comment/src/Form/CommentAdminOverview.php index dac62bd4b9f3..3966fca1bfcc 100644 --- a/core/modules/comment/src/Form/CommentAdminOverview.php +++ b/core/modules/comment/src/Form/CommentAdminOverview.php @@ -151,10 +151,10 @@ public function buildForm(array $form, FormStateInterface $form_state, $type = ' 'operations' => $this->t('Operations'), ); $cids = $this->commentStorage->getQuery() - ->condition('status', $status) - ->tableSort($header) - ->pager(50) - ->execute(); + ->condition('status', $status) + ->tableSort($header) + ->pager(50) + ->execute(); /** @var $comments \Drupal\comment\CommentInterface[] */ $comments = $this->commentStorage->loadMultiple($cids); diff --git a/core/modules/comment/tests/src/Unit/CommentStatisticsUnitTest.php b/core/modules/comment/tests/src/Unit/CommentStatisticsUnitTest.php index e9047543381a..39b4cf0a07d8 100644 --- a/core/modules/comment/tests/src/Unit/CommentStatisticsUnitTest.php +++ b/core/modules/comment/tests/src/Unit/CommentStatisticsUnitTest.php @@ -111,13 +111,12 @@ public function fetchObjectCallback() { switch ($this->calls_to_fetch) { case 1: return 'something'; - break; + case 2: return 'something-else'; - break; + default: return FALSE; - break; } } diff --git a/core/modules/config_translation/src/ConfigEntityMapper.php b/core/modules/config_translation/src/ConfigEntityMapper.php index 5ba4456ca580..faf899100b20 100644 --- a/core/modules/config_translation/src/ConfigEntityMapper.php +++ b/core/modules/config_translation/src/ConfigEntityMapper.php @@ -120,7 +120,7 @@ public function getEntity() { return $this->entity; } - /** + /** * Sets the entity instance for this mapper. * * This method can only be invoked when the concrete entity is known, that is diff --git a/core/modules/contact/src/ContactFormEditForm.php b/core/modules/contact/src/ContactFormEditForm.php index 473d31775900..7747dadb65ef 100644 --- a/core/modules/contact/src/ContactFormEditForm.php +++ b/core/modules/contact/src/ContactFormEditForm.php @@ -40,8 +40,8 @@ class ContactFormEditForm extends EntityForm implements ContainerInjectionInterf * The email validator. */ public function __construct(EmailValidator $email_validator, PathValidatorInterface $path_validator) { - $this->emailValidator = $email_validator; - $this->pathValidator = $path_validator; + $this->emailValidator = $email_validator; + $this->pathValidator = $path_validator; } /** diff --git a/core/modules/contact/tests/drupal-7.contact.database.php b/core/modules/contact/tests/drupal-7.contact.database.php index 494e430cf68b..115f83c17cff 100644 --- a/core/modules/contact/tests/drupal-7.contact.database.php +++ b/core/modules/contact/tests/drupal-7.contact.database.php @@ -23,11 +23,11 @@ 'weight', 'selected' )) -->values(array( + ->values(array( 'category' => 'Upgrade test', 'recipients' => 'test1@example.com,test2@example.com', 'reply' => 'Test reply', 'weight' => 1, 'selected' => 1, )) -->execute(); + ->execute(); diff --git a/core/modules/datetime/datetime.module b/core/modules/datetime/datetime.module index f25140f0b061..107854199276 100644 --- a/core/modules/datetime/datetime.module +++ b/core/modules/datetime/datetime.module @@ -39,7 +39,7 @@ function datetime_help($route_name, RouteMatchInterface $route_match) { $output .= '<dd>' . t('Dates can be displayed using the <em>Plain</em> or the <em>Default</em> formatter. The <em>Plain</em> formatter displays the date in the <a href="http://en.wikipedia.org/wiki/ISO_8601">ISO 8601</a> format. If you choose the <em>Default</em> formatter, you can choose a format from a predefined list that can be managed on the <a href=":date_format_list">Date and time formats</a> page.', array(':date_format_list' => \Drupal::url('entity.date_format.collection'))) . '</dd>'; $output .= '</dl>'; return $output; - } + } } /** diff --git a/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDatelistWidget.php b/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDatelistWidget.php index c88c5c8341c6..8cdabf139637 100644 --- a/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDatelistWidget.php +++ b/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDatelistWidget.php @@ -61,16 +61,16 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen break; } switch ($time_type) { - case '24': - $date_part_order = array_merge($date_part_order, array('hour', 'minute')); - break; + case '24': + $date_part_order = array_merge($date_part_order, array('hour', 'minute')); + break; - case '12': - $date_part_order = array_merge($date_part_order, array('hour', 'minute', 'ampm')); - break; + case '12': + $date_part_order = array_merge($date_part_order, array('hour', 'minute', 'ampm')); + break; - case 'none': - break; + case 'none': + break; } $element['value'] = array( diff --git a/core/modules/datetime/src/Tests/DateTimeFieldTest.php b/core/modules/datetime/src/Tests/DateTimeFieldTest.php index ce598bfa2f36..64576f38d01d 100644 --- a/core/modules/datetime/src/Tests/DateTimeFieldTest.php +++ b/core/modules/datetime/src/Tests/DateTimeFieldTest.php @@ -631,7 +631,7 @@ function testDatelistWidget() { $this->drupalPostForm(NULL, $edit, t('Save')); $this->assertResponse(200); $this->assertOptionSelected("edit-$field_name-0-value-minute", '0', 'Correct minute selected.'); - } + } /** * The data provider for testing the validation of the datelist widget. diff --git a/core/modules/dblog/src/Tests/DbLogTest.php b/core/modules/dblog/src/Tests/DbLogTest.php index 90cb6c2bf396..886f7681e973 100644 --- a/core/modules/dblog/src/Tests/DbLogTest.php +++ b/core/modules/dblog/src/Tests/DbLogTest.php @@ -236,14 +236,14 @@ protected function clearLogsEntries() { * (optional) The log entry severity. */ protected function filterLogsEntries($type = NULL, $severity = NULL) { - $edit = array(); - if (!is_null($type)) { - $edit['type[]'] = $type; - } - if (!is_null($severity)) { - $edit['severity[]'] = $severity; - } - $this->drupalPostForm(NULL, $edit, t('Filter')); + $edit = array(); + if (!is_null($type)) { + $edit['type[]'] = $type; + } + if (!is_null($severity)) { + $edit['severity[]'] = $severity; + } + $this->drupalPostForm(NULL, $edit, t('Filter')); } /** diff --git a/core/modules/field/src/Plugin/migrate/source/d6/FieldInstancePerViewMode.php b/core/modules/field/src/Plugin/migrate/source/d6/FieldInstancePerViewMode.php index 93ba4efad3d1..2e1832e1b0a4 100644 --- a/core/modules/field/src/Plugin/migrate/source/d6/FieldInstancePerViewMode.php +++ b/core/modules/field/src/Plugin/migrate/source/d6/FieldInstancePerViewMode.php @@ -59,11 +59,11 @@ public function query() { 'label', 'display_settings', 'widget_settings', - )) - ->fields('cnf', array( + )) + ->fields('cnf', array( 'type', 'module', - )); + )); $query->join('content_node_field', 'cnf', 'cnfi.field_name = cnf.field_name'); $query->orderBy('cnfi.weight'); diff --git a/core/modules/field/src/Tests/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php b/core/modules/field/src/Tests/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php index d93b2acc5c6f..f0856d37bb06 100644 --- a/core/modules/field/src/Tests/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php +++ b/core/modules/field/src/Tests/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php @@ -223,7 +223,7 @@ protected function setUpEntityReferenceField() { 'bundle' => $this->referrerType->id(), 'entity_type' => $this->testEntityTypeName, ]) - ->save(); + ->save(); entity_get_form_display($this->testEntityTypeName, $this->referrerType->id(), 'default') ->setComponent($this->referenceFieldName, array( 'type' => 'entity_reference_autocomplete', diff --git a/core/modules/field_ui/src/Form/FieldConfigEditForm.php b/core/modules/field_ui/src/Form/FieldConfigEditForm.php index 827bf1b918a6..ff6d157117ed 100644 --- a/core/modules/field_ui/src/Form/FieldConfigEditForm.php +++ b/core/modules/field_ui/src/Form/FieldConfigEditForm.php @@ -167,7 +167,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $default_value = $items->defaultValuesFormSubmit($form['default_value'], $form, $form_state); } $this->entity->setDefaultValue($default_value); -} + } /** * {@inheritdoc} diff --git a/core/modules/file/src/Entity/File.php b/core/modules/file/src/Entity/File.php index b82d5a836528..cd7a65897f72 100644 --- a/core/modules/file/src/Entity/File.php +++ b/core/modules/file/src/Entity/File.php @@ -229,7 +229,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { $fields['uuid']->setDescription(t('The file UUID.')); $fields['langcode']->setLabel(t('Language code')) - ->setDescription(t('The file language code.')); + ->setDescription(t('The file language code.')); $fields['uid'] = BaseFieldDefinition::create('entity_reference') ->setLabel(t('User ID')) diff --git a/core/modules/filter/src/Plugin/FilterInterface.php b/core/modules/filter/src/Plugin/FilterInterface.php index 18f1fde893e3..0b7fcf0dc3db 100644 --- a/core/modules/filter/src/Plugin/FilterInterface.php +++ b/core/modules/filter/src/Plugin/FilterInterface.php @@ -77,25 +77,25 @@ */ interface FilterInterface extends ConfigurablePluginInterface, PluginInspectionInterface { - /** - * Non-HTML markup language filters that generate HTML. - */ - const TYPE_MARKUP_LANGUAGE = 0; + /** + * Non-HTML markup language filters that generate HTML. + */ + const TYPE_MARKUP_LANGUAGE = 0; - /** - * HTML tag and attribute restricting filters to prevent XSS attacks. - */ - const TYPE_HTML_RESTRICTOR = 1; + /** + * HTML tag and attribute restricting filters to prevent XSS attacks. + */ + const TYPE_HTML_RESTRICTOR = 1; - /** - * Reversible transformation filters. - */ - const TYPE_TRANSFORM_REVERSIBLE = 2; + /** + * Reversible transformation filters. + */ + const TYPE_TRANSFORM_REVERSIBLE = 2; - /** - * Irreversible transformation filters. - */ - const TYPE_TRANSFORM_IRREVERSIBLE = 3; + /** + * Irreversible transformation filters. + */ + const TYPE_TRANSFORM_IRREVERSIBLE = 3; /** * Returns the processing type of this filter plugin. diff --git a/core/modules/image/src/Tests/ImageFieldWidgetTest.php b/core/modules/image/src/Tests/ImageFieldWidgetTest.php index ea2332dd3599..52d9e4d5ca65 100644 --- a/core/modules/image/src/Tests/ImageFieldWidgetTest.php +++ b/core/modules/image/src/Tests/ImageFieldWidgetTest.php @@ -13,7 +13,7 @@ class ImageFieldWidgetTest extends ImageFieldTestBase { * Tests file widget element. */ public function testWidgetElement() { - // Check for image widget in add/node/article page + // Check for image widget in add/node/article page $field_name = strtolower($this->randomMachineName()); $min_resolution = 50; $max_resolution = 100; diff --git a/core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php b/core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php index 1fed32f3b39d..d03bc3bc998f 100644 --- a/core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php +++ b/core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php @@ -62,9 +62,9 @@ function testImageStyleUrlAndPathPrivate() { /** * Tests an image style URL with the "public://" scheme and unclean URLs. */ - function testImageStyleUrlAndPathPublicUnclean() { - $this->doImageStyleUrlAndPathTests('public', FALSE); - } + function testImageStyleUrlAndPathPublicUnclean() { + $this->doImageStyleUrlAndPathTests('public', FALSE); + } /** * Tests an image style URL with the "private://" schema and unclean URLs. diff --git a/core/modules/image/tests/src/Kernel/Migrate/d6/MigrateImageCacheTest.php b/core/modules/image/tests/src/Kernel/Migrate/d6/MigrateImageCacheTest.php index 28e11bdf6ee1..98db7b18ccf6 100644 --- a/core/modules/image/tests/src/Kernel/Migrate/d6/MigrateImageCacheTest.php +++ b/core/modules/image/tests/src/Kernel/Migrate/d6/MigrateImageCacheTest.php @@ -86,64 +86,64 @@ public function testPassingMigration() { /** * Test that missing actions causes failures. */ - public function testMissingEffectPlugin() { - Database::getConnection('default', 'migrate')->insert("imagecache_action") + public function testMissingEffectPlugin() { + Database::getConnection('default', 'migrate')->insert("imagecache_action") ->fields([ - 'presetid', - 'weight', - 'module', - 'action', - 'data', - ]) + 'presetid', + 'weight', + 'module', + 'action', + 'data', + ]) ->values([ - 'presetid' => '1', - 'weight' => '0', - 'module' => 'imagecache', - 'action' => 'imagecache_deprecated_scale', - 'data' => 'a:3:{s:3:"fit";s:7:"outside";s:5:"width";s:3:"200";s:6:"height";s:3:"200";}', - ])->execute(); - - $this->startCollectingMessages(); - $this->executeMigration('d6_imagecache_presets'); - $messages = $this->migration->getIdMap()->getMessageIterator(); - $count = 0; - foreach ($messages as $message) { - $count++; - $this->assertEqual($message->message, 'The "image_deprecated_scale" plugin does not exist.'); - $this->assertEqual($message->level, MigrationInterface::MESSAGE_ERROR); - } - // There should be only the one message. - $this->assertEqual($count, 1); + 'presetid' => '1', + 'weight' => '0', + 'module' => 'imagecache', + 'action' => 'imagecache_deprecated_scale', + 'data' => 'a:3:{s:3:"fit";s:7:"outside";s:5:"width";s:3:"200";s:6:"height";s:3:"200";}', + ])->execute(); + + $this->startCollectingMessages(); + $this->executeMigration('d6_imagecache_presets'); + $messages = $this->migration->getIdMap()->getMessageIterator(); + $count = 0; + foreach ($messages as $message) { + $count++; + $this->assertEqual($message->message, 'The "image_deprecated_scale" plugin does not exist.'); + $this->assertEqual($message->level, MigrationInterface::MESSAGE_ERROR); + } + // There should be only the one message. + $this->assertEqual($count, 1); } /** * Test that missing action's causes failures. */ - public function testInvalidCropValues() { - Database::getConnection('default', 'migrate')->insert("imagecache_action") + public function testInvalidCropValues() { + Database::getConnection('default', 'migrate')->insert("imagecache_action") ->fields([ - 'presetid', - 'weight', - 'module', - 'action', - 'data', - ]) + 'presetid', + 'weight', + 'module', + 'action', + 'data', + ]) ->values([ - 'presetid' => '1', - 'weight' => '0', - 'module' => 'imagecache', - 'action' => 'imagecache_crop', - 'data' => serialize([ - 'xoffset' => '10', - 'yoffset' => '10', - ]), - ])->execute(); - - $this->startCollectingMessages(); - $this->executeMigration('d6_imagecache_presets'); - $this->assertEqual(['error' => [ - 'The Drupal 8 image crop effect does not support numeric values for x and y offsets. Use keywords to set crop effect offsets instead.' - ]], $this->migrateMessages); + 'presetid' => '1', + 'weight' => '0', + 'module' => 'imagecache', + 'action' => 'imagecache_crop', + 'data' => serialize([ + 'xoffset' => '10', + 'yoffset' => '10', + ]), + ])->execute(); + + $this->startCollectingMessages(); + $this->executeMigration('d6_imagecache_presets'); + $this->assertEqual(['error' => [ + 'The Drupal 8 image crop effect does not support numeric values for x and y offsets. Use keywords to set crop effect offsets instead.' + ]], $this->migrateMessages); } /** diff --git a/core/modules/link/src/Plugin/migrate/cckfield/LinkField.php b/core/modules/link/src/Plugin/migrate/cckfield/LinkField.php index 47b383084a04..314e8df8a6e7 100644 --- a/core/modules/link/src/Plugin/migrate/cckfield/LinkField.php +++ b/core/modules/link/src/Plugin/migrate/cckfield/LinkField.php @@ -38,11 +38,11 @@ public function getFieldFormatterMap() { * {@inheritdoc} */ public function processCckFieldValues(MigrationInterface $migration, $field_name, $data) { - $process = [ - 'plugin' => 'd6_cck_link', - 'source' => $field_name, - ]; - $migration->mergeProcessOfProperty($field_name, $process); + $process = [ + 'plugin' => 'd6_cck_link', + 'source' => $field_name, + ]; + $migration->mergeProcessOfProperty($field_name, $process); } } diff --git a/core/modules/locale/src/StringDatabaseStorage.php b/core/modules/locale/src/StringDatabaseStorage.php index 01a0544e458e..058c68960b61 100644 --- a/core/modules/locale/src/StringDatabaseStorage.php +++ b/core/modules/locale/src/StringDatabaseStorage.php @@ -175,9 +175,9 @@ protected function checkVersion($string, $version) { if ($string->getId() && $string->getVersion() != $version) { $string->setVersion($version); $this->connection->update('locales_source', $this->options) - ->condition('lid', $string->getId()) - ->fields(array('version' => $version)) - ->execute(); + ->condition('lid', $string->getId()) + ->fields(array('version' => $version)) + ->execute(); } } diff --git a/core/modules/menu_link_content/src/Entity/MenuLinkContent.php b/core/modules/menu_link_content/src/Entity/MenuLinkContent.php index 1dcd1cd20a54..d23f876bea42 100644 --- a/core/modules/menu_link_content/src/Entity/MenuLinkContent.php +++ b/core/modules/menu_link_content/src/Entity/MenuLinkContent.php @@ -333,7 +333,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { 'type' => 'boolean', 'weight' => 0, )) - ->setDisplayOptions('form', array( + ->setDisplayOptions('form', array( 'settings' => array('display_label' => TRUE), 'weight' => 0, )); diff --git a/core/modules/menu_ui/src/Tests/MenuTest.php b/core/modules/menu_ui/src/Tests/MenuTest.php index f640cc749a6c..e9464ab23467 100644 --- a/core/modules/menu_ui/src/Tests/MenuTest.php +++ b/core/modules/menu_ui/src/Tests/MenuTest.php @@ -916,7 +916,7 @@ private function verifyAccess($response = 200) { // View tools menu customization page. $this->drupalGet('admin/structure/menu/manage/' . $this->menu->id()); - $this->assertResponse($response); + $this->assertResponse($response); if ($response == 200) { $this->assertText(t('Tools'), 'Tools menu page was displayed'); } diff --git a/core/modules/migrate/src/Event/MigratePreRowSaveEvent.php b/core/modules/migrate/src/Event/MigratePreRowSaveEvent.php index 5e563bbd1080..98a1c0a53edf 100644 --- a/core/modules/migrate/src/Event/MigratePreRowSaveEvent.php +++ b/core/modules/migrate/src/Event/MigratePreRowSaveEvent.php @@ -28,7 +28,7 @@ class MigratePreRowSaveEvent extends EventBase { * @param \Drupal\migrate\Row $row */ public function __construct(MigrationInterface $migration, MigrateMessageInterface $message, Row $row) { - parent::__construct($migration, $message); + parent::__construct($migration, $message); $this->row = $row; } diff --git a/core/modules/migrate/src/MigrateExecutable.php b/core/modules/migrate/src/MigrateExecutable.php index 7368acd96441..50bf0181c96a 100644 --- a/core/modules/migrate/src/MigrateExecutable.php +++ b/core/modules/migrate/src/MigrateExecutable.php @@ -185,11 +185,17 @@ public function import() { } catch (RequirementsException $e) { $this->message->display( - $this->t('Migration @id did not meet the requirements. @message @requirements', array( - '@id' => $this->migration->id(), - '@message' => $e->getMessage(), - '@requirements' => $e->getRequirementsString(), - )), 'error'); + $this->t( + 'Migration @id did not meet the requirements. @message @requirements', + array( + '@id' => $this->migration->id(), + '@message' => $e->getMessage(), + '@requirements' => $e->getRequirementsString(), + ) + ), + 'error' + ); + return MigrationInterface::RESULT_FAILED; } @@ -476,30 +482,44 @@ protected function memoryExceeded() { } if ($pct_memory > $threshold) { $this->message->display( - $this->t('Memory usage is @usage (@pct% of limit @limit), reclaiming memory.', - array('@pct' => round($pct_memory * 100), - '@usage' => $this->formatSize($usage), - '@limit' => $this->formatSize($this->memoryLimit))), - 'warning'); + $this->t( + 'Memory usage is @usage (@pct% of limit @limit), reclaiming memory.', + array( + '@pct' => round($pct_memory * 100), + '@usage' => $this->formatSize($usage), + '@limit' => $this->formatSize($this->memoryLimit), + ) + ), + 'warning' + ); $usage = $this->attemptMemoryReclaim(); $pct_memory = $usage / $this->memoryLimit; // Use a lower threshold - we don't want to be in a situation where we keep // coming back here and trimming a tiny amount if ($pct_memory > (0.90 * $threshold)) { $this->message->display( - $this->t('Memory usage is now @usage (@pct% of limit @limit), not enough reclaimed, starting new batch', - array('@pct' => round($pct_memory * 100), - '@usage' => $this->formatSize($usage), - '@limit' => $this->formatSize($this->memoryLimit))), - 'warning'); + $this->t( + 'Memory usage is now @usage (@pct% of limit @limit), not enough reclaimed, starting new batch', + array( + '@pct' => round($pct_memory * 100), + '@usage' => $this->formatSize($usage), + '@limit' => $this->formatSize($this->memoryLimit), + ) + ), + 'warning' + ); return TRUE; } else { $this->message->display( - $this->t('Memory usage is now @usage (@pct% of limit @limit), reclaimed enough, continuing', - array('@pct' => round($pct_memory * 100), - '@usage' => $this->formatSize($usage), - '@limit' => $this->formatSize($this->memoryLimit))), + $this->t( + 'Memory usage is now @usage (@pct% of limit @limit), reclaimed enough, continuing', + array( + '@pct' => round($pct_memory * 100), + '@usage' => $this->formatSize($usage), + '@limit' => $this->formatSize($this->memoryLimit), + ) + ), 'warning'); return FALSE; } diff --git a/core/modules/migrate/tests/src/Unit/MigrateSourceTest.php b/core/modules/migrate/tests/src/Unit/MigrateSourceTest.php index 5e2a06e3f1fa..2b7f12f6d1b4 100644 --- a/core/modules/migrate/tests/src/Unit/MigrateSourceTest.php +++ b/core/modules/migrate/tests/src/Unit/MigrateSourceTest.php @@ -170,7 +170,7 @@ public function testCount() { $this->assertEquals(-1, $source->count()); } - /** + /** * Test that the key can be set for the count cache. * * @covers ::count diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/source/DrupalSqlBase.php b/core/modules/migrate_drupal/src/Plugin/migrate/source/DrupalSqlBase.php index 87bd66d3770a..2c3230fc8d7c 100644 --- a/core/modules/migrate_drupal/src/Plugin/migrate/source/DrupalSqlBase.php +++ b/core/modules/migrate_drupal/src/Plugin/migrate/source/DrupalSqlBase.php @@ -23,7 +23,7 @@ abstract class DrupalSqlBase extends SqlBase implements ContainerFactoryPluginIn use DependencyTrait; - /** + /** * The contents of the system table. * * @var array @@ -53,12 +53,12 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition } /** - * Retrieves all system data information from origin system. - * - * @return array - * List of system table information keyed by type and name. - */ - public function getSystemData() { + * Retrieves all system data information from origin system. + * + * @return array + * List of system table information keyed by type and name. + */ + public function getSystemData() { if (!isset($this->systemData)) { $this->systemData = array(); try { diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 8451c58fec27..5c86a137aeae 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -320,7 +320,7 @@ function node_type_load($name) { * A Body field object. */ function node_add_body_field(NodeTypeInterface $type, $label = 'Body') { - // Add or remove the body field, as needed. + // Add or remove the body field, as needed. $field_storage = FieldStorageConfig::loadByName('node', 'body'); $field = FieldConfig::loadByName('node', $type->id(), 'body'); if (empty($field)) { @@ -751,7 +751,7 @@ function node_get_recent($number = 10) { // If not, restrict the query to published nodes. $query->condition('status', NODE_PUBLISHED); } - } + } $nids = $query ->sort('changed', 'DESC') ->range(0, $number) diff --git a/core/modules/node/src/NodeTypeAccessControlHandler.php b/core/modules/node/src/NodeTypeAccessControlHandler.php index ad8223203765..b14bae3666d2 100644 --- a/core/modules/node/src/NodeTypeAccessControlHandler.php +++ b/core/modules/node/src/NodeTypeAccessControlHandler.php @@ -21,7 +21,6 @@ protected function checkAccess(EntityInterface $entity, $operation, AccountInter switch ($operation) { case 'view': return AccessResult::allowedIfHasPermission($account, 'access content'); - break; case 'delete': if ($entity->isLocked()) { @@ -34,7 +33,7 @@ protected function checkAccess(EntityInterface $entity, $operation, AccountInter default: return parent::checkAccess($entity, $operation, $account); - break; + } } diff --git a/core/modules/node/src/Tests/NodeAccessLanguageAwareCombinationTest.php b/core/modules/node/src/Tests/NodeAccessLanguageAwareCombinationTest.php index acf9217c40d4..1ee5bc27ad14 100644 --- a/core/modules/node/src/Tests/NodeAccessLanguageAwareCombinationTest.php +++ b/core/modules/node/src/Tests/NodeAccessLanguageAwareCombinationTest.php @@ -254,9 +254,9 @@ function testNodeAccessLanguageAwareCombination() { // Query with no language specified. The fallback (hu or und) will be used. $select = db_select('node', 'n') - ->fields('n', array('nid')) - ->addMetaData('account', $this->webUser) - ->addTag('node_access'); + ->fields('n', array('nid')) + ->addMetaData('account', $this->webUser) + ->addTag('node_access'); $nids = $select->execute()->fetchAllAssoc('nid'); // Four nodes should be returned with public Hungarian translations or the @@ -269,10 +269,10 @@ function testNodeAccessLanguageAwareCombination() { // Query with Hungarian (hu) specified. $select = db_select('node', 'n') - ->fields('n', array('nid')) - ->addMetaData('account', $this->webUser) - ->addMetaData('langcode', 'hu') - ->addTag('node_access'); + ->fields('n', array('nid')) + ->addMetaData('account', $this->webUser) + ->addMetaData('langcode', 'hu') + ->addTag('node_access'); $nids = $select->execute()->fetchAllAssoc('nid'); // Three nodes should be returned (with public Hungarian translations). @@ -283,10 +283,10 @@ function testNodeAccessLanguageAwareCombination() { // Query with Catalan (ca) specified. $select = db_select('node', 'n') - ->fields('n', array('nid')) - ->addMetaData('account', $this->webUser) - ->addMetaData('langcode', 'ca') - ->addTag('node_access'); + ->fields('n', array('nid')) + ->addMetaData('account', $this->webUser) + ->addMetaData('langcode', 'ca') + ->addTag('node_access'); $nids = $select->execute()->fetchAllAssoc('nid'); // Three nodes should be returned (with public Catalan translations). @@ -297,10 +297,10 @@ function testNodeAccessLanguageAwareCombination() { // Query with German (de) specified. $select = db_select('node', 'n') - ->fields('n', array('nid')) - ->addMetaData('account', $this->webUser) - ->addMetaData('langcode', 'de') - ->addTag('node_access'); + ->fields('n', array('nid')) + ->addMetaData('account', $this->webUser) + ->addMetaData('langcode', 'de') + ->addTag('node_access'); $nids = $select->execute()->fetchAllAssoc('nid'); // There are no nodes with German translations, so no results are returned. @@ -309,9 +309,9 @@ function testNodeAccessLanguageAwareCombination() { // Query the nodes table as admin user (full access) with the node access // tag and no specific langcode. $select = db_select('node', 'n') - ->fields('n', array('nid')) - ->addMetaData('account', $this->adminUser) - ->addTag('node_access'); + ->fields('n', array('nid')) + ->addMetaData('account', $this->adminUser) + ->addTag('node_access'); $nids = $select->execute()->fetchAllAssoc('nid'); // All nodes are returned. @@ -320,10 +320,10 @@ function testNodeAccessLanguageAwareCombination() { // Query the nodes table as admin user (full access) with the node access // tag and langcode de. $select = db_select('node', 'n') - ->fields('n', array('nid')) - ->addMetaData('account', $this->adminUser) - ->addMetaData('langcode', 'de') - ->addTag('node_access'); + ->fields('n', array('nid')) + ->addMetaData('account', $this->adminUser) + ->addMetaData('langcode', 'de') + ->addTag('node_access'); $nids = $select->execute()->fetchAllAssoc('nid'); // Even though there is no German translation, all nodes are returned diff --git a/core/modules/node/src/Tests/NodeAccessLanguageAwareTest.php b/core/modules/node/src/Tests/NodeAccessLanguageAwareTest.php index ea5a8832f34e..0609b7ba9735 100644 --- a/core/modules/node/src/Tests/NodeAccessLanguageAwareTest.php +++ b/core/modules/node/src/Tests/NodeAccessLanguageAwareTest.php @@ -195,9 +195,9 @@ function testNodeAccessLanguageAware() { // Query with no language specified. The fallback (hu) will be used. $select = db_select('node', 'n') - ->fields('n', array('nid')) - ->addMetaData('account', $this->webUser) - ->addTag('node_access'); + ->fields('n', array('nid')) + ->addMetaData('account', $this->webUser) + ->addTag('node_access'); $nids = $select->execute()->fetchAllAssoc('nid'); // Three nodes should be returned: @@ -211,10 +211,10 @@ function testNodeAccessLanguageAware() { // Query with Hungarian (hu) specified. $select = db_select('node', 'n') - ->fields('n', array('nid')) - ->addMetaData('account', $this->webUser) - ->addMetaData('langcode', 'hu') - ->addTag('node_access'); + ->fields('n', array('nid')) + ->addMetaData('account', $this->webUser) + ->addMetaData('langcode', 'hu') + ->addTag('node_access'); $nids = $select->execute()->fetchAllAssoc('nid'); // Two nodes should be returned: the node with both translations public, and @@ -225,10 +225,10 @@ function testNodeAccessLanguageAware() { // Query with Catalan (ca) specified. $select = db_select('node', 'n') - ->fields('n', array('nid')) - ->addMetaData('account', $this->webUser) - ->addMetaData('langcode', 'ca') - ->addTag('node_access'); + ->fields('n', array('nid')) + ->addMetaData('account', $this->webUser) + ->addMetaData('langcode', 'ca') + ->addTag('node_access'); $nids = $select->execute()->fetchAllAssoc('nid'); // Two nodes should be returned: the node with both translations public, and @@ -239,10 +239,10 @@ function testNodeAccessLanguageAware() { // Query with German (de) specified. $select = db_select('node', 'n') - ->fields('n', array('nid')) - ->addMetaData('account', $this->webUser) - ->addMetaData('langcode', 'de') - ->addTag('node_access'); + ->fields('n', array('nid')) + ->addMetaData('account', $this->webUser) + ->addMetaData('langcode', 'de') + ->addTag('node_access'); $nids = $select->execute()->fetchAllAssoc('nid'); // There are no nodes with German translations, so no results are returned. @@ -251,9 +251,9 @@ function testNodeAccessLanguageAware() { // Query the nodes table as admin user (full access) with the node access // tag and no specific langcode. $select = db_select('node', 'n') - ->fields('n', array('nid')) - ->addMetaData('account', $this->adminUser) - ->addTag('node_access'); + ->fields('n', array('nid')) + ->addMetaData('account', $this->adminUser) + ->addTag('node_access'); $nids = $select->execute()->fetchAllAssoc('nid'); // All nodes are returned. @@ -262,10 +262,10 @@ function testNodeAccessLanguageAware() { // Query the nodes table as admin user (full access) with the node access // tag and langcode de. $select = db_select('node', 'n') - ->fields('n', array('nid')) - ->addMetaData('account', $this->adminUser) - ->addMetaData('langcode', 'de') - ->addTag('node_access'); + ->fields('n', array('nid')) + ->addMetaData('account', $this->adminUser) + ->addMetaData('langcode', 'de') + ->addTag('node_access'); $nids = $select->execute()->fetchAllAssoc('nid'); // Even though there is no German translation, all nodes are returned diff --git a/core/modules/node/src/Tests/NodeAccessLanguageTest.php b/core/modules/node/src/Tests/NodeAccessLanguageTest.php index 5d55a5b90a7f..e0393a0a18f8 100644 --- a/core/modules/node/src/Tests/NodeAccessLanguageTest.php +++ b/core/modules/node/src/Tests/NodeAccessLanguageTest.php @@ -204,9 +204,9 @@ function testNodeAccessQueryTag() { // Query the nodes table as the web user with the node access tag and no // specific langcode. $select = db_select('node', 'n') - ->fields('n', array('nid')) - ->addMetaData('account', $web_user) - ->addTag('node_access'); + ->fields('n', array('nid')) + ->addMetaData('account', $web_user) + ->addTag('node_access'); $nids = $select->execute()->fetchAllAssoc('nid'); // The public node and no language node should be returned. Because no @@ -218,10 +218,10 @@ function testNodeAccessQueryTag() { // Query the nodes table as the web user with the node access tag and // langcode de. $select = db_select('node', 'n') - ->fields('n', array('nid')) - ->addMetaData('account', $web_user) - ->addMetaData('langcode', 'de') - ->addTag('node_access'); + ->fields('n', array('nid')) + ->addMetaData('account', $web_user) + ->addMetaData('langcode', 'de') + ->addTag('node_access'); $nids = $select->execute()->fetchAllAssoc('nid'); // Because no nodes are created in German, no nodes are returned. @@ -230,9 +230,9 @@ function testNodeAccessQueryTag() { // Query the nodes table as admin user (full access) with the node access // tag and no specific langcode. $select = db_select('node', 'n') - ->fields('n', array('nid')) - ->addMetaData('account', $admin_user) - ->addTag('node_access'); + ->fields('n', array('nid')) + ->addMetaData('account', $admin_user) + ->addTag('node_access'); $nids = $select->execute()->fetchAllAssoc('nid'); // All nodes are returned. @@ -241,10 +241,10 @@ function testNodeAccessQueryTag() { // Query the nodes table as admin user (full access) with the node access // tag and langcode de. $select = db_select('node', 'n') - ->fields('n', array('nid')) - ->addMetaData('account', $admin_user) - ->addMetaData('langcode', 'de') - ->addTag('node_access'); + ->fields('n', array('nid')) + ->addMetaData('account', $admin_user) + ->addMetaData('langcode', 'de') + ->addTag('node_access'); $nids = $select->execute()->fetchAllAssoc('nid'); // All nodes are returned because node access tag is not invoked when the diff --git a/core/modules/node/src/Tests/NodeFieldMultilingualTest.php b/core/modules/node/src/Tests/NodeFieldMultilingualTest.php index 9beae5df8588..3bd1a51ef6d6 100644 --- a/core/modules/node/src/Tests/NodeFieldMultilingualTest.php +++ b/core/modules/node/src/Tests/NodeFieldMultilingualTest.php @@ -119,7 +119,7 @@ function testMultilingualDisplaySettings() { // Check if node body is showed. $this->drupalGet('node/' . $node->id()); - $body = $this->xpath('//article[contains(concat(" ", normalize-space(@class), " "), :node-class)]//div[contains(concat(" ", normalize-space(@class), " "), :content-class)]/descendant::p', array( + $body = $this->xpath('//article[contains(concat(" ", normalize-space(@class), " "), :node-class)]//div[contains(concat(" ", normalize-space(@class), " "), :content-class)]/descendant::p', array( ':node-class' => ' node ', ':content-class' => 'node__content', )); diff --git a/core/modules/options/src/Plugin/Field/FieldType/ListItemBase.php b/core/modules/options/src/Plugin/Field/FieldType/ListItemBase.php index 55108d5d6196..aaea32f9b156 100644 --- a/core/modules/options/src/Plugin/Field/FieldType/ListItemBase.php +++ b/core/modules/options/src/Plugin/Field/FieldType/ListItemBase.php @@ -65,11 +65,11 @@ public function getSettableOptions(AccountInterface $account = NULL) { /** * {@inheritdoc} */ - public static function generateSampleValue(FieldDefinitionInterface $field_definition) { - $allowed_options = options_allowed_values($field_definition->getFieldStorageDefinition()); - $values['value'] = array_rand($allowed_options); - return $values; - } + public static function generateSampleValue(FieldDefinitionInterface $field_definition) { + $allowed_options = options_allowed_values($field_definition->getFieldStorageDefinition()); + $values['value'] = array_rand($allowed_options); + return $values; + } /** * {@inheritdoc} diff --git a/core/modules/rest/src/Tests/RESTTestBase.php b/core/modules/rest/src/Tests/RESTTestBase.php index 4f8a0f196e73..a7fb62ac6298 100644 --- a/core/modules/rest/src/Tests/RESTTestBase.php +++ b/core/modules/rest/src/Tests/RESTTestBase.php @@ -115,15 +115,15 @@ protected function httpRequest($url, $method, $body = NULL, $mime_type = NULL, $ ); break; - case 'HEAD': - $curl_options = array( - CURLOPT_HTTPGET => FALSE, - CURLOPT_CUSTOMREQUEST => 'HEAD', - CURLOPT_URL => $url, - CURLOPT_NOBODY => TRUE, - CURLOPT_HTTPHEADER => array('Accept: ' . $mime_type), - ); - break; + case 'HEAD': + $curl_options = array( + CURLOPT_HTTPGET => FALSE, + CURLOPT_CUSTOMREQUEST => 'HEAD', + CURLOPT_URL => $url, + CURLOPT_NOBODY => TRUE, + CURLOPT_HTTPHEADER => array('Accept: ' . $mime_type), + ); + break; case 'POST': $curl_options = array( diff --git a/core/modules/rest/src/Tests/Views/StyleSerializerTest.php b/core/modules/rest/src/Tests/Views/StyleSerializerTest.php index 50e0e7472c2a..4c004fcafcdd 100644 --- a/core/modules/rest/src/Tests/Views/StyleSerializerTest.php +++ b/core/modules/rest/src/Tests/Views/StyleSerializerTest.php @@ -353,7 +353,7 @@ public function testResponseFormatConfiguration() { $this->drupalGetWithFormat('test/serialize/field', 'json'); $this->assertHeader('content-type', 'application/json'); $this->assertResponse(406, 'A 406 response was returned when JSON was requested.'); - // Should return a 200. + // Should return a 200. $this->drupalGetWithFormat('test/serialize/field', 'xml'); $this->assertHeader('content-type', 'text/xml; charset=UTF-8'); $this->assertResponse(200, 'A 200 response was returned when XML was requested.'); @@ -551,7 +551,7 @@ public function testLivePreview() { // We set up a request so it looks like an request in the live preview. $request = new Request(); $request->query->add([MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']); - /** @var \Symfony\Component\HttpFoundation\RequestStack $request_stack */ + /** @var \Symfony\Component\HttpFoundation\RequestStack $request_stack */ $request_stack = \Drupal::service('request_stack'); $request_stack->push($request); diff --git a/core/modules/serialization/src/Normalizer/NormalizerBase.php b/core/modules/serialization/src/Normalizer/NormalizerBase.php index 934093ec2e33..90d9b7525816 100644 --- a/core/modules/serialization/src/Normalizer/NormalizerBase.php +++ b/core/modules/serialization/src/Normalizer/NormalizerBase.php @@ -72,6 +72,6 @@ protected function checkFormat($format = NULL) { } return in_array($format, (array) $this->format); - } + } } diff --git a/core/modules/shortcut/src/Form/ShortcutSetDeleteForm.php b/core/modules/shortcut/src/Form/ShortcutSetDeleteForm.php index 1a3cbf208c37..3c732d6bc8cd 100644 --- a/core/modules/shortcut/src/Form/ShortcutSetDeleteForm.php +++ b/core/modules/shortcut/src/Form/ShortcutSetDeleteForm.php @@ -70,6 +70,6 @@ public function buildForm(array $form, FormStateInterface $form_state) { ); return parent::buildForm($form, $form_state); - } + } } diff --git a/core/modules/simpletest/src/TestBase.php b/core/modules/simpletest/src/TestBase.php index 4258f8038812..944810a4aa8e 100644 --- a/core/modules/simpletest/src/TestBase.php +++ b/core/modules/simpletest/src/TestBase.php @@ -527,7 +527,7 @@ protected function getAssertionCall() { // The first element is the call. The second element is the caller. // We skip calls that occurred in one of the methods of our base classes // or in an assertion function. - while (($caller = $backtrace[1]) && + while (($caller = $backtrace[1]) && ((isset($caller['class']) && isset($this->skipClasses[$caller['class']])) || substr($caller['function'], 0, 6) == 'assert')) { // We remove that call. diff --git a/core/modules/system/src/Tests/Ajax/AjaxFormPageCacheTest.php b/core/modules/system/src/Tests/Ajax/AjaxFormPageCacheTest.php index 04a7e981e115..a537b73e81dc 100644 --- a/core/modules/system/src/Tests/Ajax/AjaxFormPageCacheTest.php +++ b/core/modules/system/src/Tests/Ajax/AjaxFormPageCacheTest.php @@ -33,61 +33,61 @@ protected function getFormBuildId() { * Create a simple form, then submit the form via AJAX to change to it. */ public function testSimpleAJAXFormValue() { - $this->drupalGet('ajax_forms_test_get_form'); - $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', 'Page was not cached.'); - $build_id_initial = $this->getFormBuildId(); + $this->drupalGet('ajax_forms_test_get_form'); + $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', 'Page was not cached.'); + $build_id_initial = $this->getFormBuildId(); - $edit = ['select' => 'green']; - $commands = $this->drupalPostAjaxForm(NULL, $edit, 'select'); - $build_id_first_ajax = $this->getFormBuildId(); - $this->assertNotEqual($build_id_initial, $build_id_first_ajax, 'Build id is changed in the simpletest-DOM on first AJAX submission'); - $expected = [ - 'command' => 'update_build_id', - 'old' => $build_id_initial, - 'new' => $build_id_first_ajax, - ]; - $this->assertCommand($commands, $expected, 'Build id change command issued on first AJAX submission'); + $edit = ['select' => 'green']; + $commands = $this->drupalPostAjaxForm(NULL, $edit, 'select'); + $build_id_first_ajax = $this->getFormBuildId(); + $this->assertNotEqual($build_id_initial, $build_id_first_ajax, 'Build id is changed in the simpletest-DOM on first AJAX submission'); + $expected = [ + 'command' => 'update_build_id', + 'old' => $build_id_initial, + 'new' => $build_id_first_ajax, + ]; + $this->assertCommand($commands, $expected, 'Build id change command issued on first AJAX submission'); - $edit = ['select' => 'red']; - $commands = $this->drupalPostAjaxForm(NULL, $edit, 'select'); - $build_id_second_ajax = $this->getFormBuildId(); - $this->assertNotEqual($build_id_first_ajax, $build_id_second_ajax, 'Build id changes on subsequent AJAX submissions'); - $expected = [ - 'command' => 'update_build_id', - 'old' => $build_id_first_ajax, - 'new' => $build_id_second_ajax, - ]; - $this->assertCommand($commands, $expected, 'Build id change command issued on subsequent AJAX submissions'); + $edit = ['select' => 'red']; + $commands = $this->drupalPostAjaxForm(NULL, $edit, 'select'); + $build_id_second_ajax = $this->getFormBuildId(); + $this->assertNotEqual($build_id_first_ajax, $build_id_second_ajax, 'Build id changes on subsequent AJAX submissions'); + $expected = [ + 'command' => 'update_build_id', + 'old' => $build_id_first_ajax, + 'new' => $build_id_second_ajax, + ]; + $this->assertCommand($commands, $expected, 'Build id change command issued on subsequent AJAX submissions'); - // Repeat the test sequence but this time with a page loaded from the cache. - $this->drupalGet('ajax_forms_test_get_form'); - $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.'); - $build_id_from_cache_initial = $this->getFormBuildId(); - $this->assertEqual($build_id_initial, $build_id_from_cache_initial, 'Build id is the same as on the first request'); + // Repeat the test sequence but this time with a page loaded from the cache. + $this->drupalGet('ajax_forms_test_get_form'); + $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.'); + $build_id_from_cache_initial = $this->getFormBuildId(); + $this->assertEqual($build_id_initial, $build_id_from_cache_initial, 'Build id is the same as on the first request'); - $edit = ['select' => 'green']; - $commands = $this->drupalPostAjaxForm(NULL, $edit, 'select'); - $build_id_from_cache_first_ajax = $this->getFormBuildId(); - $this->assertNotEqual($build_id_from_cache_initial, $build_id_from_cache_first_ajax, 'Build id is changed in the simpletest-DOM on first AJAX submission'); - $this->assertNotEqual($build_id_first_ajax, $build_id_from_cache_first_ajax, 'Build id from first user is not reused'); - $expected = [ - 'command' => 'update_build_id', - 'old' => $build_id_from_cache_initial, - 'new' => $build_id_from_cache_first_ajax, - ]; - $this->assertCommand($commands, $expected, 'Build id change command issued on first AJAX submission'); + $edit = ['select' => 'green']; + $commands = $this->drupalPostAjaxForm(NULL, $edit, 'select'); + $build_id_from_cache_first_ajax = $this->getFormBuildId(); + $this->assertNotEqual($build_id_from_cache_initial, $build_id_from_cache_first_ajax, 'Build id is changed in the simpletest-DOM on first AJAX submission'); + $this->assertNotEqual($build_id_first_ajax, $build_id_from_cache_first_ajax, 'Build id from first user is not reused'); + $expected = [ + 'command' => 'update_build_id', + 'old' => $build_id_from_cache_initial, + 'new' => $build_id_from_cache_first_ajax, + ]; + $this->assertCommand($commands, $expected, 'Build id change command issued on first AJAX submission'); - $edit = ['select' => 'red']; - $commands = $this->drupalPostAjaxForm(NULL, $edit, 'select'); - $build_id_from_cache_second_ajax = $this->getFormBuildId(); - $this->assertNotEqual($build_id_from_cache_first_ajax, $build_id_from_cache_second_ajax, 'Build id changes on subsequent AJAX submissions'); - $expected = [ - 'command' => 'update_build_id', - 'old' => $build_id_from_cache_first_ajax, - 'new' => $build_id_from_cache_second_ajax, - ]; - $this->assertCommand($commands, $expected, 'Build id change command issued on subsequent AJAX submissions'); - } + $edit = ['select' => 'red']; + $commands = $this->drupalPostAjaxForm(NULL, $edit, 'select'); + $build_id_from_cache_second_ajax = $this->getFormBuildId(); + $this->assertNotEqual($build_id_from_cache_first_ajax, $build_id_from_cache_second_ajax, 'Build id changes on subsequent AJAX submissions'); + $expected = [ + 'command' => 'update_build_id', + 'old' => $build_id_from_cache_first_ajax, + 'new' => $build_id_from_cache_second_ajax, + ]; + $this->assertCommand($commands, $expected, 'Build id change command issued on subsequent AJAX submissions'); + } /** * Tests a form that uses an #ajax callback. diff --git a/core/modules/system/src/Tests/Form/ElementsVerticalTabsTest.php b/core/modules/system/src/Tests/Form/ElementsVerticalTabsTest.php index 3de1867b88d3..2e630cccae06 100644 --- a/core/modules/system/src/Tests/Form/ElementsVerticalTabsTest.php +++ b/core/modules/system/src/Tests/Form/ElementsVerticalTabsTest.php @@ -70,9 +70,9 @@ function testWrapperNotShownWhenEmpty() { $this->assertFalse(isset($wrapper[0]), 'Vertical tab wrappers are not displayed to unprivileged users.'); } - /** - * Ensures that default vertical tab is correctly selected. - */ + /** + * Ensures that default vertical tab is correctly selected. + */ function testDefaultTab() { $this->drupalGet('form_test/vertical-tabs'); $this->assertFieldByName('vertical_tabs__active_tab', 'edit-tab3', t('The default vertical tab is correctly selected.')); diff --git a/core/modules/system/src/Tests/Theme/EngineTwigTest.php b/core/modules/system/src/Tests/Theme/EngineTwigTest.php index a6b7acfe7655..ae08fc83527b 100644 --- a/core/modules/system/src/Tests/Theme/EngineTwigTest.php +++ b/core/modules/system/src/Tests/Theme/EngineTwigTest.php @@ -72,7 +72,7 @@ public function testTwigUrlGenerator() { public function testTwigLinkGenerator() { $this->drupalGet('twig-theme-test/link-generator'); - /** @var \Drupal\Core\Utility\LinkGenerator $link_generator */ + /** @var \Drupal\Core\Utility\LinkGenerator $link_generator */ $link_generator = $this->container->get('link_generator'); $expected = [ diff --git a/core/modules/system/src/Tests/Update/UpdatePathTestBase.php b/core/modules/system/src/Tests/Update/UpdatePathTestBase.php index 82169ad7cb76..2596cdf4da53 100644 --- a/core/modules/system/src/Tests/Update/UpdatePathTestBase.php +++ b/core/modules/system/src/Tests/Update/UpdatePathTestBase.php @@ -45,7 +45,7 @@ abstract class UpdatePathTestBase extends WebTestBase { */ protected static $modules = []; - /** + /** * The file path(s) to the dumped database(s) to load into the child site. * * The file system/tests/fixtures/update/drupal-8.bare.standard.php.gz is diff --git a/core/modules/system/src/Tests/Update/UpdateScriptTest.php b/core/modules/system/src/Tests/Update/UpdateScriptTest.php index d788636129df..b80ef82e3bc9 100644 --- a/core/modules/system/src/Tests/Update/UpdateScriptTest.php +++ b/core/modules/system/src/Tests/Update/UpdateScriptTest.php @@ -232,9 +232,9 @@ function testMaintenanceModeUpdateFunctionality() { $this->assertEqual($final_maintenance_mode, $initial_maintenance_mode, 'Maintenance mode should not have changed after database updates.'); } - /** - * Tests perfoming updates with update.php in a multilingual environment. - */ + /** + * Tests perfoming updates with update.php in a multilingual environment. + */ function testSuccessfulMultilingualUpdateFunctionality() { // Add some custom languages. foreach (array('aa', 'bb') as $language_code) { @@ -242,7 +242,7 @@ function testSuccessfulMultilingualUpdateFunctionality() { 'id' => $language_code, 'label' => $this->randomMachineName(), ))->save(); - } + } $config = \Drupal::service('config.factory')->getEditable('language.negotiation'); // Ensure path prefix is used to determine the language. diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 178110517bed..154a55bf0f76 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -1219,10 +1219,10 @@ function system_update_8005() { case 'seven': $name = 'block.block.seven_local_actions'; - $values = [ - 'id' => 'seven_local_actions', - 'weight' => -10, - ] + $local_actions_default_settings; + $values = [ + 'id' => 'seven_local_actions', + 'weight' => -10, + ] + $local_actions_default_settings; _system_update_create_block($name, $theme_name, $values); $name = 'block.block.seven_primary_local_tasks'; 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 6ff4d8118197..2fcda10af17b 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 @@ -17,16 +17,16 @@ $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') - ->fields(array( + $connection->insert('config') + ->fields(array( 'collection', 'name', 'data', )) - ->values(array( + ->values(array( 'collection' => '', 'name' => 'views.view.' . $views_config['id'], 'data' => serialize($views_config), )) - ->execute(); + ->execute(); } diff --git a/core/modules/system/tests/modules/common_test/src/Render/MainContent/JsonRenderer.php b/core/modules/system/tests/modules/common_test/src/Render/MainContent/JsonRenderer.php index babf0314547e..bcecfbc5f4ba 100644 --- a/core/modules/system/tests/modules/common_test/src/Render/MainContent/JsonRenderer.php +++ b/core/modules/system/tests/modules/common_test/src/Render/MainContent/JsonRenderer.php @@ -46,19 +46,19 @@ public function __construct(TitleResolverInterface $title_resolver, RendererInte * {@inheritdoc} */ public function renderResponse(array $main_content, Request $request, RouteMatchInterface $route_match) { - $json = []; + $json = []; - $json['content'] = (string) $this->renderer->renderRoot($main_content); - if (!empty($main_content['#title'])) { - $json['title'] = (string) $main_content['#title']; - } - else { - $json['title'] = (string) $this->titleResolver->getTitle($request, $route_match->getRouteObject()); - } + $json['content'] = (string) $this->renderer->renderRoot($main_content); + if (!empty($main_content['#title'])) { + $json['title'] = (string) $main_content['#title']; + } + else { + $json['title'] = (string) $this->titleResolver->getTitle($request, $route_match->getRouteObject()); + } - $response = new CacheableJsonResponse($json, 200); - $response->addCacheableDependency(CacheableMetadata::createFromRenderArray($main_content)); - return $response; + $response = new CacheableJsonResponse($json, 200); + $response->addCacheableDependency(CacheableMetadata::createFromRenderArray($main_content)); + return $response; } } diff --git a/core/modules/system/tests/modules/httpkernel_test/src/HttpKernel/TestMiddleware.php b/core/modules/system/tests/modules/httpkernel_test/src/HttpKernel/TestMiddleware.php index 47842b71b314..f9e9849ef360 100644 --- a/core/modules/system/tests/modules/httpkernel_test/src/HttpKernel/TestMiddleware.php +++ b/core/modules/system/tests/modules/httpkernel_test/src/HttpKernel/TestMiddleware.php @@ -10,12 +10,12 @@ */ class TestMiddleware implements HttpKernelInterface { - /** - * The decorated kernel. - * - * @var \Symfony\Component\HttpKernel\HttpKernelInterface - */ - protected $kernel; + /** + * The decorated kernel. + * + * @var \Symfony\Component\HttpKernel\HttpKernelInterface + */ + protected $kernel; /** * An optional argument. @@ -35,21 +35,21 @@ class TestMiddleware implements HttpKernelInterface { public function __construct(HttpKernelInterface $kernel, $optional_argument = NULL) { $this->kernel = $kernel; $this->optionalArgument = $optional_argument; - } - - /** - * {@inheritdoc} - */ - public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) { - $request->attributes->set('_hello', 'world'); - if ($request->attributes->has('_optional_argument')) { - $request->attributes->set('_previous_optional_argument', $request->attributes->get('_optional_argument')); - } - elseif (isset($this->optionalArgument)) { - $request->attributes->set('_optional_argument', $this->optionalArgument); - } - - return $this->kernel->handle($request, $type, $catch); - } + } + + /** + * {@inheritdoc} + */ + public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) { + $request->attributes->set('_hello', 'world'); + if ($request->attributes->has('_optional_argument')) { + $request->attributes->set('_previous_optional_argument', $request->attributes->get('_optional_argument')); + } + elseif (isset($this->optionalArgument)) { + $request->attributes->set('_optional_argument', $this->optionalArgument); + } + + return $this->kernel->handle($request, $type, $catch); + } } diff --git a/core/modules/system/tests/modules/plugin_test/src/Plugin/DefaultsTestPluginManager.php b/core/modules/system/tests/modules/plugin_test/src/Plugin/DefaultsTestPluginManager.php index 457dbe500426..eda8f8845eaf 100644 --- a/core/modules/system/tests/modules/plugin_test/src/Plugin/DefaultsTestPluginManager.php +++ b/core/modules/system/tests/modules/plugin_test/src/Plugin/DefaultsTestPluginManager.php @@ -12,12 +12,12 @@ */ class DefaultsTestPluginManager extends DefaultPluginManager { - /** - * Constructs a new DefaultsTestPluginManager instance. - * - * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler - * The module handler. - */ + /** + * Constructs a new DefaultsTestPluginManager instance. + * + * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler + * The module handler. + */ public function __construct(ModuleHandlerInterface $module_handler) { // Create the object that can be used to return definitions for all the // plugins available for this type. Most real plugin managers use a richer diff --git a/core/modules/system/tests/src/Kernel/Scripts/DbCommandBaseTest.php b/core/modules/system/tests/src/Kernel/Scripts/DbCommandBaseTest.php index c11770d49032..1aa2f667abf5 100644 --- a/core/modules/system/tests/src/Kernel/Scripts/DbCommandBaseTest.php +++ b/core/modules/system/tests/src/Kernel/Scripts/DbCommandBaseTest.php @@ -99,10 +99,10 @@ public function testPrefix() { $this->assertEquals('extra2', $command->getDatabaseConnection($command_tester->getInput())->tablePrefix()); // This breaks simpletest cleanup. -// $command_tester->execute([ -// '--prefix' => 'notsimpletest', -// ]); -// $this->assertEquals('notsimpletest', $command->getDatabaseConnection($command_tester->getInput())->tablePrefix()); + // $command_tester->execute([ + // '--prefix' => 'notsimpletest', + // ]); + // $this->assertEquals('notsimpletest', $command->getDatabaseConnection($command_tester->getInput())->tablePrefix()); } } diff --git a/core/modules/taxonomy/src/TermAccessControlHandler.php b/core/modules/taxonomy/src/TermAccessControlHandler.php index 7a6a99107740..04c2c4f3fb7d 100644 --- a/core/modules/taxonomy/src/TermAccessControlHandler.php +++ b/core/modules/taxonomy/src/TermAccessControlHandler.php @@ -21,15 +21,12 @@ protected function checkAccess(EntityInterface $entity, $operation, AccountInter switch ($operation) { case 'view': return AccessResult::allowedIfHasPermission($account, 'access content'); - break; case 'update': return AccessResult::allowedIfHasPermissions($account, ["edit terms in {$entity->bundle()}", 'administer taxonomy'], 'OR'); - break; case 'delete': return AccessResult::allowedIfHasPermissions($account, ["delete terms in {$entity->bundle()}", 'administer taxonomy'], 'OR'); - break; default: // No opinion. diff --git a/core/modules/taxonomy/tests/src/Kernel/ForwardRevisionTest.php b/core/modules/taxonomy/tests/src/Kernel/ForwardRevisionTest.php index 6f751b12a119..abc0846fc507 100644 --- a/core/modules/taxonomy/tests/src/Kernel/ForwardRevisionTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/ForwardRevisionTest.php @@ -113,9 +113,9 @@ public function testTaxonomyIndexWithForwardRevision() { protected function getTaxonomyIndex() { return \Drupal::database()->select('taxonomy_index') - ->fields('taxonomy_index') - ->execute() - ->fetchAllAssoc('nid'); + ->fields('taxonomy_index') + ->execute() + ->fetchAllAssoc('nid'); } } diff --git a/core/modules/text/src/Plugin/migrate/cckfield/TextField.php b/core/modules/text/src/Plugin/migrate/cckfield/TextField.php index cc4c1ecf7e42..89475ffd220b 100644 --- a/core/modules/text/src/Plugin/migrate/cckfield/TextField.php +++ b/core/modules/text/src/Plugin/migrate/cckfield/TextField.php @@ -120,7 +120,6 @@ public function getFieldType(Row $row) { return 'text_long'; default: return parent::getFieldType($row); - break; } } } diff --git a/core/modules/toolbar/tests/modules/toolbar_test/toolbar_test.module b/core/modules/toolbar/tests/modules/toolbar_test/toolbar_test.module index 78c2d090b052..4a82ca7cb2e9 100644 --- a/core/modules/toolbar/tests/modules/toolbar_test/toolbar_test.module +++ b/core/modules/toolbar/tests/modules/toolbar_test/toolbar_test.module @@ -12,7 +12,7 @@ */ function toolbar_test_toolbar() { - $items['testing'] = array( + $items['testing'] = array( '#type' => 'toolbar_item', 'tab' => array( '#type' => 'link', diff --git a/core/modules/tour/src/Tests/TourCacheTagsTest.php b/core/modules/tour/src/Tests/TourCacheTagsTest.php index 4e0972dcf088..4f2164e1884c 100644 --- a/core/modules/tour/src/Tests/TourCacheTagsTest.php +++ b/core/modules/tour/src/Tests/TourCacheTagsTest.php @@ -29,7 +29,7 @@ protected function setUp() { // Give anonymous users permission to view nodes, so that we can verify the // cache tags of cached versions of node pages. Role::load(RoleInterface::ANONYMOUS_ID)->grantPermission('access tour') - ->save(); + ->save(); } /** diff --git a/core/modules/update/src/Form/UpdateReady.php b/core/modules/update/src/Form/UpdateReady.php index ba686143f3e8..c8f64a3ee3c3 100644 --- a/core/modules/update/src/Form/UpdateReady.php +++ b/core/modules/update/src/Form/UpdateReady.php @@ -42,7 +42,7 @@ class UpdateReady extends FormBase { * * @var string */ - protected $sitePath; + protected $sitePath; /** * Constructs a new UpdateReady object. diff --git a/core/modules/update/src/UpdateSettingsForm.php b/core/modules/update/src/UpdateSettingsForm.php index 1565f661e52a..d830de57f453 100644 --- a/core/modules/update/src/UpdateSettingsForm.php +++ b/core/modules/update/src/UpdateSettingsForm.php @@ -137,7 +137,7 @@ public function validateForm(array &$form, FormStateInterface $form_state) { */ public function submitForm(array &$form, FormStateInterface $form_state) { $config = $this->config('update.settings'); - // See if the update_check_disabled setting is being changed, and if so, + // See if the update_check_disabled setting is being changed, and if so, // invalidate all update status data. if ($form_state->getValue('update_check_disabled') != $config->get('check.disabled_extensions')) { update_storage_clear(); diff --git a/core/modules/update/update.module b/core/modules/update/update.module index 349f6944516a..f45b5893ea98 100644 --- a/core/modules/update/update.module +++ b/core/modules/update/update.module @@ -393,7 +393,7 @@ function update_refresh() { * @see \Drupal\update\UpdateProcessor::fetchData() */ function update_fetch_data() { - \Drupal::service('update.processor')->fetchData(); + \Drupal::service('update.processor')->fetchData(); } /** diff --git a/core/modules/user/src/Plugin/migrate/process/d6/UserUpdate7002.php b/core/modules/user/src/Plugin/migrate/process/d6/UserUpdate7002.php index 2f95a7558081..0efae5d6b3d5 100644 --- a/core/modules/user/src/Plugin/migrate/process/d6/UserUpdate7002.php +++ b/core/modules/user/src/Plugin/migrate/process/d6/UserUpdate7002.php @@ -25,11 +25,11 @@ class UserUpdate7002 extends ProcessPluginBase implements ContainerFactoryPlugin */ protected static $timezones; - /** - * Contains the system.theme configuration object. - * - * @var \Drupal\Core\Config\Config - */ + /** + * Contains the system.theme configuration object. + * + * @var \Drupal\Core\Config\Config + */ protected $dateConfig; /** diff --git a/core/modules/user/src/Plugin/views/field/Permissions.php b/core/modules/user/src/Plugin/views/field/Permissions.php index 42c78d2a6d4f..bd5c11d5d6c2 100644 --- a/core/modules/user/src/Plugin/views/field/Permissions.php +++ b/core/modules/user/src/Plugin/views/field/Permissions.php @@ -112,16 +112,4 @@ function render_item($count, $item) { return $item['permission']; } - /* - protected function documentSelfTokens(&$tokens) { - $tokens['[' . $this->options['id'] . '-role' . ']'] = $this->t('The name of the role.'); - $tokens['[' . $this->options['id'] . '-rid' . ']'] = $this->t('The role ID of the role.'); - } - - protected function addSelfTokens(&$tokens, $item) { - $tokens['[' . $this->options['id'] . '-role' . ']'] = $item['role']; - $tokens['[' . $this->options['id'] . '-rid' . ']'] = $item['rid']; - } - */ - } diff --git a/core/modules/user/src/Plugin/views/filter/Name.php b/core/modules/user/src/Plugin/views/filter/Name.php index 5f63cb309bb3..e241e876361c 100644 --- a/core/modules/user/src/Plugin/views/filter/Name.php +++ b/core/modules/user/src/Plugin/views/filter/Name.php @@ -96,9 +96,9 @@ protected function valueSubmit($form, FormStateInterface $form_state) { // prevent array filter from removing our anonymous user. } -/** - * {@inheritdoc} - */ + /** + * {@inheritdoc} + */ public function getValueOptions() { return $this->valueOptions; } diff --git a/core/modules/user/src/Tests/RestRegisterUserTest.php b/core/modules/user/src/Tests/RestRegisterUserTest.php index c10d0282810e..62e6bbc687ee 100644 --- a/core/modules/user/src/Tests/RestRegisterUserTest.php +++ b/core/modules/user/src/Tests/RestRegisterUserTest.php @@ -124,25 +124,10 @@ protected function createSerializedUser($name, $include_password = TRUE) { global $base_url; // New user info to be serialized. $data = [ - "_links" => - [ - "type" => ["href" => $base_url . "/rest/type/user/user"], - ], - "langcode" => [ - [ - "value" => "en", - ], - ], - "name" => [ - [ - "value" => $name, - ], - ], - "mail" => [ - [ - "value" => "$name@example.com", - ], - ], + "_links" => ["type" => ["href" => $base_url . "/rest/type/user/user"]], + "langcode" => [["value" => "en"]], + "name" => [["value" => $name]], + "mail" => [["value" => "$name@example.com"]], ]; if ($include_password) { $data['pass']['value'] = 'SuperSecretPassword'; diff --git a/core/modules/user/src/Tests/UserBlocksTest.php b/core/modules/user/src/Tests/UserBlocksTest.php index 40e63d8a4ce5..f66007e2d8ad 100644 --- a/core/modules/user/src/Tests/UserBlocksTest.php +++ b/core/modules/user/src/Tests/UserBlocksTest.php @@ -34,9 +34,9 @@ protected function setUp() { $this->drupalLogout($this->adminUser); } - /** - * Tests that user login block is hidden from user/login. - */ + /** + * Tests that user login block is hidden from user/login. + */ function testUserLoginBlockVisibility() { // Array keyed list where key being the URL address and value being expected // visibility as boolean type. @@ -51,7 +51,7 @@ function testUserLoginBlockVisibility() { $elements = $this->xpath('//div[contains(@class,"block-user-login-block") and @role="form"]'); if ($expected_visibility) { $this->assertTrue(!empty($elements), 'User login block in path "' . $path . '" should be visible'); - } + } else { $this->assertTrue(empty($elements), 'User login block in path "' . $path . '" should not be visible'); } diff --git a/core/modules/user/src/Tests/UserPasswordResetTest.php b/core/modules/user/src/Tests/UserPasswordResetTest.php index 4f87f8a9272d..c012e9f8d500 100644 --- a/core/modules/user/src/Tests/UserPasswordResetTest.php +++ b/core/modules/user/src/Tests/UserPasswordResetTest.php @@ -88,7 +88,7 @@ function testUserPasswordReset() { $edit['name'] = $this->account->getUsername(); $this->drupalPostForm(NULL, $edit, t('Submit')); - // Verify that the user was sent an email. + // Verify that the user was sent an email. $this->assertMail('to', $this->account->getEmail(), 'Password email sent to user.'); $subject = t('Replacement login information for @username at @site', array('@username' => $this->account->getUsername(), '@site' => $this->config('system.site')->get('name'))); $this->assertMail('subject', $subject, 'Password reset email subject is correct.'); @@ -332,6 +332,6 @@ function testResetImpersonation() { $this->assertNoText($user2->getUsername(), 'The invalid password reset page does not show the user name.'); $this->assertUrl('user/password', array(), 'The user is redirected to the password reset request page.'); $this->assertText('You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below.'); - } + } } diff --git a/core/modules/user/tests/fixtures/update/drupal-8.user-email-token-2587275.php b/core/modules/user/tests/fixtures/update/drupal-8.user-email-token-2587275.php index 28dab8b108c1..75ec703f8c76 100644 --- a/core/modules/user/tests/fixtures/update/drupal-8.user-email-token-2587275.php +++ b/core/modules/user/tests/fixtures/update/drupal-8.user-email-token-2587275.php @@ -14,8 +14,8 @@ // already. $connection->delete('config')->condition('name', 'user.mail')->execute(); $connection->insert('config') -->fields(array('collection', 'name', 'data')) -->values(array( + ->fields(array('collection', 'name', 'data')) + ->values(array( 'collection' => '', 'name' => 'user.mail', 'data' => "a:10:{s:14:\"cancel_confirm\";a:2:{s:4:\"body\";s:369:\"[user:name],\n\nA request to cancel your account has been made at [site:name].\n\nYou may now cancel your account on [site:url-brief] by clicking this link or copying and pasting it into your browser:\n\n[user:cancel-url]\n\nNOTE: The cancellation of your account is not reversible.\n\nThis link expires in one day and nothing will happen if it is not used.\n\n-- [site:name] team\";s:7:\"subject\";s:59:\"Account cancellation request for [user:name] at [site:name]\";}s:14:\"password_reset\";a:2:{s:4:\"body\";s:397:\"[user:name],\n\nA request to reset the password for your account has been made at [site:name].\n\nYou may now log in by clicking this link or copying and pasting it to your browser:\n\n[user:one-time-login-url]\n\nThis link can only be used once to log in and will lead you to a page where you can set your password. It expires after one day and nothing will happen if it's not used.\n\n-- [site:name] team\";s:7:\"subject\";s:60:\"Replacement login information for [user:name] at [site:name]\";}s:22:\"register_admin_created\";a:2:{s:4:\"body\";s:463:\"[user:name],\n\nA site administrator at [site:name] has created an account for you. You may now log in by clicking this link or copying and pasting it to your browser:\n\n[user:one-time-login-url]\n\nThis link can only be used once to log in and will lead you to a page where you can set your password.\n\nAfter setting your password, you will be able to log in at [site:login-url] in the future using:\n\nusername: [user:name]\npassword: Your password\n\n-- [site:name] team\";s:7:\"subject\";s:58:\"An administrator created an account for you at [site:name]\";}s:29:\"register_no_approval_required\";a:2:{s:4:\"body\";s:437:\"[user:name],\n\nThank you for registering at [site:name]. You may now log in by clicking this link or copying and pasting it to your browser:\n\n[user:one-time-login-url]\n\nThis link can only be used once to log in and will lead you to a page where you can set your password.\n\nAfter setting your password, you will be able to log in at [site:login-url] in the future using:\n\nusername: [user:name]\npassword: Your password\n\n-- [site:name] team\";s:7:\"subject\";s:46:\"Account details for [user:name] at [site:name]\";}s:25:\"register_pending_approval\";a:2:{s:4:\"body\";s:281:\"[user:name],\n\nThank you for registering at [site:name]. Your application for an account is currently pending approval. Once it has been approved, you will receive another email containing information about how to log in, set your password, and other details.\n\n\n-- [site:name] team\";s:7:\"subject\";s:71:\"Account details for [user:name] at [site:name] (pending admin approval)\";}s:31:\"register_pending_approval_admin\";a:2:{s:4:\"body\";s:56:\"[user:name] has applied for an account.\n\n[user:edit-url]\";s:7:\"subject\";s:71:\"Account details for [user:name] at [site:name] (pending admin approval)\";}s:16:\"status_activated\";a:2:{s:4:\"body\";s:446:\"[user:name],\n\nYour account at [site:name] has been activated.\n\nYou may now log in by clicking this link or copying and pasting it into your browser:\n\n[user:one-time-login-url]\n\nThis link can only be used once to log in and will lead you to a page where you can set your password.\n\nAfter setting your password, you will be able to log in at [site:login-url] in the future using:\n\nusername: [user:name]\npassword: Your password\n\n-- [site:name] team\";s:7:\"subject\";s:57:\"Account details for [user:name] at [site:name] (approved)\";}s:14:\"status_blocked\";a:2:{s:4:\"body\";s:89:\"[user:name],\n\nYour account on [site:account-name] has been blocked.\n\n-- [site:name] team\";s:7:\"subject\";s:56:\"Account details for [user:name] at [site:name] (blocked)\";}s:15:\"status_canceled\";a:2:{s:4:\"body\";s:82:\"[user:name],\n\nYour account on [site:name] has been canceled.\n\n-- [site:name] team\";s:7:\"subject\";s:57:\"Account details for [user:name] at [site:name] (canceled)\";}s:8:\"langcode\";s:2:\"en\";}" diff --git a/core/modules/user/tests/src/Unit/PermissionHandlerTest.php b/core/modules/user/tests/src/Unit/PermissionHandlerTest.php index 593d8c4f1aa4..b0b91da89f15 100644 --- a/core/modules/user/tests/src/Unit/PermissionHandlerTest.php +++ b/core/modules/user/tests/src/Unit/PermissionHandlerTest.php @@ -105,25 +105,25 @@ public function testBuildPermissionsYaml() { $url = vfsStream::url('modules'); mkdir($url . '/module_a'); - file_put_contents($url . '/module_a/module_a.permissions.yml', -"access_module_a: single_description" - ); + file_put_contents($url . '/module_a/module_a.permissions.yml', "access_module_a: single_description"); mkdir($url . '/module_b'); - file_put_contents($url . '/module_b/module_b.permissions.yml', -"'access module b': + file_put_contents($url . '/module_b/module_b.permissions.yml', <<<EOF +'access module b': title: 'Access B' description: 'bla bla' 'access module a via module b': title: 'Access A via B' provider: 'module_a' -"); +EOF + ); mkdir($url . '/module_c'); - file_put_contents($url . '/module_c/module_c.permissions.yml', -"'access_module_c': + file_put_contents($url . '/module_c/module_c.permissions.yml', <<<EOF +'access_module_c': title: 'Access C' description: 'bla bla' 'restrict access': TRUE -"); +EOF + ); $modules = array('module_a', 'module_b', 'module_c'); $extensions = array( 'module_a' => $this->mockModuleExtension('module_a', 'Module a'), @@ -187,9 +187,10 @@ public function testBuildPermissionsSortPerModule() { $url = vfsStream::url('modules'); mkdir($url . '/module_a'); - file_put_contents($url . '/module_a/module_a.permissions.yml', -"access_module_a2: single_description2 -access_module_a1: single_description1" + file_put_contents($url . '/module_a/module_a.permissions.yml', <<<EOF +access_module_a2: single_description2 +access_module_a1: single_description1 +EOF ); mkdir($url . '/module_b'); file_put_contents($url . '/module_b/module_b.permissions.yml', @@ -234,21 +235,24 @@ public function testBuildPermissionsYamlCallback() { $url = vfsStream::url('modules'); mkdir($url . '/module_a'); - file_put_contents($url . '/module_a/module_a.permissions.yml', -"permission_callbacks: + file_put_contents($url . '/module_a/module_a.permissions.yml', <<<EOF +permission_callbacks: - 'Drupal\\user\\Tests\\TestPermissionCallbacks::singleDescription' -"); +EOF + ); mkdir($url . '/module_b'); - file_put_contents($url . '/module_b/module_b.permissions.yml', -"permission_callbacks: + file_put_contents($url . '/module_b/module_b.permissions.yml', <<<EOF +permission_callbacks: - 'Drupal\\user\\Tests\\TestPermissionCallbacks::titleDescription' - 'Drupal\\user\\Tests\\TestPermissionCallbacks::titleProvider' -"); +EOF + ); mkdir($url . '/module_c'); - file_put_contents($url . '/module_c/module_c.permissions.yml', -"permission_callbacks: + file_put_contents($url . '/module_c/module_c.permissions.yml', <<<EOF +permission_callbacks: - 'Drupal\\user\\Tests\\TestPermissionCallbacks::titleDescriptionRestrictAccess' -"); +EOF + ); $modules = array('module_a', 'module_b', 'module_c'); $extensions = array( @@ -309,13 +313,14 @@ public function testPermissionsYamlStaticAndCallback() { $url = vfsStream::url('modules'); mkdir($url . '/module_a'); - file_put_contents($url . '/module_a/module_a.permissions.yml', -"'access module a': + file_put_contents($url . '/module_a/module_a.permissions.yml', <<<EOF +'access module a': title: 'Access A' description: 'bla bla' permission_callbacks: - 'Drupal\\user\\Tests\\TestPermissionCallbacks::titleDescription' -"); +EOF + ); $modules = array('module_a'); $extensions = array( diff --git a/core/modules/user/tests/src/Unit/Plugin/Core/Entity/UserTest.php b/core/modules/user/tests/src/Unit/Plugin/Core/Entity/UserTest.php index f3a542433e22..86ce8e9ac718 100644 --- a/core/modules/user/tests/src/Unit/Plugin/Core/Entity/UserTest.php +++ b/core/modules/user/tests/src/Unit/Plugin/Core/Entity/UserTest.php @@ -5,7 +5,7 @@ use Drupal\Tests\Core\Session\UserSessionTest; use Drupal\user\RoleInterface; - /** +/** * @coversDefaultClass \Drupal\user\Entity\User * @group user */ diff --git a/core/modules/user/user.module b/core/modules/user/user.module index c530547387c3..1e9f539e0c42 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -1334,7 +1334,7 @@ function user_toolbar() { $links_cache_contexts[] = 'user'; } else { - $links = array( + $links = array( 'login' => array( 'title' => t('Log in'), 'url' => Url::fromRoute('user.page'), diff --git a/core/modules/views/src/Plugin/views/area/Entity.php b/core/modules/views/src/Plugin/views/area/Entity.php index b1f5a1b18bbb..30c24ecb3a9e 100644 --- a/core/modules/views/src/Plugin/views/area/Entity.php +++ b/core/modules/views/src/Plugin/views/area/Entity.php @@ -115,7 +115,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $target = $target_entity->id(); } } - $form['target'] = [ + $form['target'] = [ '#title' => $this->t('@entity_type_label ID', ['@entity_type_label' => $label]), '#type' => 'textfield', '#default_value' => $target, diff --git a/core/modules/views/src/Plugin/views/area/View.php b/core/modules/views/src/Plugin/views/area/View.php index a624423a9f8a..12f417cf279d 100644 --- a/core/modules/views/src/Plugin/views/area/View.php +++ b/core/modules/views/src/Plugin/views/area/View.php @@ -28,37 +28,37 @@ class View extends AreaPluginBase { * * @var \Drupal\Core\Entity\EntityStorageInterface */ - protected $viewStorage; - - /** - * Constructs a View object. - * - * @param array $configuration - * A configuration array containing information about the plugin instance. - * @param string $plugin_id - * The plugin_id for the plugin instance. - * @param mixed $plugin_definition - * The plugin implementation definition. - * @param \Drupal\Core\Entity\EntityStorageInterface $view_storage - * The view storage. - */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityStorageInterface $view_storage) { - parent::__construct($configuration, $plugin_id, $plugin_definition); - - $this->viewStorage = $view_storage; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $container->get('entity.manager')->getStorage('view') - ); - } + protected $viewStorage; + + /** + * Constructs a View object. + * + * @param array $configuration + * A configuration array containing information about the plugin instance. + * @param string $plugin_id + * The plugin_id for the plugin instance. + * @param mixed $plugin_definition + * The plugin implementation definition. + * @param \Drupal\Core\Entity\EntityStorageInterface $view_storage + * The view storage. + */ + public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityStorageInterface $view_storage) { + parent::__construct($configuration, $plugin_id, $plugin_definition); + + $this->viewStorage = $view_storage; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { + return new static( + $configuration, + $plugin_id, + $plugin_definition, + $container->get('entity.manager')->getStorage('view') + ); + } /** * {@inheritdoc} diff --git a/core/modules/views/src/Plugin/views/display/Block.php b/core/modules/views/src/Plugin/views/display/Block.php index fe37d919f65f..3e35d7e03092 100644 --- a/core/modules/views/src/Plugin/views/display/Block.php +++ b/core/modules/views/src/Plugin/views/display/Block.php @@ -346,11 +346,11 @@ public function preBlockBuild(ViewsBlock $block) { * Block views use exposed widgets only if AJAX is set. */ public function usesExposed() { - if ($this->ajaxEnabled()) { - return parent::usesExposed(); - } - return FALSE; + if ($this->ajaxEnabled()) { + return parent::usesExposed(); } + return FALSE; + } /** * {@inheritdoc} diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php index 102718d45373..37b6a4cc0222 100644 --- a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php @@ -37,7 +37,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte * * @var \Drupal\views\Plugin\views\ViewsHandlerInterface[] */ - public $handlers = []; + public $handlers = []; /** * An array of instantiated plugins used in this display. @@ -1051,9 +1051,9 @@ public function getArgumentsTokens() { if (!isset($tokens["%$count"])) { $tokens["%$count"] = ''; } - // Use strip tags as there should never be HTML in the path. - // However, we need to preserve special characters like " that - // were encoded by \Drupal\Component\Utility\Html::escape(). + // Use strip tags as there should never be HTML in the path. + // However, we need to preserve special characters like " that + // were encoded by \Drupal\Component\Utility\Html::escape(). $tokens["!$count"] = isset($this->view->args[$count - 1]) ? strip_tags(Html::decodeEntities($this->view->args[$count - 1])) : ''; } @@ -2236,7 +2236,7 @@ public function access(AccountInterface $account = NULL) { } $plugin = $this->getPlugin('access'); - /** @var \Drupal\views\Plugin\views\access\AccessPluginBase $plugin */ + /** @var \Drupal\views\Plugin\views\access\AccessPluginBase $plugin */ if ($plugin) { return $plugin->access($account); } diff --git a/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php b/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php index e4189c5bdeee..5c2a8d8c0fb3 100644 --- a/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php +++ b/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php @@ -540,7 +540,7 @@ public function buildExposeForm(&$form, FormStateInterface $form_state) { ); if (!empty($form['operator']['#type'])) { - // Increase the width of the left (operator) column. + // Increase the width of the left (operator) column. $form['operator']['#prefix'] = '<div class="views-group-box views-left-40">'; $form['operator']['#suffix'] = '</div>'; $form['value']['#prefix'] = '<div class="views-group-box views-right-60">'; @@ -1307,7 +1307,7 @@ public function convertExposedInput(&$input, $selected_group_id = NULL) { */ public function groupMultipleExposedInput(&$input) { if (!empty($input[$this->options['group_info']['identifier']])) { - return array_filter($input[$this->options['group_info']['identifier']]); + return array_filter($input[$this->options['group_info']['identifier']]); } return array(); } @@ -1491,9 +1491,9 @@ public function query() { * * @return bool */ - public function canGroup() { - return TRUE; - } + public function canGroup() { + return TRUE; + } /** * {@inheritdoc} diff --git a/core/modules/views/src/Plugin/views/pager/Mini.php b/core/modules/views/src/Plugin/views/pager/Mini.php index 640010df07d8..5f1750ea3cf0 100644 --- a/core/modules/views/src/Plugin/views/pager/Mini.php +++ b/core/modules/views/src/Plugin/views/pager/Mini.php @@ -38,7 +38,7 @@ public function summaryTitle() { if (!empty($this->options['offset'])) { return $this->formatPlural($this->options['items_per_page'], 'Mini pager, @count item, skip @skip', 'Mini pager, @count items, skip @skip', array('@count' => $this->options['items_per_page'], '@skip' => $this->options['offset'])); } - return $this->formatPlural($this->options['items_per_page'], 'Mini pager, @count item', 'Mini pager, @count items', array('@count' => $this->options['items_per_page'])); + return $this->formatPlural($this->options['items_per_page'], 'Mini pager, @count item', 'Mini pager, @count items', array('@count' => $this->options['items_per_page'])); } /** diff --git a/core/modules/views/src/Plugin/views/pager/Some.php b/core/modules/views/src/Plugin/views/pager/Some.php index 2205f9d32e1a..ef7f65d84375 100644 --- a/core/modules/views/src/Plugin/views/pager/Some.php +++ b/core/modules/views/src/Plugin/views/pager/Some.php @@ -22,7 +22,7 @@ public function summaryTitle() { if (!empty($this->options['offset'])) { return $this->formatPlural($this->options['items_per_page'], '@count item, skip @skip', '@count items, skip @skip', array('@count' => $this->options['items_per_page'], '@skip' => $this->options['offset'])); } - return $this->formatPlural($this->options['items_per_page'], '@count item', '@count items', array('@count' => $this->options['items_per_page'])); + return $this->formatPlural($this->options['items_per_page'], '@count item', '@count items', array('@count' => $this->options['items_per_page'])); } protected function defineOptions() { diff --git a/core/modules/views/src/Plugin/views/sort/SortPluginBase.php b/core/modules/views/src/Plugin/views/sort/SortPluginBase.php index cd9555eb3047..97122b1507de 100644 --- a/core/modules/views/src/Plugin/views/sort/SortPluginBase.php +++ b/core/modules/views/src/Plugin/views/sort/SortPluginBase.php @@ -64,11 +64,10 @@ public function adminSummary() { case 'asc': default: return $this->t('asc'); - break; + case 'DESC'; case 'desc'; return $this->t('desc'); - break; } } diff --git a/core/modules/views/src/Tests/Entity/FieldEntityTranslationTest.php b/core/modules/views/src/Tests/Entity/FieldEntityTranslationTest.php index eed71930198e..bd4e2ed1f787 100644 --- a/core/modules/views/src/Tests/Entity/FieldEntityTranslationTest.php +++ b/core/modules/views/src/Tests/Entity/FieldEntityTranslationTest.php @@ -69,8 +69,7 @@ public function testTranslationRows() { $translation->save(); $this->drupalGet('test_entity_field_renderers/entity_translation'); - $this->assertRows( - [ + $this->assertRows([ [ 'title' => 'example EN', 'sticky' => 'Off', @@ -82,82 +81,76 @@ public function testTranslationRows() { ]); $this->drupalGet('test_entity_field_renderers/entity_default'); - $this->assertRows( + $this->assertRows([ [ - [ - 'title' => 'example EN', - 'sticky' => 'Off', - ], - [ - 'title' => 'example EN', - 'sticky' => 'Off', - ], - ]); + 'title' => 'example EN', + 'sticky' => 'Off', + ], + [ + 'title' => 'example EN', + 'sticky' => 'Off', + ], + ]); $this->drupalGet('test_entity_field_renderers/site_default'); - $this->assertRows( + $this->assertRows([ + [ + 'title' => 'example EN', + 'sticky' => 'Off', + ], [ - [ - 'title' => 'example EN', - 'sticky' => 'Off', - ], - [ - 'title' => 'example EN', - 'sticky' => 'Off', - ], - ]); + 'title' => 'example EN', + 'sticky' => 'Off', + ], + ]); $this->drupalGet('test_entity_field_renderers/language_interface'); - $this->assertRows( + $this->assertRows([ + [ + 'title' => 'example EN', + 'sticky' => 'Off', + ], [ - [ - 'title' => 'example EN', - 'sticky' => 'Off', - ], - [ - 'title' => 'example EN', - 'sticky' => 'Off', - ], - ]); + 'title' => 'example EN', + 'sticky' => 'Off', + ], + ]); $this->drupalGet('test_entity_field_renderers/language_interface', ['language' => new Language(['id' => 'es'])]); - $this->assertRows( + $this->assertRows([ [ - [ - 'title' => 'example ES', - 'sticky' => 'On', - ], - [ - 'title' => 'example ES', - 'sticky' => 'On', - ], - ]); + 'title' => 'example ES', + 'sticky' => 'On', + ], + [ + 'title' => 'example ES', + 'sticky' => 'On', + ], + ]); $this->drupalGet('test_entity_field_renderers/en'); - $this->assertRows( + $this->assertRows([ + [ + 'title' => 'example EN', + 'sticky' => 'Off', + ], [ - [ - 'title' => 'example EN', - 'sticky' => 'Off', - ], - [ - 'title' => 'example EN', - 'sticky' => 'Off', - ], - ]); + 'title' => 'example EN', + 'sticky' => 'Off', + ], + ]); $this->drupalGet('test_entity_field_renderers/es'); - $this->assertRows( + $this->assertRows([ + [ + 'title' => 'example ES', + 'sticky' => 'On', + ], [ - [ - 'title' => 'example ES', - 'sticky' => 'On', - ], - [ - 'title' => 'example ES', - 'sticky' => 'On', - ], - ]); + 'title' => 'example ES', + 'sticky' => 'On', + ], + ]); } /** diff --git a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php index 449474a63aeb..c1d04cf0c101 100644 --- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php +++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php @@ -90,7 +90,7 @@ public function build(ViewExecutable $view) { // @todo You could add a string representation of the query. $this->view->build_info['query'] = ""; $this->view->build_info['count_query'] = ""; -} + } /** * {@inheritdoc} diff --git a/core/modules/views/tests/src/Kernel/Handler/FilterNumericTest.php b/core/modules/views/tests/src/Kernel/Handler/FilterNumericTest.php index c6f5af92211f..c4c978a115bc 100644 --- a/core/modules/views/tests/src/Kernel/Handler/FilterNumericTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/FilterNumericTest.php @@ -127,7 +127,7 @@ public function testFilterNumericBetween() { $view->destroy(); $view->setDisplay(); - // Change the filtering + // Change the filtering $view->displayHandlers->get('default')->overrideOption('filters', array( 'age' => array( 'id' => 'age', diff --git a/core/modules/views/tests/src/Kernel/Handler/FilterStringTest.php b/core/modules/views/tests/src/Kernel/Handler/FilterStringTest.php index e8c49773df8a..5dd47ecb3b30 100644 --- a/core/modules/views/tests/src/Kernel/Handler/FilterStringTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/FilterStringTest.php @@ -297,7 +297,7 @@ function testFilterStringWord() { function testFilterStringGroupedExposedWord() { - $filters = $this->getGroupedExposedFilters(); + $filters = $this->getGroupedExposedFilters(); $view = $this->getBasicPageView(); // Filter: Name, Operator: contains, Value: ing diff --git a/core/modules/views/tests/src/Kernel/Handler/SortDateTest.php b/core/modules/views/tests/src/Kernel/Handler/SortDateTest.php index 8c454b7b5e24..4a1375411257 100644 --- a/core/modules/views/tests/src/Kernel/Handler/SortDateTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/SortDateTest.php @@ -24,61 +24,61 @@ protected function expectedResultSet($granularity, $reverse = TRUE) { $expected = array(); if (!$reverse) { switch ($granularity) { - case 'second': - $expected = array( - array('name' => 'John'), - array('name' => 'Paul'), - array('name' => 'Meredith'), - array('name' => 'Ringo'), - array('name' => 'George'), - ); - break; - case 'minute': - $expected = array( - array('name' => 'John'), - array('name' => 'Paul'), - array('name' => 'Ringo'), - array('name' => 'Meredith'), - array('name' => 'George'), - ); - break; - case 'hour': - $expected = array( - array('name' => 'John'), - array('name' => 'Ringo'), - array('name' => 'Paul'), - array('name' => 'Meredith'), - array('name' => 'George'), - ); - break; - case 'day': - $expected = array( - array('name' => 'John'), - array('name' => 'Ringo'), - array('name' => 'Paul'), - array('name' => 'Meredith'), - array('name' => 'George'), - ); - break; - case 'month': - $expected = array( - array('name' => 'John'), - array('name' => 'George'), - array('name' => 'Ringo'), - array('name' => 'Paul'), - array('name' => 'Meredith'), - ); - break; - case 'year': - $expected = array( - array('name' => 'John'), - array('name' => 'George'), - array('name' => 'Ringo'), - array('name' => 'Paul'), - array('name' => 'Meredith'), - ); - break; - } + case 'second': + $expected = array( + array('name' => 'John'), + array('name' => 'Paul'), + array('name' => 'Meredith'), + array('name' => 'Ringo'), + array('name' => 'George'), + ); + break; + case 'minute': + $expected = array( + array('name' => 'John'), + array('name' => 'Paul'), + array('name' => 'Ringo'), + array('name' => 'Meredith'), + array('name' => 'George'), + ); + break; + case 'hour': + $expected = array( + array('name' => 'John'), + array('name' => 'Ringo'), + array('name' => 'Paul'), + array('name' => 'Meredith'), + array('name' => 'George'), + ); + break; + case 'day': + $expected = array( + array('name' => 'John'), + array('name' => 'Ringo'), + array('name' => 'Paul'), + array('name' => 'Meredith'), + array('name' => 'George'), + ); + break; + case 'month': + $expected = array( + array('name' => 'John'), + array('name' => 'George'), + array('name' => 'Ringo'), + array('name' => 'Paul'), + array('name' => 'Meredith'), + ); + break; + case 'year': + $expected = array( + array('name' => 'John'), + array('name' => 'George'), + array('name' => 'Ringo'), + array('name' => 'Paul'), + array('name' => 'Meredith'), + ); + break; + } } else { switch ($granularity) { diff --git a/core/modules/views/tests/src/Kernel/ModuleTest.php b/core/modules/views/tests/src/Kernel/ModuleTest.php index ddf3347f042f..204433dc963c 100644 --- a/core/modules/views/tests/src/Kernel/ModuleTest.php +++ b/core/modules/views/tests/src/Kernel/ModuleTest.php @@ -199,7 +199,7 @@ public function testLoadFunctions() { $expected_opt_groups = array(); foreach ($all_views as $view) { foreach ($view->get('display') as $display) { - $expected_opt_groups[$view->id()][$view->id() . ':' . $display['id']] = (string) t('@view : @display', array('@view' => $view->id(), '@display' => $display['id'])); + $expected_opt_groups[$view->id()][$view->id() . ':' . $display['id']] = (string) t('@view : @display', array('@view' => $view->id(), '@display' => $display['id'])); } } $this->assertIdentical($expected_opt_groups, $this->castSafeStrings(Views::getViewsAsOptions(FALSE, 'all', NULL, TRUE)), 'Expected option array for an option group returned.'); diff --git a/core/modules/views/tests/src/Unit/EntityViewsDataTest.php b/core/modules/views/tests/src/Unit/EntityViewsDataTest.php index 35e8613de1f8..60ba8e577084 100644 --- a/core/modules/views/tests/src/Unit/EntityViewsDataTest.php +++ b/core/modules/views/tests/src/Unit/EntityViewsDataTest.php @@ -568,7 +568,7 @@ public function testDataTableFields() { $this->viewsData->setEntityType($entity_type); - // Setup the table mapping. + // Setup the table mapping. $table_mapping = $this->getMockBuilder(DefaultTableMapping::class) ->disableOriginalConstructor() ->getMock(); @@ -717,7 +717,7 @@ public function testRevisionTableFields() { $this->viewsData->setEntityType($entity_type); - // Setup the table mapping. + // Setup the table mapping. $table_mapping = $this->getMockBuilder(DefaultTableMapping::class) ->disableOriginalConstructor() ->getMock(); diff --git a/core/modules/views_ui/src/Tests/CustomBooleanTest.php b/core/modules/views_ui/src/Tests/CustomBooleanTest.php index 828b5b906e89..ecde493b63f4 100644 --- a/core/modules/views_ui/src/Tests/CustomBooleanTest.php +++ b/core/modules/views_ui/src/Tests/CustomBooleanTest.php @@ -115,7 +115,7 @@ public function testCustomOptionTemplate() { ->save(); $this->assertEqual($this->config('system.theme')->get('default'), 'views_test_theme'); - // Add the boolean field handler to the test view. + // Add the boolean field handler to the test view. $view = Views::getView('test_view'); $view->setDisplay(); diff --git a/core/modules/views_ui/src/ViewUI.php b/core/modules/views_ui/src/ViewUI.php index 6195c8c583fa..cb222b0b4429 100644 --- a/core/modules/views_ui/src/ViewUI.php +++ b/core/modules/views_ui/src/ViewUI.php @@ -1160,9 +1160,9 @@ public function uriRelationships() { /** * {@inheritdoc} */ - public function referencedEntities() { - return $this->storage->referencedEntities(); - } + public function referencedEntities() { + return $this->storage->referencedEntities(); + } /** * {@inheritdoc} diff --git a/core/phpcs.xml.dist b/core/phpcs.xml.dist index 29468f754ce6..6ab291865093 100644 --- a/core/phpcs.xml.dist +++ b/core/phpcs.xml.dist @@ -89,6 +89,7 @@ <rule ref="Drupal.WhiteSpace.ObjectOperatorIndent"/> <rule ref="Drupal.WhiteSpace.ObjectOperatorSpacing"/> <rule ref="Drupal.WhiteSpace.OperatorSpacing"/> + <rule ref="Drupal.WhiteSpace.ScopeIndent"/> <!-- Generic sniffs --> <rule ref="Generic.Files.LineEndings"/> diff --git a/core/tests/Drupal/KernelTests/AssertConfigTrait.php b/core/tests/Drupal/KernelTests/AssertConfigTrait.php index c2e770f0e68d..eb1588f18e83 100644 --- a/core/tests/Drupal/KernelTests/AssertConfigTrait.php +++ b/core/tests/Drupal/KernelTests/AssertConfigTrait.php @@ -83,7 +83,6 @@ protected function assertConfigDiff(Diff $result, $config_name, array $skipped_c break; default: throw new \Exception($config_name . ': ' . var_export($op, TRUE)); - break; } } } diff --git a/core/tests/Drupal/KernelTests/Core/Database/DatabaseTestBase.php b/core/tests/Drupal/KernelTests/Core/Database/DatabaseTestBase.php index b38c5b649a71..f8c8c3dcaf79 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/DatabaseTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Database/DatabaseTestBase.php @@ -36,20 +36,20 @@ protected function setUp() { */ function ensureSampleDataNull() { db_insert('test_null') - ->fields(array('name', 'age')) - ->values(array( + ->fields(array('name', 'age')) + ->values(array( 'name' => 'Kermit', 'age' => 25, )) - ->values(array( + ->values(array( 'name' => 'Fozzie', 'age' => NULL, )) - ->values(array( + ->values(array( 'name' => 'Gonzo', 'age' => 27, )) - ->execute(); + ->execute(); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php index eb0fbf65656e..8c79c5c63425 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php @@ -481,7 +481,7 @@ public function testCount() { ->exists("$field_name.color") ->count() ->execute(); - $this->assertFalse($count); + $this->assertFalse($count); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php b/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php index 0cdc303e9ad9..1efb14bc02ba 100644 --- a/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php +++ b/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php @@ -84,16 +84,16 @@ public function testDeleteLinksInMenu() { * Tests creating links with an expected tree structure. */ public function testCreateLinksInMenu() { - // This creates a tree with the following structure: - // - 1 - // - 2 - // - 3 - // - 4 - // - 5 - // - 7 - // - 6 - // - 8 - // With link 6 being the only external link. + // This creates a tree with the following structure: + // - 1 + // - 2 + // - 3 + // - 4 + // - 5 + // - 7 + // - 6 + // - 8 + // With link 6 being the only external link. $links = array( 1 => MenuLinkMock::create(array('id' => 'test.example1', 'route_name' => 'example1', 'title' => 'foo', 'parent' => '')), diff --git a/core/tests/Drupal/KernelTests/KernelTestBaseTest.php b/core/tests/Drupal/KernelTests/KernelTestBaseTest.php index 30f05b272ede..1605ad69ad7b 100644 --- a/core/tests/Drupal/KernelTests/KernelTestBaseTest.php +++ b/core/tests/Drupal/KernelTests/KernelTestBaseTest.php @@ -226,7 +226,7 @@ protected function tearDown() { ':pattern' => 'sqlite_%', ))->fetchAllKeyed(0, 0); - $this->assertTrue(empty($result), 'All test tables have been removed.'); + $this->assertTrue(empty($result), 'All test tables have been removed.'); } } diff --git a/core/tests/Drupal/Tests/BrowserTestBase.php b/core/tests/Drupal/Tests/BrowserTestBase.php index c8df47c7261e..ea88906dc5ab 100644 --- a/core/tests/Drupal/Tests/BrowserTestBase.php +++ b/core/tests/Drupal/Tests/BrowserTestBase.php @@ -385,7 +385,7 @@ protected function getDefaultDriverInstance() { } if (is_array($this->minkDefaultDriverArgs)) { - // Use ReflectionClass to instantiate class with received params. + // Use ReflectionClass to instantiate class with received params. $reflector = new \ReflectionClass($this->minkDefaultDriverClass); $driver = $reflector->newInstanceArgs($this->minkDefaultDriverArgs); } diff --git a/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php b/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php index 53a14f5aa843..f81ca0da4029 100644 --- a/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php +++ b/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php @@ -230,7 +230,7 @@ public function testMethod($parameter) EOS; -$this->assertEquals($this->buildExpectedClass($class, $method_body), $result); + $this->assertEquals($this->buildExpectedClass($class, $method_body), $result); } /** diff --git a/core/tests/Drupal/Tests/Component/Utility/SafeMarkupTest.php b/core/tests/Drupal/Tests/Component/Utility/SafeMarkupTest.php index b1a36b9b8761..cbf86d209d4d 100644 --- a/core/tests/Drupal/Tests/Component/Utility/SafeMarkupTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/SafeMarkupTest.php @@ -173,7 +173,7 @@ function providerFormat() { return $tests; } - /** + /** * Custom error handler that saves the last error. * * We need this custom error handler because we cannot rely on the error to diff --git a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php index b79f5b140324..43d17fab1a38 100644 --- a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php +++ b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php @@ -329,7 +329,7 @@ public function testLibraryWithCssJsSetting() { * @covers ::buildByExtension */ public function testLibraryWithDependencies() { - $this->moduleHandler->expects($this->atLeastOnce()) + $this->moduleHandler->expects($this->atLeastOnce()) ->method('moduleExists') ->with('dependencies') ->will($this->returnValue(TRUE)); diff --git a/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php b/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php index da6e9947d8ad..5eecf1cd7921 100644 --- a/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php @@ -121,14 +121,14 @@ public function testSetCacheMaxAge($data, $expect_exception) { * Data provider for testSetCacheMaxAge. */ public function providerSetCacheMaxAge() { - return [ - [0 , FALSE], - ['http', TRUE], - ['0', TRUE], - [new \stdClass(), TRUE], - [300, FALSE], - [[], TRUE], - [8.0, TRUE] + return [ + [0 , FALSE], + ['http', TRUE], + ['0', TRUE], + [new \stdClass(), TRUE], + [300, FALSE], + [[], TRUE], + [8.0, TRUE] ]; } diff --git a/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php index 02970d7256ba..56b4b007e90d 100644 --- a/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php @@ -1314,16 +1314,16 @@ public function testCleanIds() { $this->fieldDefinitions = $this->mockFieldDefinitions(array('id')); $this->fieldDefinitions['id']->expects($this->any()) - ->method('getType') - ->will($this->returnValue('integer')); + ->method('getType') + ->will($this->returnValue('integer')); $this->setUpEntityStorage(); $this->entityType->expects($this->any()) - ->method('getKey') - ->will($this->returnValueMap(array( - array('id', 'id'), - ))); + ->method('getKey') + ->will($this->returnValueMap( + array(array('id', 'id')) + )); $method = new \ReflectionMethod($this->entityStorage, 'cleanIds'); $method->setAccessible(TRUE); diff --git a/core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php b/core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php index 0f1c27bb3411..67e7a86165f0 100644 --- a/core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php +++ b/core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php @@ -271,7 +271,7 @@ public function testHasFileElement($has_file_element) { * * @dataProvider providerLimitValidationErrors * - * @param array{}|null $limit_validation_errors + * @param array[]|null $limit_validation_errors * Any valid value for * \Drupal\Core\Form\FormStateInterface::setLimitValidationErrors()'s * $limit_validation_errors argument; @@ -577,7 +577,7 @@ public function testSetStorage() { ]; $this->decoratedFormState->setStorage($storage) - ->shouldBeCalled(); + ->shouldBeCalled(); $this->assertSame($this->formStateDecoratorBase, $this->formStateDecoratorBase->setStorage($storage)); } diff --git a/core/tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php b/core/tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php index 21c8839232ff..92ce48e33871 100644 --- a/core/tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php @@ -162,9 +162,9 @@ public function testGetActionsForRoute($route_appears, array $plugin_definitions ->method('getTitle') ->will($this->returnValue($plugin_definition['title'])); $this->controllerResolver->expects($this->any()) - ->method('getArguments') - ->with($this->request, array($plugin, 'getTitle')) - ->will($this->returnValue(array())); + ->method('getArguments') + ->with($this->request, array($plugin, 'getTitle')) + ->will($this->returnValue(array())); $plugin->expects($this->any()) ->method('getWeight') diff --git a/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php b/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php index 65fb4172c373..5fc65ad97bd6 100644 --- a/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php @@ -441,7 +441,7 @@ public function testGetTasksBuildWithCacheabilityMetadata() { // Ensure that all cacheability metadata is merged together. $this->assertEquals(['tag.example1', 'tag.example2'], $cacheability->getCacheTags()); $this->assertEquals(['context.example1', 'context.example2', 'route', 'user.permissions'], $cacheability->getCacheContexts()); - } + } protected function setupFactoryAndLocalTaskPlugins(array $definitions, $active_plugin_id) { $map = []; diff --git a/core/tests/Drupal/Tests/Core/Render/Element/MachineNameTest.php b/core/tests/Drupal/Tests/Core/Render/Element/MachineNameTest.php index c7ef72e3c5fd..d5340cb26249 100644 --- a/core/tests/Drupal/Tests/Core/Render/Element/MachineNameTest.php +++ b/core/tests/Drupal/Tests/Core/Render/Element/MachineNameTest.php @@ -2,10 +2,10 @@ namespace Drupal\Tests\Core\Render\Element; - use Drupal\Core\Form\FormState; - use Drupal\Core\Form\FormStateInterface; - use Drupal\Core\Language\LanguageInterface; - use Drupal\Core\Language\LanguageManagerInterface; +use Drupal\Core\Form\FormState; +use Drupal\Core\Form\FormStateInterface; +use Drupal\Core\Language\LanguageInterface; +use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\Render\Element\MachineName; use Drupal\Tests\UnitTestCase; use Symfony\Component\DependencyInjection\ContainerInterface; diff --git a/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php b/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php index 36a9a354f925..a3835e1a3a67 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php @@ -326,9 +326,9 @@ public function testConditionalCacheContextBubblingSelfHealing() { ], 'grandgrandchild' => [ '#access_callback' => function () use (&$current_user_role) { - // Only role C can access this subtree. - return $current_user_role === 'C'; - }, + // Only role C can access this subtree. + return $current_user_role === 'C'; + }, '#cache' => [ 'contexts' => ['bar'], 'tags' => ['d'], diff --git a/core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php b/core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php index 3b4a975341ce..fd99e9907532 100644 --- a/core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php @@ -101,7 +101,7 @@ public function providerGet() { // A request with a destination query. $data[] = [$request, '/example']; - // A request without a destination query, + // A request without a destination query, $request = Request::create('/'); $data[] = [$request, '/current-path']; diff --git a/core/tests/Drupal/Tests/Core/Session/UserSessionTest.php b/core/tests/Drupal/Tests/Core/Session/UserSessionTest.php index f83515c9613b..52969e03eb36 100644 --- a/core/tests/Drupal/Tests/Core/Session/UserSessionTest.php +++ b/core/tests/Drupal/Tests/Core/Session/UserSessionTest.php @@ -5,9 +5,9 @@ use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\Session\UserSession; use Drupal\Tests\UnitTestCase; - use Drupal\user\RoleInterface; +use Drupal\user\RoleInterface; - /** +/** * @coversDefaultClass \Drupal\Core\Session\UserSession * @group Session */ diff --git a/core/tests/Drupal/Tests/Core/Site/SettingsTest.php b/core/tests/Drupal/Tests/Core/Site/SettingsTest.php index 2c987f3c3077..3cf50fc266e2 100644 --- a/core/tests/Drupal/Tests/Core/Site/SettingsTest.php +++ b/core/tests/Drupal/Tests/Core/Site/SettingsTest.php @@ -95,11 +95,11 @@ public function testGetHashSaltEmpty(array $config) { * @return array */ public function providerTestGetHashSaltEmpty() { - return array( - array(array()), - array(array('hash_salt' => '')), - array(array('hash_salt' => NULL)), - ); + return array( + array(array()), + array(array('hash_salt' => '')), + array(array('hash_salt' => NULL)), + ); } /** diff --git a/core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php b/core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php index 9bbf2e17547a..585c4b975b7e 100644 --- a/core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php +++ b/core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php @@ -49,9 +49,9 @@ public function testNoProxy() { * @dataProvider reverseProxyEnabledProvider */ public function testReverseProxyEnabled($provided_settings) { - // Enable reverse proxy and add test values. - $settings = new Settings(array('reverse_proxy' => 1) + $provided_settings); - $this->trustedHeadersAreSet($settings); + // Enable reverse proxy and add test values. + $settings = new Settings(array('reverse_proxy' => 1) + $provided_settings); + $this->trustedHeadersAreSet($settings); } /** diff --git a/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php b/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php index 183f57086e6d..3ed2b3de6073 100644 --- a/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php +++ b/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php @@ -68,8 +68,8 @@ public function testToString() { ->method('translateString') ->with($text) ->willReturnCallback(function () { - throw new \Exception('Yes you may.'); - }); + throw new \Exception('Yes you may.'); + }); // We set a custom error handler because of https://github.com/sebastianbergmann/phpunit/issues/487 set_error_handler([$this, 'errorHandler']); diff --git a/core/tests/Drupal/Tests/Core/UrlTest.php b/core/tests/Drupal/Tests/Core/UrlTest.php index b562745c8b86..5324c26405bc 100644 --- a/core/tests/Drupal/Tests/Core/UrlTest.php +++ b/core/tests/Drupal/Tests/Core/UrlTest.php @@ -154,7 +154,7 @@ public function testUrlFromRequest() { return $urls; } - /** + /** * This constraint checks whether a Request object has the right path. * * @param string $path diff --git a/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php b/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php index f0203d70ef60..b2d7700e0c5c 100644 --- a/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php +++ b/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php @@ -77,11 +77,11 @@ public function testAssembleWithLeadingSlash() { * @dataProvider providerTestAssembleWithExternalUrl */ public function testAssembleWithExternalUrl($uri, array $options, $expected) { - $this->setupRequestStack(FALSE); - $this->assertEquals($expected, $this->unroutedUrlAssembler->assemble($uri, $options)); - $generated_url = $this->unroutedUrlAssembler->assemble($uri, $options, TRUE); - $this->assertEquals($expected, $generated_url->getGeneratedUrl()); - $this->assertInstanceOf('\Drupal\Core\Render\BubbleableMetadata', $generated_url); + $this->setupRequestStack(FALSE); + $this->assertEquals($expected, $this->unroutedUrlAssembler->assemble($uri, $options)); + $generated_url = $this->unroutedUrlAssembler->assemble($uri, $options, TRUE); + $this->assertEquals($expected, $generated_url->getGeneratedUrl()); + $this->assertInstanceOf('\Drupal\Core\Render\BubbleableMetadata', $generated_url); } /** -- GitLab