From 61b92f80c90906734be743acb221e839c4a0c73f Mon Sep 17 00:00:00 2001 From: nod_ <nod_@598310.no-reply.drupal.org> Date: Wed, 15 Jan 2025 12:24:00 +0100 Subject: [PATCH] Issue #3454142 by quietone, smustgrave, larowlan: Convert long array syntax in comments --- core/lib/Drupal/Component/Gettext/PoHeader.php | 18 ++++++++++++------ core/lib/Drupal/Core/Database/Database.php | 11 ++++++----- core/lib/Drupal/Core/Database/Log.php | 17 +++++++++-------- core/lib/Drupal/Core/Database/Query/Select.php | 10 +++++----- .../Drupal/Core/Datetime/DrupalDateTime.php | 4 +++- .../common_test/src/Hook/CommonTestHooks.php | 2 +- 6 files changed, 36 insertions(+), 26 deletions(-) diff --git a/core/lib/Drupal/Component/Gettext/PoHeader.php b/core/lib/Drupal/Component/Gettext/PoHeader.php index 362d098cb767..5ba4f88eacd2 100644 --- a/core/lib/Drupal/Component/Gettext/PoHeader.php +++ b/core/lib/Drupal/Component/Gettext/PoHeader.php @@ -440,20 +440,24 @@ private function tokenizeFormula($formula) { * An example of plural formula parting and evaluation: * Plural formula: 'n!=1' * This formula is parsed by parseArithmetic() to a stack (array) of elements: - * array( + * @code + * [ * 0 => '$n', * 1 => '1', * 2 => '!=', - * ); + * ]; + * @endcode * The evaluatePlural() method evaluates the $element_stack using the plural * value $n. Before the actual evaluation, the '$n' in the array is replaced * by the value of $n. * For example: $n = 2 results in: - * array( + * @code + * [ * 0 => '2', * 1 => '1', * 2 => '!=', - * ); + * ] + * @endcode * The stack is processed until only one element is (the result) is left. In * every iteration the top elements of the stack, up until the first operator, * are evaluated. After evaluation the arguments and the operator itself are @@ -462,9 +466,11 @@ private function tokenizeFormula($formula) { * Because the operator is '!=' the example stack is evaluated as: * $f = (int) 2 != 1; * The resulting stack is: - * array( + * @code + * [ * 0 => 1, - * ); + * ] + * @endcode * With only one element left in the stack (the final result) the loop is * terminated and the result is returned. * diff --git a/core/lib/Drupal/Core/Database/Database.php b/core/lib/Drupal/Core/Database/Database.php index 92751cef4325..d4ce475bd9da 100644 --- a/core/lib/Drupal/Core/Database/Database.php +++ b/core/lib/Drupal/Core/Database/Database.php @@ -47,14 +47,15 @@ abstract class Database { /** * An array of active query log objects. * + * @var array * Every connection has one and only one logger object for all targets and * logging keys. * - * array( - * '$db_key' => DatabaseLog object. - * ); - * - * @var array + * @code + * [ + * '$db_key' => DatabaseLog object. + * ] + * @endcode */ protected static $logs = []; diff --git a/core/lib/Drupal/Core/Database/Log.php b/core/lib/Drupal/Core/Database/Log.php index 79f260502052..62f1e1b88025 100644 --- a/core/lib/Drupal/Core/Database/Log.php +++ b/core/lib/Drupal/Core/Database/Log.php @@ -20,16 +20,17 @@ class Log { /** * Cache of logged queries. This will only be used if the query logger is enabled. * + * @var array * The structure for the logging array is as follows: * - * array( - * $logging_key = array( - * array('query' => '', 'args' => array(), 'caller' => '', 'target' => '', 'time' => 0, 'start' => 0), - * array('query' => '', 'args' => array(), 'caller' => '', 'target' => '', 'time' => 0, 'start' => 0), - * ), - * ); - * - * @var array + * @code + * [ + * $logging_key = [ + * ['query' => '', 'args' => [], 'caller' => '', 'target' => '', 'time' => 0, 'start' => 0], + * ['query' => '', 'args' => [], 'caller' => '', 'target' => '', 'time' => 0, 'start' => 0], + * ], + * ]; + * @endcode */ protected $queryLog = []; diff --git a/core/lib/Drupal/Core/Database/Query/Select.php b/core/lib/Drupal/Core/Database/Query/Select.php index bf8414aebc3a..3632775f45bd 100644 --- a/core/lib/Drupal/Core/Database/Query/Select.php +++ b/core/lib/Drupal/Core/Database/Query/Select.php @@ -30,26 +30,26 @@ class Select extends Query implements SelectInterface { /** * The tables against which to JOIN. * + * @var array * This property is a nested array. Each entry is an array representing * a single table against which to join. The structure of each entry is: * - * array( + * @code + * [ * 'type' => $join_type (one of INNER, LEFT OUTER, RIGHT OUTER), * 'table' => $table, * 'alias' => $alias_of_the_table, * 'condition' => $join_condition (string or Condition object), * 'arguments' => $array_of_arguments_for_placeholders_in_the condition. * 'all_fields' => TRUE to SELECT $alias.*, FALSE or NULL otherwise. - * ) - * + * ] + * @endcode * If $table is a string, it is taken as the name of a table. If it is * a Select query object, it is taken as a subquery. * * If $join_condition is a Condition object, any arguments should be * incorporated into the object; a separate array of arguments does not * need to be provided. - * - * @var array */ protected $tables = []; diff --git a/core/lib/Drupal/Core/Datetime/DrupalDateTime.php b/core/lib/Drupal/Core/Datetime/DrupalDateTime.php index be2ef7abee86..6a5fe5abde53 100644 --- a/core/lib/Drupal/Core/Datetime/DrupalDateTime.php +++ b/core/lib/Drupal/Core/Datetime/DrupalDateTime.php @@ -15,7 +15,9 @@ * Static methods in base class can also be used to create DrupalDateTime objects. * For example: * - * DrupalDateTime::createFromArray( array('year' => 2010, 'month' => 9, 'day' => 28) ) + * @code + * DrupalDateTime::createFromArray(['year' => 2010, 'month' => 9, 'day' => 28]) + * @endcode * * @see \Drupal\Component\Datetime\DateTimePlus */ diff --git a/core/modules/system/tests/modules/common_test/src/Hook/CommonTestHooks.php b/core/modules/system/tests/modules/common_test/src/Hook/CommonTestHooks.php index f0cce57c56cb..3cc65ac976ff 100644 --- a/core/modules/system/tests/modules/common_test/src/Hook/CommonTestHooks.php +++ b/core/modules/system/tests/modules/common_test/src/Hook/CommonTestHooks.php @@ -49,7 +49,7 @@ public function drupalAlterAlter(&$data, &$arg2 = NULL, &$arg3 = NULL): void { * Implements hook_TYPE_alter(). * * This is to verify that - * \Drupal::moduleHandler()->alter(array(TYPE1, TYPE2), ...) allows + * \Drupal::moduleHandler()->alter([TYPE1, TYPE2], ...) allows * hook_module_implements_alter() to affect the order in which module * implementations are executed. */ -- GitLab