From ba9610abcdc9711da8129bcb0879bb869d8a28ec Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Sun, 8 May 2016 11:29:19 -0500 Subject: [PATCH] Issue #2708185 by anoopjohn: Fix 'Drupal.Commenting.FunctionComment' coding standard - Issues related to spacing and styling (cherry picked from commit b5969b69bd979d468e8d6ffa69071b5441465b7d) --- .../Core/DependencyInjection/YamlFileLoader.php | 9 +++++---- core/lib/Drupal/Core/Entity/EntityStorageBase.php | 2 +- .../Drupal/Core/Field/FieldItemListInterface.php | 2 +- core/lib/Drupal/Core/Locale/CountryManager.php | 2 +- .../lib/Drupal/Core/Lock/LockBackendInterface.php | 8 ++++---- .../Plugin/Context/ContextHandlerInterface.php | 2 +- core/lib/Drupal/Core/Routing/RouteProvider.php | 3 ++- .../Drupal/Core/Routing/UrlGeneratorInterface.php | 2 +- .../tests/src/Kernel/AggregatorTitleTest.php | 2 +- .../block/src/Tests/BlockHookOperationTest.php | 2 +- core/modules/field/src/Tests/FormTest.php | 8 -------- .../locale/src/Tests/LocaleTranslationUiTest.php | 2 +- .../modules/node/src/Plugin/Search/NodeSearch.php | 2 +- .../node/src/Tests/NodeFieldMultilingualTest.php | 2 +- .../search/src/Plugin/SearchPluginBase.php | 4 ++-- .../src/SerializationTestNormalizer.php | 2 +- .../simpletest/src/Tests/SimpleTestTest.php | 15 ++++++++++----- core/modules/system/system.install | 2 +- .../twig_theme_test/twig_theme_test.module | 2 +- .../tour/tests/src/Unit/Entity/TourTest.php | 2 +- .../modules/user/src/Plugin/Search/UserSearch.php | 2 +- .../src/Entity/Render/EntityFieldRenderer.php | 1 - .../views/src/Plugin/views/filter/Combine.php | 7 ++++--- .../src/Plugin/views/filter/FilterPluginBase.php | 2 +- .../tests/src/Kernel/Handler/FieldCounterTest.php | 4 +++- core/phpcs.xml.dist | 4 ---- .../module_handler_test_all1.module | 4 +++- .../Tests/Core/Password/PasswordHashingTest.php | 4 +++- 28 files changed, 52 insertions(+), 51 deletions(-) diff --git a/core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php b/core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php index 0f02dd76abe1..1fb810b41d5a 100644 --- a/core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php +++ b/core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php @@ -52,7 +52,8 @@ public function __construct(ContainerBuilder $container) /** * Loads a Yaml file. * - * @param mixed $file The resource + * @param mixed $file + * The resource */ public function load($file) { @@ -99,7 +100,7 @@ public function load($file) /** * Parses definitions * - * @param array $content + * @param array $content * @param string $file */ private function parseDefinitions($content, $file) @@ -121,7 +122,7 @@ private function parseDefinitions($content, $file) * Parses a definition. * * @param string $id - * @param array $service + * @param array $service * @param string $file * * @throws InvalidArgumentException When tags are invalid @@ -336,7 +337,7 @@ protected function loadFile($file) /** * Validates a YAML file. * - * @param mixed $content + * @param mixed $content * @param string $file * * @return array diff --git a/core/lib/Drupal/Core/Entity/EntityStorageBase.php b/core/lib/Drupal/Core/Entity/EntityStorageBase.php index 70e4f7c7a5b6..f58312106e41 100644 --- a/core/lib/Drupal/Core/Entity/EntityStorageBase.php +++ b/core/lib/Drupal/Core/Entity/EntityStorageBase.php @@ -159,7 +159,7 @@ protected function setStaticCache(array $entities) { * @param string $hook * One of 'presave', 'insert', 'update', 'predelete', 'delete', or * 'revision_delete'. - * @param \Drupal\Core\Entity\EntityInterface $entity + * @param \Drupal\Core\Entity\EntityInterface $entity * The entity object. */ protected function invokeHook($hook, EntityInterface $entity) { diff --git a/core/lib/Drupal/Core/Field/FieldItemListInterface.php b/core/lib/Drupal/Core/Field/FieldItemListInterface.php index abeb9f2a2c25..e8bba024e9a8 100644 --- a/core/lib/Drupal/Core/Field/FieldItemListInterface.php +++ b/core/lib/Drupal/Core/Field/FieldItemListInterface.php @@ -181,7 +181,7 @@ public function deleteRevision(); */ public function view($display_options = array()); - /* + /** * Populates a specified number of field items with valid sample data. * * @param int $count diff --git a/core/lib/Drupal/Core/Locale/CountryManager.php b/core/lib/Drupal/Core/Locale/CountryManager.php index ac7f1bff5c86..451758e08273 100644 --- a/core/lib/Drupal/Core/Locale/CountryManager.php +++ b/core/lib/Drupal/Core/Locale/CountryManager.php @@ -21,7 +21,7 @@ class CountryManager implements CountryManagerInterface { */ protected $countries; - /* + /** * Constructor. * * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler diff --git a/core/lib/Drupal/Core/Lock/LockBackendInterface.php b/core/lib/Drupal/Core/Lock/LockBackendInterface.php index 8c65385871b4..e2912958fc8a 100644 --- a/core/lib/Drupal/Core/Lock/LockBackendInterface.php +++ b/core/lib/Drupal/Core/Lock/LockBackendInterface.php @@ -68,8 +68,8 @@ interface LockBackendInterface { * * @param string $name * Lock name. Limit of name's length is 255 characters. - * @param float $timeout = 30.0 - * (optional) Lock lifetime in seconds. + * @param float $timeout + * (optional) Lock lifetime in seconds. Defaults to 30.0. * * @return bool */ @@ -95,8 +95,8 @@ public function lockMayBeAvailable($name); * * @param string $name * Lock name currently being locked. - * @param int $delay = 30 - * Milliseconds to wait for. + * @param int $delay + * Milliseconds to wait for. Defaults to 30. * * @return bool * TRUE if the lock holds, FALSE if it may be available. You still need to diff --git a/core/lib/Drupal/Core/Plugin/Context/ContextHandlerInterface.php b/core/lib/Drupal/Core/Plugin/Context/ContextHandlerInterface.php index 5848bc3c8e28..2a219e93788d 100644 --- a/core/lib/Drupal/Core/Plugin/Context/ContextHandlerInterface.php +++ b/core/lib/Drupal/Core/Plugin/Context/ContextHandlerInterface.php @@ -17,7 +17,7 @@ interface ContextHandlerInterface { * * @param \Drupal\Component\Plugin\Context\ContextInterface[] $contexts * An array of contexts. - * @param array $definitions . + * @param array $definitions * An array of plugin definitions. * * @return array diff --git a/core/lib/Drupal/Core/Routing/RouteProvider.php b/core/lib/Drupal/Core/Routing/RouteProvider.php index 8c631d7f209e..53ed6262eed4 100644 --- a/core/lib/Drupal/Core/Routing/RouteProvider.php +++ b/core/lib/Drupal/Core/Routing/RouteProvider.php @@ -134,7 +134,8 @@ public function __construct(Connection $connection, StateInterface $state, Curre * very large route sets to be filtered down to likely candidates, which * may then be filtered in memory more completely. * - * @param Request $request A request against which to match. + * @param Request $request + * A request against which to match. * * @return \Symfony\Component\Routing\RouteCollection with all urls that * could potentially match $request. Empty collection if nothing can diff --git a/core/lib/Drupal/Core/Routing/UrlGeneratorInterface.php b/core/lib/Drupal/Core/Routing/UrlGeneratorInterface.php index 9a314edd340e..f5174f1d2636 100644 --- a/core/lib/Drupal/Core/Routing/UrlGeneratorInterface.php +++ b/core/lib/Drupal/Core/Routing/UrlGeneratorInterface.php @@ -34,7 +34,7 @@ public function getPathFromRoute($name, $parameters = array()); * * @param string|\Symfony\Component\Routing\Route $name * The route name or a route object. - * @param array $parameters + * @param array $parameters * An associative array of parameter names and values. * @param array $options * (optional) An associative array of additional options, with the following diff --git a/core/modules/aggregator/tests/src/Kernel/AggregatorTitleTest.php b/core/modules/aggregator/tests/src/Kernel/AggregatorTitleTest.php index eacd139c66e9..782ac6f14b08 100644 --- a/core/modules/aggregator/tests/src/Kernel/AggregatorTitleTest.php +++ b/core/modules/aggregator/tests/src/Kernel/AggregatorTitleTest.php @@ -43,7 +43,7 @@ protected function setUp() { $this->fieldName = 'title'; } - /* + /** * Tests the formatter output. */ public function testStringFormatter() { diff --git a/core/modules/block/src/Tests/BlockHookOperationTest.php b/core/modules/block/src/Tests/BlockHookOperationTest.php index 1f3b55db3e5b..91ea84300f2d 100644 --- a/core/modules/block/src/Tests/BlockHookOperationTest.php +++ b/core/modules/block/src/Tests/BlockHookOperationTest.php @@ -31,7 +31,7 @@ protected function setUp() { $this->drupalLogin($admin_user); } - /* + /** * Tests the block list to see if the test_operation link is added. */ public function testBlockOperationAlter() { diff --git a/core/modules/field/src/Tests/FormTest.php b/core/modules/field/src/Tests/FormTest.php index 51c80b39a225..c2efc175f74b 100644 --- a/core/modules/field/src/Tests/FormTest.php +++ b/core/modules/field/src/Tests/FormTest.php @@ -230,14 +230,6 @@ function testFieldFormSingleRequired() { $this->assertRaw(t('@name field is required.', array('@name' => $this->field['label'])), 'Required field with no value fails validation'); } -// function testFieldFormMultiple() { -// $this->field = $this->field_multiple; -// $field_name = $this->field['field_name']; -// $this->instance['field_name'] = $field_name; -// FieldStorageConfig::create($this->field)->save(); -// FieldConfig::create($this->instance)->save(); -// } - function testFieldFormUnlimited() { $field_storage = $this->fieldStorageUnlimited; $field_name = $field_storage['field_name']; diff --git a/core/modules/locale/src/Tests/LocaleTranslationUiTest.php b/core/modules/locale/src/Tests/LocaleTranslationUiTest.php index ba1678244ebd..aad0119fa238 100644 --- a/core/modules/locale/src/Tests/LocaleTranslationUiTest.php +++ b/core/modules/locale/src/Tests/LocaleTranslationUiTest.php @@ -205,7 +205,7 @@ public function testStringTranslation() { $this->assertNoText(t('No strings available.'), 'The translation has been removed'); } - /* + /** * Adds a language and checks that the JavaScript translation files are * properly created and rebuilt on deletion. */ diff --git a/core/modules/node/src/Plugin/Search/NodeSearch.php b/core/modules/node/src/Plugin/Search/NodeSearch.php index 927861c17929..d161a0a0d783 100644 --- a/core/modules/node/src/Plugin/Search/NodeSearch.php +++ b/core/modules/node/src/Plugin/Search/NodeSearch.php @@ -623,7 +623,7 @@ public function searchFormAlter(array &$form, FormStateInterface $form_state) { } } - /* + /** * {@inheritdoc} */ public function buildSearchUrlQuery(FormStateInterface $form_state) { diff --git a/core/modules/node/src/Tests/NodeFieldMultilingualTest.php b/core/modules/node/src/Tests/NodeFieldMultilingualTest.php index e9a96a95ca7c..9beae5df8588 100644 --- a/core/modules/node/src/Tests/NodeFieldMultilingualTest.php +++ b/core/modules/node/src/Tests/NodeFieldMultilingualTest.php @@ -97,7 +97,7 @@ function testMultilingualNodeForm() { $this->assertRaw($body_value, 'Body correctly displayed using English as requested language'); } - /* + /** * Tests multilingual field display settings. */ function testMultilingualDisplaySettings() { diff --git a/core/modules/search/src/Plugin/SearchPluginBase.php b/core/modules/search/src/Plugin/SearchPluginBase.php index c7beea85da81..d253972ce16d 100644 --- a/core/modules/search/src/Plugin/SearchPluginBase.php +++ b/core/modules/search/src/Plugin/SearchPluginBase.php @@ -129,7 +129,7 @@ public function suggestedTitle() { return $this->t('Search'); } - /* + /** * {@inheritdoc} */ public function buildSearchUrlQuery(FormStateInterface $form_state) { @@ -140,7 +140,7 @@ public function buildSearchUrlQuery(FormStateInterface $form_state) { return $query; } - /* + /** * {@inheritdoc} */ public function getHelp() { diff --git a/core/modules/serialization/tests/serialization_test/src/SerializationTestNormalizer.php b/core/modules/serialization/tests/serialization_test/src/SerializationTestNormalizer.php index 0cb58335528e..16775534f6b0 100644 --- a/core/modules/serialization/tests/serialization_test/src/SerializationTestNormalizer.php +++ b/core/modules/serialization/tests/serialization_test/src/SerializationTestNormalizer.php @@ -36,7 +36,7 @@ public function normalize($object, $format = NULL, array $context = array()) { /** * Checks whether format is supported by this normalizer. * - * @param mixed $data + * @param mixed $data * Data to normalize. * @param string $format * Format the normalization result will be encoded as. diff --git a/core/modules/simpletest/src/Tests/SimpleTestTest.php b/core/modules/simpletest/src/Tests/SimpleTestTest.php index 290403b71273..19ab17f586a4 100644 --- a/core/modules/simpletest/src/Tests/SimpleTestTest.php +++ b/core/modules/simpletest/src/Tests/SimpleTestTest.php @@ -284,11 +284,16 @@ function getTestIdFromResults() { /** * Asserts that an assertion with specified values is displayed in results. * - * @param string $message Assertion message. - * @param string $type Assertion type. - * @param string $status Assertion status. - * @param string $file File where the assertion originated. - * @param string $function Function where the assertion originated. + * @param string $message + * Assertion message. + * @param string $type + * Assertion type. + * @param string $status + * Assertion status. + * @param string $file + * File where the assertion originated. + * @param string $function + * Function where the assertion originated. * * @return Assertion result. */ diff --git a/core/modules/system/system.install b/core/modules/system/system.install index c7168919db25..cdaeba680e30 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -996,7 +996,7 @@ function system_schema() { * @{ */ -/* +/** * Change two fields on the default menu link storage to be serialized data. */ function system_update_8001(&$sandbox = NULL) { diff --git a/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module b/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module index 0d6bad8a9413..550b5ca1730b 100644 --- a/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module +++ b/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module @@ -76,7 +76,7 @@ function twig_theme_test_theme($existing, $type, $theme, $path) { return $items; } -/* +/** * Helper function to test PHP variables in the Twig engine. */ function _test_theme_twig_php_values() { diff --git a/core/modules/tour/tests/src/Unit/Entity/TourTest.php b/core/modules/tour/tests/src/Unit/Entity/TourTest.php index f08ea2d90fc8..2c71aa9650c6 100644 --- a/core/modules/tour/tests/src/Unit/Entity/TourTest.php +++ b/core/modules/tour/tests/src/Unit/Entity/TourTest.php @@ -41,7 +41,7 @@ public function testHasMatchingRoute($routes, $route_name, $route_params, $resul $tour->resetKeyedRoutes(); } - /* + /** * Provides sample routes for testing. */ public function routeProvider() { diff --git a/core/modules/user/src/Plugin/Search/UserSearch.php b/core/modules/user/src/Plugin/Search/UserSearch.php index 5332939cb85e..f8471211d7a7 100644 --- a/core/modules/user/src/Plugin/Search/UserSearch.php +++ b/core/modules/user/src/Plugin/Search/UserSearch.php @@ -158,7 +158,7 @@ public function execute() { return $results; } - /* + /** * {@inheritdoc} */ public function getHelp() { diff --git a/core/modules/views/src/Entity/Render/EntityFieldRenderer.php b/core/modules/views/src/Entity/Render/EntityFieldRenderer.php index cf76b8866c91..1b05c1b2a360 100644 --- a/core/modules/views/src/Entity/Render/EntityFieldRenderer.php +++ b/core/modules/views/src/Entity/Render/EntityFieldRenderer.php @@ -88,7 +88,6 @@ protected function getEntityManager() { /** * {@inheritdoc} */ - protected function getLanguageManager() { return $this->languageManager; } diff --git a/core/modules/views/src/Plugin/views/filter/Combine.php b/core/modules/views/src/Plugin/views/filter/Combine.php index 292986f2bc4c..f5a6035f7885 100644 --- a/core/modules/views/src/Plugin/views/filter/Combine.php +++ b/core/modules/views/src/Plugin/views/filter/Combine.php @@ -118,9 +118,10 @@ public function validate() { return $errors; } - // By default things like opEqual uses add_where, that doesn't support - // complex expressions, so override all operators. - + /** + * By default things like opEqual uses add_where, that doesn't support + * complex expressions, so override opEqual (and all operators below). + */ function opEqual($expression) { $placeholder = $this->placeholder(); $operator = $this->operator(); diff --git a/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php b/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php index cf00bf742a43..c458e6344ad3 100644 --- a/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php +++ b/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php @@ -1227,7 +1227,7 @@ public function exposedInfo() { ); } - /* + /** * Transform the input from a grouped filter into a standard filter. * * When a filter is a group, find the set of operator and values diff --git a/core/modules/views/tests/src/Kernel/Handler/FieldCounterTest.php b/core/modules/views/tests/src/Kernel/Handler/FieldCounterTest.php index 190f476c82f3..12f68ede749a 100644 --- a/core/modules/views/tests/src/Kernel/Handler/FieldCounterTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/FieldCounterTest.php @@ -84,7 +84,9 @@ function testSimple() { $this->assertEqual($counter, (string) $expected_number, format_string('Make sure the expected number (@expected) patches with the rendered number (@counter)', array('@expected' => $expected_number, '@counter' => $counter))); } - // @TODO: Write tests for pager. + /** + * @todo: Write tests for pager. + */ function testPager() { } diff --git a/core/phpcs.xml.dist b/core/phpcs.xml.dist index 5195a2595190..f558eecb9adb 100644 --- a/core/phpcs.xml.dist +++ b/core/phpcs.xml.dist @@ -64,20 +64,16 @@ <exclude name="Drupal.Commenting.FunctionComment.MissingReturnComment"/> <exclude name="Drupal.Commenting.FunctionComment.MissingReturnType"/> <exclude name="Drupal.Commenting.FunctionComment.ParamCommentFullStop"/> - <exclude name="Drupal.Commenting.FunctionComment.ParamCommentNewLine"/> <exclude name="Drupal.Commenting.FunctionComment.ParamCommentNotCapital"/> <exclude name="Drupal.Commenting.FunctionComment.ParamNameNoMatch"/> <exclude name="Drupal.Commenting.FunctionComment.ReturnCommentIndentation"/> <exclude name="Drupal.Commenting.FunctionComment.SeeAdditionalText"/> <exclude name="Drupal.Commenting.FunctionComment.SeePunctuation"/> - <exclude name="Drupal.Commenting.FunctionComment.SpacingAfter"/> - <exclude name="Drupal.Commenting.FunctionComment.SpacingAfterParamType"/> <exclude name="Drupal.Commenting.FunctionComment.ThrowsComment"/> <exclude name="Drupal.Commenting.FunctionComment.ThrowsNoFullStop"/> <exclude name="Drupal.Commenting.FunctionComment.ThrowsNotCapital"/> <exclude name="Drupal.Commenting.FunctionComment.TypeHintMissing"/> <exclude name="Drupal.Commenting.FunctionComment.VoidReturn"/> - <exclude name="Drupal.Commenting.FunctionComment.WrongStyle"/> </rule> <rule ref="Drupal.ControlStructures.ElseIf"/> <rule ref="Drupal.ControlStructures.ControlSignature"/> diff --git a/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_all1/module_handler_test_all1.module b/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_all1/module_handler_test_all1.module index 1555aec793ae..4689c02ce427 100644 --- a/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_all1/module_handler_test_all1.module +++ b/core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_all1/module_handler_test_all1.module @@ -5,5 +5,7 @@ * Test module. */ -// return an array to test nested merge in invoke all. +/** + * Returns an array to test nested merge in invoke all. + */ function module_handler_test_all1_hook($arg) { return array($arg); } diff --git a/core/tests/Drupal/Tests/Core/Password/PasswordHashingTest.php b/core/tests/Drupal/Tests/Core/Password/PasswordHashingTest.php index 4bebf4cec72a..5c378ed622aa 100644 --- a/core/tests/Drupal/Tests/Core/Password/PasswordHashingTest.php +++ b/core/tests/Drupal/Tests/Core/Password/PasswordHashingTest.php @@ -181,7 +181,9 @@ function __construct() { // Noop. } - // Expose this method as public for tests. + /** + * Exposes this method as public for tests. + */ public function enforceLog2Boundaries($count_log2) { return parent::enforceLog2Boundaries($count_log2); } -- GitLab