diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 1938ed691ea49c405bc22f1ea209f80d919d3624..865685078e6db8615ed30404ec29b65ac88921c1 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -1595,7 +1595,7 @@ function install_download_additional_translations_operations(&$install_state) { // should download/import translations. $languages = \Drupal::languageManager()->getLanguages(); $operations = array(); - foreach($languages as $langcode => $language) { + foreach ($languages as $langcode => $language) { // The installer language was already downloaded. Check downloads for the // other languages if any. Ignore any download errors here, since we // are in the middle of an install process and there is no way back. We diff --git a/core/lib/Drupal/Component/Gettext/PoItem.php b/core/lib/Drupal/Component/Gettext/PoItem.php index 4ffa0b4b0a7256692694ede4712907ad60a674f3..3ef42cef4a8f6507e486b96a2cd4e51013507431 100644 --- a/core/lib/Drupal/Component/Gettext/PoItem.php +++ b/core/lib/Drupal/Component/Gettext/PoItem.php @@ -181,7 +181,7 @@ public function setFromArray(array $values = array()) { if (isset($values['translation'])) { $this->setTranslation($values['translation']); } - if (isset($values['comment'])){ + if (isset($values['comment'])) { $this->setComment($values['comment']); } if (isset($this->_source) && diff --git a/core/lib/Drupal/Component/ProxyBuilder/ProxyBuilder.php b/core/lib/Drupal/Component/ProxyBuilder/ProxyBuilder.php index 0801b361b067dd1510fbdb59c9cdd6fc24d5ac7b..750f122049bcabf0fc1dcc2bfd505357bc6796ad 100644 --- a/core/lib/Drupal/Component/ProxyBuilder/ProxyBuilder.php +++ b/core/lib/Drupal/Component/ProxyBuilder/ProxyBuilder.php @@ -92,7 +92,6 @@ public function build($class_name, $proxy_class_name = '') { // class. if ($parent_interfaces = $interface->getInterfaceNames()) { foreach ($parent_interfaces as $parent_interface) { - if (isset($interfaces[$parent_interface])) {} unset($interfaces[$parent_interface]); } } diff --git a/core/lib/Drupal/Component/Transliteration/PhpTransliteration.php b/core/lib/Drupal/Component/Transliteration/PhpTransliteration.php index 84807e98d00586d1ae38502ee31fd2bd3d9e2594..0953bfedd4874da53c8182718d52524a459c2540 100644 --- a/core/lib/Drupal/Component/Transliteration/PhpTransliteration.php +++ b/core/lib/Drupal/Component/Transliteration/PhpTransliteration.php @@ -90,7 +90,7 @@ public function removeDiacritics($string) { $replacement = $character; if (($range1 && !in_array($code, $exclusions_range1)) || ($range2 && !in_array($code, $exclusions_range2))) { $to_add = $this->lookupReplacement($code, 'xyz'); - if(strlen($to_add) === 1) { + if (strlen($to_add) === 1) { $replacement = $to_add; } } diff --git a/core/lib/Drupal/Component/Utility/Random.php b/core/lib/Drupal/Component/Utility/Random.php index 55772f8034018b16cace25987ad12dee032bde6d..3d72b038089ae32df8b1cf7e9ddebf3f5d372748 100644 --- a/core/lib/Drupal/Component/Utility/Random.php +++ b/core/lib/Drupal/Component/Utility/Random.php @@ -149,7 +149,7 @@ public function word($length) { $num_cons = count($cons); $word = ''; - while(strlen($word) < $length){ + while (strlen($word) < $length) { $word .= $cons[mt_rand(0, $num_cons - 1)] . $vowels[mt_rand(0, $num_vowels - 1)]; } diff --git a/core/lib/Drupal/Component/Utility/UserAgent.php b/core/lib/Drupal/Component/Utility/UserAgent.php index bd811057eae0e5b38bc0ddb435d1a0ef281ed11f..2fc67d67d56f962e6e4ddc3e070b37ac7f897b17 100644 --- a/core/lib/Drupal/Component/Utility/UserAgent.php +++ b/core/lib/Drupal/Component/Utility/UserAgent.php @@ -122,8 +122,7 @@ public static function getBestMatchingLangcode($http_accept_language, $langcodes $qvalue = $ua_langcodes[$prefix]; break; } - } - while ($prefix = substr($prefix, 0, strrpos($prefix, '-'))); + } while ($prefix = substr($prefix, 0, strrpos($prefix, '-'))); // Find the best match. if ($qvalue > $max_qvalue) { diff --git a/core/lib/Drupal/Core/Cache/Cache.php b/core/lib/Drupal/Core/Cache/Cache.php index 749161ed95c65ed0458fc18472e8f8e595eb8b33..06b4ac2f26c9d20fc3a43f9e8e34213619b9742c 100644 --- a/core/lib/Drupal/Core/Cache/Cache.php +++ b/core/lib/Drupal/Core/Cache/Cache.php @@ -76,10 +76,10 @@ public static function mergeTags(array $a = [], array $b = []) { */ public static function mergeMaxAges($a = Cache::PERMANENT, $b = Cache::PERMANENT) { // If one of the values is Cache::PERMANENT, return the other value. - if ($a === Cache::PERMANENT){ + if ($a === Cache::PERMANENT) { return $b; } - if ($b === Cache::PERMANENT){ + if ($b === Cache::PERMANENT) { return $a; } diff --git a/core/lib/Drupal/Core/Cache/Context/CacheContextsManager.php b/core/lib/Drupal/Core/Cache/Context/CacheContextsManager.php index d2a007252131922f33cb117a86223bf2e86e4efe..57b79b61268560e009ae060de0f205b8365c63d2 100644 --- a/core/lib/Drupal/Core/Cache/Context/CacheContextsManager.php +++ b/core/lib/Drupal/Core/Cache/Context/CacheContextsManager.php @@ -195,7 +195,7 @@ public function optimizeTokens(array $context_tokens) { $ancestor_found = TRUE; } - } while(!$ancestor_found && strpos($ancestor, '.') !== FALSE); + } while (!$ancestor_found && strpos($ancestor, '.') !== FALSE); if (!$ancestor_found) { $optimized_content_tokens[] = $context_token; } diff --git a/core/lib/Drupal/Core/Cache/PhpBackend.php b/core/lib/Drupal/Core/Cache/PhpBackend.php index 4f1f9b0c649f3dde299ebfb7a87511930810a868..38f9b9b4b4211228b1838016e82e4ec0a590f234 100644 --- a/core/lib/Drupal/Core/Cache/PhpBackend.php +++ b/core/lib/Drupal/Core/Cache/PhpBackend.php @@ -211,7 +211,7 @@ public function invalidateMultiple(array $cids) { * {@inheritdoc} */ public function invalidateAll() { - foreach($this->storage()->listAll() as $cidhash) { + foreach ($this->storage()->listAll() as $cidhash) { $this->invalidatebyHash($cidhash); } } diff --git a/core/lib/Drupal/Core/Config/ConfigFactory.php b/core/lib/Drupal/Core/Config/ConfigFactory.php index c5e5931da86fba6f6bf7b8c5d4abdbb5001e0c33..1189a4a153650a74f874ecb2b978bba7c06f5c0b 100644 --- a/core/lib/Drupal/Core/Config/ConfigFactory.php +++ b/core/lib/Drupal/Core/Config/ConfigFactory.php @@ -271,7 +271,7 @@ public function getCacheKeys() { // Because get() adds overrides both from $GLOBALS and from // $this->configFactoryOverrides, add cache keys for each. $keys[] = 'global_overrides'; - foreach($this->configFactoryOverrides as $override) { + foreach ($this->configFactoryOverrides as $override) { $keys[] = $override->getCacheSuffix(); } return $keys; diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigDependencyManager.php b/core/lib/Drupal/Core/Config/Entity/ConfigDependencyManager.php index bca31f42bb12a04c70a7e7b0d8af0ab81606c4b5..377f7c4d00d2f1792c8b5d74a9b9667b6c7170e7 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigDependencyManager.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigDependencyManager.php @@ -228,7 +228,7 @@ protected function createGraphConfigEntityDependencies($entities_to_check) { $graph = $this->getGraph(); foreach ($entities_to_check as $entity) { - if (isset($graph[$entity]) && !empty($graph[$entity]['reverse_paths'])){ + if (isset($graph[$entity]) && !empty($graph[$entity]['reverse_paths'])) { foreach ($graph[$entity]['reverse_paths'] as $dependency => $value) { $dependent_entities[$dependency] = $this->data[$dependency]; } diff --git a/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php b/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php index dead7abb0a8a6cc6cdf25778fec023761f732714..df510672155d497449b1ce2aefaa9710f6c20d12 100644 --- a/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php +++ b/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php @@ -79,7 +79,8 @@ public function __construct(\PDO $connection, array $connection_options = array( public function query($query, array $args = array(), $options = array()) { try { return parent::query($query, $args, $options); - } catch (DatabaseException $e) { + } + catch (DatabaseException $e) { if ($e->getPrevious()->errorInfo[1] == 1153) { // If a max_allowed_packet error occurs the message length is truncated. // This should prevent the error from recurring if the exception is diff --git a/core/lib/Drupal/Core/Datetime/Element/Datelist.php b/core/lib/Drupal/Core/Datetime/Element/Datelist.php index a6c6781335af1f6c3c38971c12e3412c535534de..705001a19f302499a49e41cfa3a943876db6430f 100644 --- a/core/lib/Drupal/Core/Datetime/Element/Datelist.php +++ b/core/lib/Drupal/Core/Datetime/Element/Datelist.php @@ -313,7 +313,7 @@ public static function validateDatelist(&$element, FormStateInterface $form_stat $form_state->setError($element, t('The %field date is required.')); } elseif (!empty($all_empty)) { - foreach ($all_empty as $value){ + foreach ($all_empty as $value) { $form_state->setError($element[$value], t('A value must be selected for %part.', array('%part' => $value))); } } diff --git a/core/lib/Drupal/Core/Entity/Query/Sql/QueryAggregate.php b/core/lib/Drupal/Core/Entity/Query/Sql/QueryAggregate.php index 4f0738902d39f65726eec2314aa23e16c6d50a94..0fa2f665237caad30a3d74258f9ab7dd01dceb4c 100644 --- a/core/lib/Drupal/Core/Entity/Query/Sql/QueryAggregate.php +++ b/core/lib/Drupal/Core/Entity/Query/Sql/QueryAggregate.php @@ -118,7 +118,7 @@ protected function addGroupBy() { * Returns the called object. */ protected function addSortAggregate() { - if(!$this->count) { + if (!$this->count) { foreach ($this->sortAggregate as $alias => $sort) { $this->sqlQuery->orderBy($alias, $sort['direction']); } diff --git a/core/lib/Drupal/Core/Menu/LocalTaskManager.php b/core/lib/Drupal/Core/Menu/LocalTaskManager.php index 928b740c13def58229928bb143d4c95cd300ba72..ec1df5c2fa2d50b8cd0fc9e2f39c61335384f152 100644 --- a/core/lib/Drupal/Core/Menu/LocalTaskManager.php +++ b/core/lib/Drupal/Core/Menu/LocalTaskManager.php @@ -218,7 +218,7 @@ public function getLocalTasksForRoute($route_name) { $definitions[$plugin_id]['base_route'] = $definitions[$task_info['parent_id']]['base_route']; } if ($route_name == $task_info['route_name']) { - if(!empty($task_info['base_route'])) { + if (!empty($task_info['base_route'])) { $base_routes[$task_info['base_route']] = $task_info['base_route']; } // Tabs that link to the current route are viable parents diff --git a/core/lib/Drupal/Core/Render/Element/VerticalTabs.php b/core/lib/Drupal/Core/Render/Element/VerticalTabs.php index 8a637fb356ace9b0a7c12f400915458e85044df7..1d108aaed743d7165497ed318e9d2f33b757fcd3 100644 --- a/core/lib/Drupal/Core/Render/Element/VerticalTabs.php +++ b/core/lib/Drupal/Core/Render/Element/VerticalTabs.php @@ -125,7 +125,7 @@ public static function processVerticalTabs(&$element, FormStateInterface $form_s // form is rendered, e.g. on preview pages or when form validation // fails. $name = implode('__', $element['#parents']); - if ($form_state->hasValue($name . '__active_tab')){ + if ($form_state->hasValue($name . '__active_tab')) { $element['#default_tab'] = $form_state->getValue($name . '__active_tab'); } $element[$name . '__active_tab'] = array( diff --git a/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php b/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php index a25fe30cdf3e161bd6a7dd288c4cfda03aabb365..2f9aeb3662ca4b5df788796c7adfe68ae4fdb0d2 100644 --- a/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php +++ b/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php @@ -442,7 +442,7 @@ protected function processHtmlHeadLink(array $html_head_link) { */ protected function processFeed($attached_feed) { $html_head_link = []; - foreach($attached_feed as $item) { + foreach ($attached_feed as $item) { $feed_link = [ 'href' => $item[0], 'rel' => 'alternate', diff --git a/core/lib/Drupal/Core/Routing/MatcherDumper.php b/core/lib/Drupal/Core/Routing/MatcherDumper.php index e254024274b6a17f574ee1e71921c896aa5e366c..467b02bbbbc15fe14d4aa39b9db5cc6ee8e176d4 100644 --- a/core/lib/Drupal/Core/Routing/MatcherDumper.php +++ b/core/lib/Drupal/Core/Routing/MatcherDumper.php @@ -142,7 +142,8 @@ public function dump(array $options = array()) { } - } catch (\Exception $e) { + } + catch (\Exception $e) { $transaction->rollback(); watchdog_exception('Routing', $e); throw $e; diff --git a/core/lib/Drupal/Core/Routing/UrlGenerator.php b/core/lib/Drupal/Core/Routing/UrlGenerator.php index 3cbbd5adf2ef11025317b526e3419392d403e331..6cff9d599a3ca752f237720daba4599c5c869b1b 100644 --- a/core/lib/Drupal/Core/Routing/UrlGenerator.php +++ b/core/lib/Drupal/Core/Routing/UrlGenerator.php @@ -358,7 +358,8 @@ public function generateFromRoute($name, $parameters = array(), $options = array $port = ''; if ('http' === $scheme && 80 != $this->context->getHttpPort()) { $port = ':' . $this->context->getHttpPort(); - } elseif ('https' === $scheme && 443 != $this->context->getHttpsPort()) { + } + elseif ('https' === $scheme && 443 != $this->context->getHttpsPort()) { $port = ':' . $this->context->getHttpsPort(); } if ($collect_bubbleable_metadata) { diff --git a/core/lib/Drupal/Core/Test/HttpClientMiddleware/TestHttpClientMiddleware.php b/core/lib/Drupal/Core/Test/HttpClientMiddleware/TestHttpClientMiddleware.php index e4e373f2c0ed00decdfe4487199028efe1d12fd1..3c4d1427a82b92fbd5233512248e4cfc0d96a8c1 100644 --- a/core/lib/Drupal/Core/Test/HttpClientMiddleware/TestHttpClientMiddleware.php +++ b/core/lib/Drupal/Core/Test/HttpClientMiddleware/TestHttpClientMiddleware.php @@ -40,7 +40,7 @@ public function __invoke() { // Call \Drupal\simpletest\WebTestBase::error() with the parameters from // the header. $parameters = unserialize(urldecode($header_value)); - if (count($parameters) === 3) { + if (count($parameters) === 3) { throw new \Exception($parameters[1] . ': ' . $parameters[0] . "\n" . Error::formatBacktrace([$parameters[2]])); } else { diff --git a/core/modules/color/color.module b/core/modules/color/color.module index d74025b7a9c7235641f61d7c1ac977f701913013..ca0dc3ae3d3e597d8b09d65610c2b101a9d80815 100644 --- a/core/modules/color/color.module +++ b/core/modules/color/color.module @@ -76,7 +76,7 @@ function color_library_info_alter(&$libraries, $extension) { $color_paths = \Drupal::config('color.theme.' . $extension)->get('stylesheets'); if (!empty($color_paths)) { foreach (array_keys($libraries) as $name) { - if(isset($libraries[$name]['css'])) { + if (isset($libraries[$name]['css'])) { // Override stylesheets. foreach ($libraries[$name]['css'] as $category => $css_assets) { foreach ($css_assets as $path => $metadata) { diff --git a/core/modules/color/src/Tests/ColorTest.php b/core/modules/color/src/Tests/ColorTest.php index d334376c1ad8252126111f15770eac586ed24351..578f7fb990c1de2fd650f628ff0396f9134f6e54 100644 --- a/core/modules/color/src/Tests/ColorTest.php +++ b/core/modules/color/src/Tests/ColorTest.php @@ -164,7 +164,7 @@ function testValidColor() { $edit['palette[bg]'] = $color; $this->drupalPostForm($settings_path, $edit, t('Save configuration')); - if($is_valid) { + if ($is_valid) { $this->assertText('The configuration options have been saved.'); } else { diff --git a/core/modules/config/src/Form/ConfigSingleImportForm.php b/core/modules/config/src/Form/ConfigSingleImportForm.php index 0a6fd2d3de09e088a40d3994eda6e4187117be5d..e458e2514ed858e73d7f3a4e045b5a520df2a1c5 100644 --- a/core/modules/config/src/Form/ConfigSingleImportForm.php +++ b/core/modules/config/src/Form/ConfigSingleImportForm.php @@ -388,7 +388,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { if ($config_importer->alreadyImporting()) { drupal_set_message($this->t('Another request may be importing configuration already.'), 'error'); } - else{ + else { try { $sync_steps = $config_importer->initialize(); $batch = [ diff --git a/core/modules/config/src/Form/ConfigSync.php b/core/modules/config/src/Form/ConfigSync.php index 62a6e9c23ee30518d307cff00c9c10e5114ee652..8d11ad3d09f32304172f9b2128b1d4962d44981a 100644 --- a/core/modules/config/src/Form/ConfigSync.php +++ b/core/modules/config/src/Form/ConfigSync.php @@ -330,7 +330,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { if ($config_importer->alreadyImporting()) { drupal_set_message($this->t('Another request may be synchronizing configuration already.')); } - else{ + else { try { $sync_steps = $config_importer->initialize(); $batch = array( diff --git a/core/modules/config/src/Tests/ConfigEntityTest.php b/core/modules/config/src/Tests/ConfigEntityTest.php index 5a61382e5de3567d4d0abd32ed54aeb1370d04db..a8a8f0f7479e873a399e1f53fdc7b61df4fbc910 100644 --- a/core/modules/config/src/Tests/ConfigEntityTest.php +++ b/core/modules/config/src/Tests/ConfigEntityTest.php @@ -195,7 +195,8 @@ function testCRUD() { try { $same_id->save(); $this->fail('Not possible to overwrite an entity entity.'); - } catch (EntityStorageException $e) { + } + catch (EntityStorageException $e) { $this->pass('Not possible to overwrite an entity entity.'); } diff --git a/core/modules/config/src/Tests/ConfigImportAllTest.php b/core/modules/config/src/Tests/ConfigImportAllTest.php index a7623a9559171427e5163da882f200ed40418545..643f76351fae8abdc36fbbfa0831d9292b91cb18 100644 --- a/core/modules/config/src/Tests/ConfigImportAllTest.php +++ b/core/modules/config/src/Tests/ConfigImportAllTest.php @@ -60,7 +60,7 @@ public function testInstallUninstall() { \Drupal::service('module_installer')->install(array_keys($all_modules)); $this->assertModules(array_keys($all_modules), TRUE); - foreach($all_modules as $module => $info) { + foreach ($all_modules as $module => $info) { $this->assertModuleConfig($module); $this->assertModuleTablesExist($module); } @@ -118,7 +118,7 @@ public function testInstallUninstall() { \Drupal::service('module_installer')->uninstall(array_keys($modules_to_uninstall)); $this->assertModules(array_keys($modules_to_uninstall), FALSE); - foreach($modules_to_uninstall as $module => $info) { + foreach ($modules_to_uninstall as $module => $info) { $this->assertNoModuleConfig($module); $this->assertModuleTablesDoNotExist($module); } @@ -133,7 +133,7 @@ public function testInstallUninstall() { // Check that all modules that were uninstalled are now reinstalled. $this->assertModules(array_keys($modules_to_uninstall), TRUE); - foreach($modules_to_uninstall as $module => $info) { + foreach ($modules_to_uninstall as $module => $info) { $this->assertModuleConfig($module); $this->assertModuleTablesExist($module); } diff --git a/core/modules/config_translation/src/ConfigMapperManager.php b/core/modules/config_translation/src/ConfigMapperManager.php index f33965f8c7f5ead5de3354f3a0456078a2b0f69c..cd0b72f967d4b3a5b31f12301d82f67de275eeb6 100644 --- a/core/modules/config_translation/src/ConfigMapperManager.php +++ b/core/modules/config_translation/src/ConfigMapperManager.php @@ -112,7 +112,7 @@ protected function getDiscovery() { */ public function getMappers(RouteCollection $collection = NULL) { $mappers = array(); - foreach($this->getDefinitions() as $id => $definition) { + foreach ($this->getDefinitions() as $id => $definition) { $mappers[$id] = $this->createInstance($id); if ($collection) { $mappers[$id]->setRouteCollection($collection); diff --git a/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php b/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php index 908b925aacabb22a3fd724973359828c97cad0d2..911f6e256786d9b6f5925edc8231dc7227abaa5f 100644 --- a/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php +++ b/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php @@ -456,7 +456,7 @@ public function testDateFormatTranslation() { 'medium' => 'Default medium date', 'custom_medium' => 'Custom medium date', ); - foreach($formats as $id => $label) { + foreach ($formats as $id => $label) { $translation_base_url = 'admin/config/regional/date-time/formats/manage/' . $id . '/translate'; $this->drupalGet($translation_base_url); diff --git a/core/modules/config_translation/tests/src/Unit/ConfigNamesMapperTest.php b/core/modules/config_translation/tests/src/Unit/ConfigNamesMapperTest.php index 4d5765f6ebd62aa7edb8bf0040534c0504fd3c61..cbf42c809cc28e41a27c51fc5cbdeadbefec6912 100644 --- a/core/modules/config_translation/tests/src/Unit/ConfigNamesMapperTest.php +++ b/core/modules/config_translation/tests/src/Unit/ConfigNamesMapperTest.php @@ -440,7 +440,8 @@ public function testGetLangcode() { $this->configNamesMapper->getLangcode(); $this->fail(); } - catch (\RuntimeException $e) {} + catch (\RuntimeException $e) { + } } /** diff --git a/core/modules/contact/src/Tests/ContactSitewideTest.php b/core/modules/contact/src/Tests/ContactSitewideTest.php index f65ab6faa46f56b7fc73eb9c4fce10ac1299e9c0..ce6938886808af849a0ce2aa92400a9d893ab23f 100644 --- a/core/modules/contact/src/Tests/ContactSitewideTest.php +++ b/core/modules/contact/src/Tests/ContactSitewideTest.php @@ -256,7 +256,7 @@ function testSiteWideContact() { // Find out in which row the form we want to add a field to is. $i = 0; - foreach($this->xpath('//table/tbody/tr') as $row) { + foreach ($this->xpath('//table/tbody/tr') as $row) { if (((string) $row->td[0]->a) == $label) { break; } diff --git a/core/modules/file/src/Element/ManagedFile.php b/core/modules/file/src/Element/ManagedFile.php index 1b0984bdba889af0ecc6f398cf16c56020a73bdd..426f40c03aa96e4256f59fe89229b55573624ce8 100644 --- a/core/modules/file/src/Element/ManagedFile.php +++ b/core/modules/file/src/Element/ManagedFile.php @@ -97,7 +97,7 @@ public static function valueCallback(&$element, $input, FormStateInterface $form // Temporary files that belong to other users should never be // allowed. if ($file->isTemporary()) { - if ($file->getOwnerId() != \Drupal::currentUser()->id()) { + if ($file->getOwnerId() != \Drupal::currentUser()->id()) { $force_default = TRUE; break; } diff --git a/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php b/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php index fe94ecf2af891895eeca21786a10c052c0132c9e..df5e039cb08efe8e744baaf6b823b5f6d41a2d6a 100644 --- a/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php +++ b/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php @@ -372,7 +372,8 @@ public static function process($element, FormStateInterface $form_state, $form) ); if (isset($item['display'])) { $element['display']['#value'] = $item['display'] ? '1' : ''; - } else { + } + else { $element['display']['#value'] = $element['#display_default']; } } diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index d42c81a24851f5a16fdd8a5b998035a915881aeb..9385b66cc447f5376fc05544923016ec1e38777a 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -647,7 +647,7 @@ function _filter_url_escape_comments($match, $escape = NULL) { if (isset($escape)) { $mode = $escape; - if ($escape){ + if ($escape) { $comments = array(); } return; diff --git a/core/modules/filter/src/Plugin/Filter/FilterHtml.php b/core/modules/filter/src/Plugin/Filter/FilterHtml.php index 6ec335ef6ef04708e8ca11da2f158de53ef9bf74..1dc3395161a21f420f3bcee57103ca37fe2d370b 100644 --- a/core/modules/filter/src/Plugin/Filter/FilterHtml.php +++ b/core/modules/filter/src/Plugin/Filter/FilterHtml.php @@ -154,7 +154,7 @@ public function filterAttributes($text) { */ protected function filterElementAttributes(\DOMElement $element, array $allowed_attributes) { $modified_attributes = []; - foreach($element->attributes as $name => $attribute) { + foreach ($element->attributes as $name => $attribute) { // Remove attributes not in the whitelist. $allowed_value = $this->findAllowedValue($allowed_attributes, $name); if (empty($allowed_value)) { diff --git a/core/modules/forum/src/Tests/ForumUninstallTest.php b/core/modules/forum/src/Tests/ForumUninstallTest.php index d2acc1f7e21df5746de14b9ba735b00e268e3d0e..1978e6b311b0fcbf56bfbd330179aafa30c37d25 100644 --- a/core/modules/forum/src/Tests/ForumUninstallTest.php +++ b/core/modules/forum/src/Tests/ForumUninstallTest.php @@ -138,7 +138,7 @@ public function testForumUninstallWithoutFieldStorage() { // Delete all terms in the Forums vocabulary. Uninstalling the forum module // will fail unless this is done. $terms = entity_load_multiple_by_properties('taxonomy_term', array('vid' => 'forums')); - foreach($terms as $term) { + foreach ($terms as $term) { $term->delete(); } diff --git a/core/modules/image/src/Plugin/migrate/process/d6/ImageCacheActions.php b/core/modules/image/src/Plugin/migrate/process/d6/ImageCacheActions.php index 259cd2f101b5906b8cfc9ee741e039f5e572a598..0d40769ae08f49fe58756f81cbda3dd056826714 100644 --- a/core/modules/image/src/Plugin/migrate/process/d6/ImageCacheActions.php +++ b/core/modules/image/src/Plugin/migrate/process/d6/ImageCacheActions.php @@ -19,7 +19,7 @@ class ImageCacheActions extends ProcessPluginBase { public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { $effects = []; - foreach($row->getSourceProperty('actions') as $action) { + foreach ($row->getSourceProperty('actions') as $action) { $id = preg_replace('/^imagecache/', 'image', $action['action']); if ($id === 'image_crop') { diff --git a/core/modules/image/src/Plugin/migrate/source/d6/ImageCachePreset.php b/core/modules/image/src/Plugin/migrate/source/d6/ImageCachePreset.php index 2f14adc96ef659bd9d898dd9e000c89dd935a255..4266ff179774c3dd85b3dd3dad2eb68f3b6305f6 100644 --- a/core/modules/image/src/Plugin/migrate/source/d6/ImageCachePreset.php +++ b/core/modules/image/src/Plugin/migrate/source/d6/ImageCachePreset.php @@ -54,7 +54,7 @@ public function prepareRow(Row $row) { ->condition('presetid', $row->getSourceProperty('presetid')) ->execute(); - foreach($results as $key => $result) { + foreach ($results as $key => $result) { $actions[$key] = $result; $actions[$key]['data'] = unserialize($result['data']); } diff --git a/core/modules/language/language.module b/core/modules/language/language.module index c7873b89565cfe9cead35a8c29086087cdb87ac5..b4612f4a2694002fa495c2e888ee719db98c0dff 100644 --- a/core/modules/language/language.module +++ b/core/modules/language/language.module @@ -168,7 +168,7 @@ function language_entity_base_field_info_alter(&$fields) { foreach ($fields as $definition) { // Set configurable form display for language fields with display options. if ($definition->getType() == 'language') { - foreach (array('form', 'view') as $type) { + foreach (array('form', 'view') as $type) { if ($definition->getDisplayOptions($type)) { // The related configurations will be purged manually on Language // module uninstallation. @see language_modules_uninstalled(). diff --git a/core/modules/menu_ui/menu_ui.module b/core/modules/menu_ui/menu_ui.module index 463f8cabd133807796a0692aec44a2b25eec1f34..99b61d09ec1ad414bcbaa573a31172f35081f62b 100644 --- a/core/modules/menu_ui/menu_ui.module +++ b/core/modules/menu_ui/menu_ui.module @@ -371,7 +371,7 @@ function menu_ui_form_node_form_submit($form, FormStateInterface $form_state) { $entity->delete(); } } - elseif (trim($values['title'])) { + elseif (trim($values['title'])) { // Decompose the selected menu parent option into 'menu_name' and 'parent', // if the form used the default parent selection widget. if (!empty($values['menu_parent'])) { diff --git a/core/modules/rdf/rdf.module b/core/modules/rdf/rdf.module index 5bf296d4c2163a58e04e995e46907dc5f5b724fd..12abf9ee9d353963a34a05b5c94e173d5df9c829 100644 --- a/core/modules/rdf/rdf.module +++ b/core/modules/rdf/rdf.module @@ -113,7 +113,7 @@ function rdf_get_namespaces() { // namespace, do not use \Drupal::moduleHandler()->invokeAll(). foreach (\Drupal::moduleHandler()->getImplementations('rdf_namespaces') as $module) { $function = $module . '_rdf_namespaces'; - foreach($function() as $prefix => $namespace) { + foreach ($function() as $prefix => $namespace) { if (array_key_exists($prefix, $namespaces) && $namespace !== $namespaces[$prefix]) { throw new Exception(t('Tried to map @prefix to @namespace, but @prefix is already mapped to @orig_namespace.', array('@prefix' => $prefix, '@namespace' => $namespace, '@orig_namespace' => $namespaces[$prefix]))); } @@ -265,7 +265,7 @@ function rdf_preprocess_html(&$variables) { if (!isset($variables['html_attributes']['prefix'])) { $variables['html_attributes']['prefix'] = array(); } - foreach(rdf_get_namespaces() as $prefix => $uri) { + foreach (rdf_get_namespaces() as $prefix => $uri) { $variables['html_attributes']['prefix'][] = $prefix . ': ' . $uri . " "; } } diff --git a/core/modules/responsive_image/src/Entity/ResponsiveImageStyle.php b/core/modules/responsive_image/src/Entity/ResponsiveImageStyle.php index 44546e8f4507fc8399991c1bd7772b4ef9a52453..fabfc60db4cdc8480b559140cc838e3be1034653 100644 --- a/core/modules/responsive_image/src/Entity/ResponsiveImageStyle.php +++ b/core/modules/responsive_image/src/Entity/ResponsiveImageStyle.php @@ -133,7 +133,7 @@ public function hasImageStyleMappings() { public function getKeyedImageStyleMappings() { if (!$this->keyedImageStyleMappings) { $this->keyedImageStyleMappings = array(); - foreach($this->image_style_mappings as $mapping) { + foreach ($this->image_style_mappings as $mapping) { if (!static::isEmptyImageStyleMapping($mapping)) { $this->keyedImageStyleMappings[$mapping['breakpoint_id']][$mapping['multiplier']] = $mapping; } diff --git a/core/modules/search/src/Tests/SearchMultilingualEntityTest.php b/core/modules/search/src/Tests/SearchMultilingualEntityTest.php index efbf7d940a1bb60af6cc6ed965c820d99d9aa15d..a7a3070874eecec490ef06792144c7a2c9630cd5 100644 --- a/core/modules/search/src/Tests/SearchMultilingualEntityTest.php +++ b/core/modules/search/src/Tests/SearchMultilingualEntityTest.php @@ -182,7 +182,7 @@ function testMultilingualSearch() { $this->assertEqual(count($search_result), 2, 'The search found 2 results'); // Test to check for the language of result items. - foreach($search_result as $result) { + foreach ($search_result as $result) { $this->assertEqual($result['langcode'], 'hu', 'The search found the correct Hungarian result'); } diff --git a/core/modules/search/src/Tests/SearchRankingTest.php b/core/modules/search/src/Tests/SearchRankingTest.php index ff8299cf0b38f8a529c7849d4dd60d61e9825fe2..c138d9fd5ffd872e939d8604525c0c54ea544457 100644 --- a/core/modules/search/src/Tests/SearchRankingTest.php +++ b/core/modules/search/src/Tests/SearchRankingTest.php @@ -244,7 +244,8 @@ public function testHTMLRankings() { // Assert the results. if ($tag == 'notag') { $this->assertEqual($set[$tag_rank]['node']->id(), $nodes[$tag]->id(), 'Search tag ranking for plain text order.'); - } else { + } + else { $this->assertEqual($set[$tag_rank]['node']->id(), $nodes[$tag]->id(), 'Search tag ranking for "<' . $sorted_tags[$tag_rank] . '>" order.'); } } diff --git a/core/modules/shortcut/src/Tests/ShortcutLinksTest.php b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php index b0e887e7aba42c9972a91379962556772ec714f0..3922d1f194c43eb49381198ea32b6dd4a33c8824 100644 --- a/core/modules/shortcut/src/Tests/ShortcutLinksTest.php +++ b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php @@ -342,7 +342,7 @@ public function testShortcutLinkOrder() { $shortcuts = $this->cssSelect('#toolbar-item-shortcuts-tray .toolbar-menu a'); $this->assertEqual((string) $shortcuts[0], 'Add content'); $this->assertEqual((string) $shortcuts[1], 'All content'); - foreach($this->set->getShortcuts() as $shortcut) { + foreach ($this->set->getShortcuts() as $shortcut) { $shortcut->setWeight($shortcut->getWeight() * -1)->save(); } $this->drupalGet(Url::fromRoute('<front>')); diff --git a/core/modules/simpletest/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php index 627df293156677fd026d455fa663e1d06e3ffac4..668e1b566b8e7ac3189b5538a90b3e6fbc8d903d 100644 --- a/core/modules/simpletest/src/WebTestBase.php +++ b/core/modules/simpletest/src/WebTestBase.php @@ -2539,7 +2539,7 @@ protected function assertHeader($header, $value, $message = '', $group = 'Browse * TRUE on pass, FALSE on fail. */ protected function assertUrl($path, array $options = array(), $message = '', $group = 'Other') { - if ($path instanceof Url) { + if ($path instanceof Url) { $url_obj = $path; } elseif (UrlHelper::isExternal($path)) { diff --git a/core/modules/system/src/MachineNameController.php b/core/modules/system/src/MachineNameController.php index 2434dd988c40b7ee2ecb3c03603b11f5eb991cde..7331eb39deb3a6d77d3b651d6cdc0c0c721cb83a 100644 --- a/core/modules/system/src/MachineNameController.php +++ b/core/modules/system/src/MachineNameController.php @@ -58,10 +58,10 @@ public function transliterate(Request $request) { $lowercase = $request->query->get('lowercase'); $transliterated = $this->transliteration->transliterate($text, $langcode, '_'); - if($lowercase) { + if ($lowercase) { $transliterated = Unicode::strtolower($transliterated); } - if(isset($replace_pattern) && isset($replace)) { + if (isset($replace_pattern) && isset($replace)) { // Quote the pattern delimiter and remove null characters to avoid the e // or other modifiers being injected. $transliterated = preg_replace('@' . strtr($replace_pattern, ['@' => '\@', chr(0) => '']) . '@', $replace, $transliterated); diff --git a/core/modules/system/src/Tests/Common/RenderElementTypesTest.php b/core/modules/system/src/Tests/Common/RenderElementTypesTest.php index f470692db746655bb8719e7f820af3b0a54dab2d..e60bb52cb076e3c1812e7ff2422c0e6e773516aa 100644 --- a/core/modules/system/src/Tests/Common/RenderElementTypesTest.php +++ b/core/modules/system/src/Tests/Common/RenderElementTypesTest.php @@ -187,7 +187,7 @@ function testMoreLink() { ), ); - foreach($elements as $element) { + foreach ($elements as $element) { $xml = new \SimpleXMLElement(\Drupal::service('renderer')->renderRoot($element['value'])); $result = $xml->xpath($element['expected']); $this->assertTrue($result, '"' . $element['name'] . '" input rendered correctly by drupal_render().'); diff --git a/core/modules/system/src/Tests/Entity/EntityUnitTestBase.php b/core/modules/system/src/Tests/Entity/EntityUnitTestBase.php index 28463b73394e2ae86fe9ec10618cc83176a35b24..2ec64e8da8e4c30e8969247616b05ab987b6f36e 100644 --- a/core/modules/system/src/Tests/Entity/EntityUnitTestBase.php +++ b/core/modules/system/src/Tests/Entity/EntityUnitTestBase.php @@ -192,8 +192,7 @@ protected function generateRandomEntityId($string = FALSE) { // Drupal supported databases and is known to work for other databases // like SQL Server 2014 and Oracle 10 too. $id = $string ? $this->randomMachineName() : mt_rand(1, 0x7FFFFFFF); - } - while (isset($this->generatedIds[$id])); + } while (isset($this->generatedIds[$id])); $this->generatedIds[$id] = $id; return $id; } diff --git a/core/modules/system/src/Tests/Image/ToolkitGdTest.php b/core/modules/system/src/Tests/Image/ToolkitGdTest.php index f2c26c997e1d64ddd879c8883474c5f79c32ba5c..688909a0066ea154acfd4b1b7e2277c5cd488009 100644 --- a/core/modules/system/src/Tests/Image/ToolkitGdTest.php +++ b/core/modules/system/src/Tests/Image/ToolkitGdTest.php @@ -378,7 +378,7 @@ function testManipulations() { if ($image_reloaded->getToolkit()->getType() == IMAGETYPE_GIF) { $this->assertEqual('#ffff00', $image_reloaded->getToolkit()->getTransparentColor(), SafeMarkup::format('Image file %file has the correct transparent color channel set.', array('%file' => $file))); } - else { + else { $this->assertEqual(NULL, $image_reloaded->getToolkit()->getTransparentColor(), SafeMarkup::format('Image file %file has no color channel set.', array('%file' => $file))); } } diff --git a/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageTest.php b/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageTest.php index fe5a7f7f849ebd7ed3792a2d02b15f8460ec19f1..84dfad3e91b05d2309e4efbe3293adad7d12b4d3 100644 --- a/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageTest.php +++ b/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageTest.php @@ -147,8 +147,8 @@ protected function verifyImportedStringsTranslated() { $test_samples = ['Save and continue', 'Anonymous', 'Language']; $langcodes = ['de', 'es']; - foreach($test_samples as $sample) { - foreach($langcodes as $langcode) { + foreach ($test_samples as $sample) { + foreach ($langcodes as $langcode) { $edit = array(); $edit['langcode'] = $langcode; $edit['translation'] = 'translated'; diff --git a/core/modules/system/src/Tests/Installer/InstallerTranslationTest.php b/core/modules/system/src/Tests/Installer/InstallerTranslationTest.php index be2e0f506fd63093b928f7fe261ffe4fc561137c..330d61ff6bf856fa7a843a813163a9251f573b72 100644 --- a/core/modules/system/src/Tests/Installer/InstallerTranslationTest.php +++ b/core/modules/system/src/Tests/Installer/InstallerTranslationTest.php @@ -95,7 +95,7 @@ public function testInstaller() { // Verify the strings from the translation files were imported. $test_samples = ['Save and continue', 'Anonymous']; - foreach($test_samples as $sample) { + foreach ($test_samples as $sample) { $edit = array(); $edit['langcode'] = 'de'; $edit['translation'] = 'translated'; diff --git a/core/modules/system/src/Tests/KeyValueStore/KeyValueContentEntityStorageTest.php b/core/modules/system/src/Tests/KeyValueStore/KeyValueContentEntityStorageTest.php index 7b8af6217d6f29a10ba4794644fe0bdf564f3725..816116320fc0c15242401c0ce9fce3389cc7b51d 100644 --- a/core/modules/system/src/Tests/KeyValueStore/KeyValueContentEntityStorageTest.php +++ b/core/modules/system/src/Tests/KeyValueStore/KeyValueContentEntityStorageTest.php @@ -132,7 +132,8 @@ function testCRUD() { try { $same_id->save(); $this->fail('Not possible to overwrite an entity entity.'); - } catch (EntityStorageException $e) { + } + catch (EntityStorageException $e) { $this->pass('Not possible to overwrite an entity entity.'); } diff --git a/core/modules/system/src/Tests/Module/UninstallTest.php b/core/modules/system/src/Tests/Module/UninstallTest.php index 7ce67c4f5b578967b33bbe4671af207f171e9f10..9cecf8f14f1dd458d861002970b4178a80cf8344 100644 --- a/core/modules/system/src/Tests/Module/UninstallTest.php +++ b/core/modules/system/src/Tests/Module/UninstallTest.php @@ -134,7 +134,8 @@ public function testFailedInstallStatus() { try { $this->container->get('module_installer')->install(array('module_installer_config_test')); $this->fail($message); - } catch (EntityMalformedException $e) { + } + catch (EntityMalformedException $e) { $this->pass($message); } diff --git a/core/modules/system/src/Tests/Plugin/ContextPluginTest.php b/core/modules/system/src/Tests/Plugin/ContextPluginTest.php index 54b2ffbced63a450da53e9e0836e22c2df6d0e01..1711041324c8f316780d98fa889227cb4407e5fa 100644 --- a/core/modules/system/src/Tests/Plugin/ContextPluginTest.php +++ b/core/modules/system/src/Tests/Plugin/ContextPluginTest.php @@ -58,7 +58,7 @@ function testContext() { try { $plugin->getContextValue('user'); } - catch(ContextException $e) { + catch (ContextException $e) { $this->assertIdentical("The 'entity:user' context is required and not present.", $e->getMessage(), 'Requesting a non-set value of a required context should throw a context exception.'); } diff --git a/core/modules/system/src/Tests/System/ErrorHandlerTest.php b/core/modules/system/src/Tests/System/ErrorHandlerTest.php index fb4e7db08e4e531ced291bfb1e6de22d70ba6192..d95c03805696b3b53db4db9c929c8751602ffc68 100644 --- a/core/modules/system/src/Tests/System/ErrorHandlerTest.php +++ b/core/modules/system/src/Tests/System/ErrorHandlerTest.php @@ -46,7 +46,7 @@ function testErrorHandler() { '%function' => 'Drupal\error_test\Controller\ErrorTestController->Drupal\error_test\Controller\{closure}()', '@message' => 'Argument 1 passed to Drupal\error_test\Controller\ErrorTestController::Drupal\error_test\Controller\{closure}() must be of the type array, string given, called in ' . \Drupal::root() . '/core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php on line 62 and defined', ); - if (version_compare(PHP_VERSION, '7.0.0-dev') >= 0) { + if (version_compare(PHP_VERSION, '7.0.0-dev') >= 0) { // In PHP 7, instead of a recoverable fatal error we get a TypeError. $fatal_error['%type'] = 'TypeError'; // The error message also changes in PHP 7. diff --git a/core/modules/system/src/Tests/TypedData/TypedDataTest.php b/core/modules/system/src/Tests/TypedData/TypedDataTest.php index 9903240b0564d213068e55b4f5cde89e2a19c71e..eec3e1ebdb5e3dc5b2c16ab04950fdbddf59e8b5 100644 --- a/core/modules/system/src/Tests/TypedData/TypedDataTest.php +++ b/core/modules/system/src/Tests/TypedData/TypedDataTest.php @@ -248,7 +248,7 @@ public function testGetAndSet() { // Generate some files that will be used to test the binary data type. $files = array(); - for ($i = 0; $i < 3; $i++){ + for ($i = 0; $i < 3; $i++) { $path = "public://example_$i.png"; file_unmanaged_copy(\Drupal::root() . '/core/misc/druplicon.png', $path); $image = File::create(['uri' => $path]); diff --git a/core/modules/system/tests/modules/entity_test/src/Plugin/Derivative/EntityTestLocalTasks.php b/core/modules/system/tests/modules/entity_test/src/Plugin/Derivative/EntityTestLocalTasks.php index 11eac7fa7226c3a27b5f9bb46bfd1a81bf69045c..059c3a9f4f1964b8b2abf73809dda4dc2561aeda 100644 --- a/core/modules/system/tests/modules/entity_test/src/Plugin/Derivative/EntityTestLocalTasks.php +++ b/core/modules/system/tests/modules/entity_test/src/Plugin/Derivative/EntityTestLocalTasks.php @@ -16,7 +16,7 @@ public function getDerivativeDefinitions($base_plugin_definition) { $this->derivatives = array(); $types = entity_test_entity_types(ENTITY_TEST_TYPES_ROUTING); - foreach($types as $entity_type) { + foreach ($types as $entity_type) { $this->derivatives[$entity_type . '.canonical'] = array(); $this->derivatives[$entity_type . '.canonical']['base_route'] = "entity.$entity_type.canonical"; $this->derivatives[$entity_type . '.canonical']['route_name'] = "entity.$entity_type.canonical"; diff --git a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php index 8ebc909739079da7d1828537d11d54d2fc2b3088..1693af1795ce13b300bd2d6d7829114336afc9fe 100644 --- a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php +++ b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php @@ -322,7 +322,7 @@ public function validateExposed(&$form, FormStateInterface $form_state) { // We only validate if they've chosen the text field style. if ($this->options['type'] != 'textfield') { - if ($form_state->getValue($identifier) != 'All') { + if ($form_state->getValue($identifier) != 'All') { $this->validated_exposed_input = (array) $form_state->getValue($identifier); } return; diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module index be4f7fa433d281c06e9648dbf8bd9f05e86faf9b..30a9ca224b8393b9b7b2b9b4f255ab061b73bd96 100644 --- a/core/modules/taxonomy/taxonomy.module +++ b/core/modules/taxonomy/taxonomy.module @@ -326,7 +326,7 @@ function taxonomy_term_load_multiple_by_name($name, $vocabulary = NULL) { $values = array('name' => trim($name)); if (isset($vocabulary)) { $vocabularies = taxonomy_vocabulary_get_names(); - if (isset($vocabularies[$vocabulary])){ + if (isset($vocabularies[$vocabulary])) { $values['vid'] = $vocabulary; } else { diff --git a/core/modules/tour/src/Entity/Tour.php b/core/modules/tour/src/Entity/Tour.php index 5308fd363eb5185afd24212fcec27383eeb52984..290d3f8fb9fa87c2a914018549081d5baafdeda0 100644 --- a/core/modules/tour/src/Entity/Tour.php +++ b/core/modules/tour/src/Entity/Tour.php @@ -171,7 +171,7 @@ public function resetKeyedRoutes() { public function calculateDependencies() { parent::calculateDependencies(); - foreach($this->tipsCollection as $instance) { + foreach ($this->tipsCollection as $instance) { $definition = $instance->getPluginDefinition(); $this->addDependency('module', $definition['provider']); } diff --git a/core/modules/views/src/Plugin/views/PluginBase.php b/core/modules/views/src/Plugin/views/PluginBase.php index 1cc52f3df8dc4ff377ded9835c6726b46f0f7477..323a985ff7d6c883ee1ae6a7c09ed1775b87c664 100644 --- a/core/modules/views/src/Plugin/views/PluginBase.php +++ b/core/modules/views/src/Plugin/views/PluginBase.php @@ -373,7 +373,7 @@ protected function viewsTokenReplace($text, $tokens) { $top = array_shift($parts); assert('preg_match(\'/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/\', $top) === 1', 'Tokens need to be valid Twig variables.'); $token_array = array(array_pop($parts) => $replacement); - foreach(array_reverse($parts) as $key) { + foreach (array_reverse($parts) as $key) { assert('preg_match(\'/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/\', $key) === 1', 'Tokens need to be valid Twig variables.'); $token_array = array($key => $token_array); } diff --git a/core/modules/views/src/Plugin/views/style/StylePluginBase.php b/core/modules/views/src/Plugin/views/style/StylePluginBase.php index 648b1786807152db1db172096956f533f0c9ec39..404de3ed2621174e1da17ef9ce157bb8841a2245 100644 --- a/core/modules/views/src/Plugin/views/style/StylePluginBase.php +++ b/core/modules/views/src/Plugin/views/style/StylePluginBase.php @@ -720,7 +720,7 @@ protected function renderFields(array $result) { $fields = $this->view->field; $rendered_fields = &$this->rendered_fields[$index]; $post_render_tokens = []; - foreach ($field_ids as $id) { + foreach ($field_ids as $id) { $rendered_fields[$id] = $data[$id]['#markup']; $tokens = $fields[$id]->postRender($row, $rendered_fields[$id]); if ($tokens) { diff --git a/core/modules/views_ui/src/Tests/NewViewConfigSchemaTest.php b/core/modules/views_ui/src/Tests/NewViewConfigSchemaTest.php index 758e64e3edd2cf0cde67962270fbc9306c7f1053..a01e24bda6a07c537ba4e9e974c936c7ceffeadf 100644 --- a/core/modules/views_ui/src/Tests/NewViewConfigSchemaTest.php +++ b/core/modules/views_ui/src/Tests/NewViewConfigSchemaTest.php @@ -38,7 +38,7 @@ public function testNewViews() { 'standard:aggregator_feed', 'standard:aggregator_item', ); - foreach($wizards as $wizard_key) { + foreach ($wizards as $wizard_key) { $edit = array(); $edit['label'] = $this->randomString(); $edit['id'] = strtolower($this->randomMachineName()); diff --git a/core/phpcs.xml.dist b/core/phpcs.xml.dist index 3d7ad63e9fb7387c0a1042d54546c29e0a11b05f..061c82525fd5787792c252c56240bdd10a5137fb 100644 --- a/core/phpcs.xml.dist +++ b/core/phpcs.xml.dist @@ -68,6 +68,7 @@ <exclude name="Drupal.Commenting.FunctionComment.WrongStyle"/> </rule> <rule ref="Drupal.ControlStructures.ElseIf"/> + <rule ref="Drupal.ControlStructures.ControlSignature"/> <rule ref="Drupal.Files.EndFileNewline"/> <rule ref="Drupal.Files.TxtFileLineLength"/> <rule ref="Drupal.Formatting.SpaceInlineIf"/> diff --git a/core/tests/Drupal/KernelTests/AssertConfigTrait.php b/core/tests/Drupal/KernelTests/AssertConfigTrait.php index eb9fb8ef02d4e4f4b955b791117710b3837a1588..c2e770f0e68d738f5d2a40faa66f0cb925c1e9f4 100644 --- a/core/tests/Drupal/KernelTests/AssertConfigTrait.php +++ b/core/tests/Drupal/KernelTests/AssertConfigTrait.php @@ -75,7 +75,7 @@ protected function assertConfigDiff(Diff $result, $config_name, array $skipped_c } foreach ($op->closing as $closing) { // The UUIDs don't exist in the default config. - if (strpos($closing, 'uuid: ') === 0) { + if (strpos($closing, 'uuid: ') === 0) { continue; } throw new \Exception($config_name . ': ' . var_export($op, TRUE)); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigCRUDTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigCRUDTest.php index 31b6adc51e7e8b68d4dbfb287094f3134bc28b45..4664eeb7d3e4a62d0fb9f175d79f3eaede8b47e9 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigCRUDTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigCRUDTest.php @@ -263,7 +263,7 @@ public function testDataTypes() { $this->assertIdentical($config->get(), $data); // Re-set each key using Config::set(). - foreach($data as $key => $value) { + foreach ($data as $key => $value) { $config->set($key, $value); } $config->save(); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigDependencyTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigDependencyTest.php index cfeeb8213539684b02fd87f8e68bf1c00014d6a3..291f077641d05246cbd3fa34175c7cf2a42e2a8e 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigDependencyTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigDependencyTest.php @@ -473,7 +473,7 @@ public function testContentEntityDelete() { */ protected function getDependentIds(array $dependents) { $dependent_ids = array(); - foreach($dependents as $dependent) { + foreach ($dependents as $dependent) { $dependent_ids[] = $dependent->getEntityTypeId() . ':' . $dependent->id(); } return $dependent_ids; diff --git a/core/tests/Drupal/KernelTests/Core/Database/InsertDefaultsTest.php b/core/tests/Drupal/KernelTests/Core/Database/InsertDefaultsTest.php index 8093af2493dd7c605220975a3b46a5ede0db037b..1d0b0c78186a8d001271c65d5846f18d2954cfc0 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/InsertDefaultsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/InsertDefaultsTest.php @@ -34,7 +34,8 @@ function testDefaultEmptyInsert() { db_insert('test')->execute(); // This is only executed if no exception has been thrown. $this->fail('Expected exception NoFieldsException has not been thrown.'); - } catch (NoFieldsException $e) { + } + catch (NoFieldsException $e) { $this->pass('Expected exception NoFieldsException has been thrown.'); } diff --git a/core/tests/Drupal/KernelTests/Core/Database/LargeQueryTest.php b/core/tests/Drupal/KernelTests/Core/Database/LargeQueryTest.php index 7037cedadcb7c6534afb77e33be2066cb7105c4f..4b24ebefbd7a7beaf4e6a9984916f23f9be41893 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/LargeQueryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/LargeQueryTest.php @@ -31,7 +31,8 @@ function testMaxAllowedPacketQueryTruncating() { try { db_query('SELECT name FROM {test} WHERE name = :name', array(':name' => $long_name)); $this->fail("An exception should be thrown for queries larger than 'max_allowed_packet'"); - } catch (DatabaseException $e) { + } + catch (DatabaseException $e) { // Close and re-open the connection. Otherwise we will run into error // 2006 "MySQL server had gone away" afterwards. Database::closeConnection(); diff --git a/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php b/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php index fa0a7cd9b71e93a14d3dd66b3879d1898e534883..7866146f90b8b0eb918504f5840329056d842e54 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php @@ -230,7 +230,8 @@ function testSchema() { try { db_create_table('test_timestamp', $table_specification); } - catch (\Exception $e) {} + catch (\Exception $e) { + } $this->assertTrue(db_table_exists('test_timestamp'), 'Table with database specific datatype was created.'); } diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php index 73a7d898d537bf15ace1d545db83490d6ce7102a..23cf0340c541060ea9167692a2a26d152fc52be0 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php @@ -368,7 +368,8 @@ public function testBundleFieldCreateDeleteWithExistingEntities() { ->fields($values) ->execute(); $this->pass($message); - } else { + } + else { // Keep throwing it. throw $e; } diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBase.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBase.php index 216e03fc3cddd2018c37bf5c8b6dd1e7c75886c0..4b08a56f82ae4fdf9670f748c01d95899e21cbaf 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBase.php @@ -189,8 +189,7 @@ protected function generateRandomEntityId($string = FALSE) { // Drupal supported databases and is known to work for other databases // like SQL Server 2014 and Oracle 10 too. $id = $string ? $this->randomMachineName() : mt_rand(1, 0x7FFFFFFF); - } - while (isset($this->generatedIds[$id])); + } while (isset($this->generatedIds[$id])); $this->generatedIds[$id] = $id; return $id; } diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php index 2291355fd8b3b431d2fd902421cd121e2973a227..10d711f348788398ddf979b7bbd9e3890eb770b1 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php @@ -76,7 +76,7 @@ protected function assertCRUD($entity_type) { // Creating a duplicate needs to result in a new UUID. $entity_duplicate = $entity->createDuplicate(); foreach ($entity->getFields() as $property => $value) { - switch($property) { + switch ($property) { case 'uuid': $this->assertNotNull($entity_duplicate->uuid()); $this->assertNotNull($entity->uuid()); diff --git a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php index d10c82d86b5aa69d683a4d6aba24cda10ea7b13b..603b41df6c80f6f617cd0edf0c69d23db01c32df 100644 --- a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php @@ -178,7 +178,7 @@ protected function setUp() { */ public function aliasManagerCallback() { $args = func_get_args(); - switch($args[0]) { + switch ($args[0]) { case '/test/one': return '/hello/world'; case '/test/two/5':