Verified Commit 8fedc4e2 authored by Jess's avatar Jess
Browse files

Issue #2874067 by kkalashnikov, Nikolay Shapovalov, quietone, smustgrave,...

Issue #2874067 by kkalashnikov, Nikolay Shapovalov, quietone, smustgrave, benjifisher, MerryHamster, xjm, dww: Fix Drupal.Commenting.DocCommentLongArraySyntax coding standard

(cherry picked from commit bd12c418)
parent 7bafdb1c
Loading
Loading
Loading
Loading
Loading
+16 −16
Original line number Diff line number Diff line
@@ -537,16 +537,16 @@
 * Example:
 * @code
 * // A cache item with nodes, users, and some custom module data.
 * $tags = array(
 * $tags = [
 *   'my_custom_tag',
 *   'node:1',
 *   'node:3',
 *   'user:7',
 * );
 * ];
 * \Drupal::cache()->set($cid, $data, CacheBackendInterface::CACHE_PERMANENT, $tags);
 *
 * // Invalidate all cache items with certain tags.
 * \Drupal\Core\Cache\Cache::invalidateTags(array('user:1'));
 * \Drupal\Core\Cache\Cache::invalidateTags(['user:1']);
 * @endcode
 *
 * Drupal is a content management system, so naturally you want changes to your
@@ -1712,14 +1712,14 @@
 *
 *   public function buildForm(array $form, FormStateInterface $form_state) {
 *     // Create a $form API array.
 *     $form['phone_number'] = array(
 *     $form['phone_number'] = [
 *       '#type' => 'tel',
 *       '#title' => $this->t('Your phone number'),
 *     );
 *     $form['save'] = array(
 *     ];
 *     $form['save'] = [
 *       '#type' => 'submit',
 *       '#value' => $this->t('Save'),
 *     );
 *     ];
 *     return $form;
 *   }
 *
@@ -1753,11 +1753,11 @@
 * $form = \Drupal::formBuilder()->getForm('Drupal\my_module\Form\ExampleForm', $extra);
 * ...
 * public function buildForm(array $form, FormStateInterface $form_state, $extra = NULL)
 *   $form['phone_number'] = array(
 *   $form['phone_number'] = [
 *     '#type' => 'tel',
 *     '#title' => $this->t('Your phone number'),
 *     '#value' => $extra,
 *   );
 *   ];
 *   return $form;
 * }
 * @endcode
@@ -2340,14 +2340,14 @@ function hook_validation_constraint_alter(array &$definitions) {
 * Ajax response. This is done in the text field form array element
 * in \Drupal\config_translation\FormElement\DateFormat::getFormElement():
 * @code
 * '#ajax' => array(
 * '#ajax' => [
 *   'callback' => 'Drupal\config_translation\FormElement\DateFormat::ajaxSample',
 *   'event' => 'keyup',
 *   'progress' => array(
 *   'progress' => [
 *     'type' => 'throbber',
 *     'message' => NULL,
 *   ),
 * ),
 *   ],
 * ],
 * @endcode
 *
 * As you can see from this example, the #ajax property for a form element is
@@ -2435,7 +2435,7 @@ function hook_validation_constraint_alter(array &$definitions) {
 * 'wrapper' method and return HTML markup. This is not the case if you return
 * commands, but if you would like to show status messages, you can add
 * @code
 * array('#type' => 'status_messages')
 * ['#type' => 'status_messages']
 * @endcode
 * to a render array, use \Drupal::service('renderer')->render() to render it,
 * and add a command to place the messages in an appropriate location.
@@ -2596,9 +2596,9 @@ function hook_validation_constraint_alter(array &$definitions) {
 *   @code
 *   public static function getSubscribedEvents(): array {
 *     // Subscribe to kernel terminate with priority 100.
 *     $events[KernelEvents::TERMINATE][] = array('onTerminate', 100);
 *     $events[KernelEvents::TERMINATE][] = ['onTerminate', 100];
 *     // Subscribe to kernel request with default priority of 0.
 *     $events[KernelEvents::REQUEST][] = array('onRequest');
 *     $events[KernelEvents::REQUEST][] = ['onRequest'];
 *     return $events;
 *   }
 *   @endcode
+14 −14
Original line number Diff line number Diff line
@@ -139,14 +139,14 @@ function base_path() {
 * into a table. The table must have an ID attribute set and it
 * may be set as follows:
 * @code
 * $table = array(
 * $table = [
 *   '#type' => 'table',
 *   '#header' => $header,
 *   '#rows' => $rows,
 *   '#attributes' => array(
 *   '#attributes' => [
 *     'id' => 'my-module-table',
 *   ),
 * );
 *   ],
 * ];
 * return \Drupal::service('renderer')->render($table);
 * @endcode
 *
@@ -156,17 +156,17 @@ function base_path() {
 * In a situation where a single weight column is being sorted in the table, the
 * classes could be added like this (in the theme function):
 * @code
 * $form['my_elements'][$delta]['weight']['#attributes']['class'] = array('my-elements-weight');
 * $form['my_elements'][$delta]['weight']['#attributes']['class'] = ['my-elements-weight'];
 * @endcode
 *
 * Each row of the table must also have a class of "draggable" in order to
 * enable the drag handles:
 * @code
 * $row = array(...);
 * $rows[] = array(
 * $row = [...];
 * $rows[] = [
 *   'data' => $row,
 *   'class' => array('draggable'),
 * );
 *   'class' => ['draggable'],
 * ];
 * @endcode
 *
 * When tree relationships are present, the two additional classes
@@ -176,18 +176,18 @@ function base_path() {
 *
 * Calling drupal_attach_tabledrag() would then be written as such:
 * @code
 * drupal_attach_tabledrag('my-module-table', array(
 * drupal_attach_tabledrag('my-module-table', [
 *   'action' => 'order',
 *   'relationship' => 'sibling',
 *   'group' => 'my-elements-weight',
 * );
 * ];
 * @endcode
 *
 * In a more complex case where there are several groups in one column (such as
 * the block regions on the admin/structure/block page), a separate subgroup
 * class must also be added to differentiate the groups.
 * @code
 * $form['my_elements'][$region][$delta]['weight']['#attributes']['class'] = array('my-elements-weight', 'my-elements-weight-' . $region);
 * $form['my_elements'][$region][$delta]['weight']['#attributes']['class'] = ['my-elements-weight', 'my-elements-weight-' . $region];
 * @endcode
 *
 * The 'group' option is still 'my-element-weight', and the additional
@@ -197,12 +197,12 @@ function base_path() {
 *
 * @code
 * foreach ($regions as $region) {
 *   drupal_attach_tabledrag('my-module-table', array(
 *   drupal_attach_tabledrag('my-module-table', [
 *     'action' => 'order',
 *     'relationship' => 'sibling',
 *     'group' => 'my-elements-weight',
 *     'subgroup' => 'my-elements-weight-' . $region,
 *   ));
 *   ]);
 * }
 * @endcode
 *
+13 −13
Original line number Diff line number Diff line
@@ -150,7 +150,7 @@ function form_select_options($element, $choices = NULL) {
 * index is not sufficient, and supporting this would make the
 * "helper" too complicated and cumbersome to be of any help.
 *
 * As usual with functions that can return array() or FALSE, do not
 * As usual with functions that can return [] or FALSE, do not
 * forget to use === and !== if needed.
 *
 * @param $element
@@ -576,15 +576,15 @@ function template_preprocess_form_element_label(&$variables) {
 *
 * Example:
 * @code
 * $batch = array(
 * $batch = [
 *   'title' => t('Exporting'),
 *   'operations' => array(
 *     array('my_function_1', array($account->id(), 'story')),
 *     array('my_function_2', array()),
 *   ),
 *   'operations' => [
 *     ['my_function_1', [$account->id(), 'story']],
 *     ['my_function_2', []],
 *   ],
 *   'finished' => 'my_finished_callback',
 *   'file' => 'path_to_file_containing_my_functions',
 * );
 * ];
 * batch_set($batch);
 * // Only needed if not inside a form _submit handler.
 * // Setting redirect in batch_process.
@@ -638,7 +638,7 @@ function template_preprocess_form_element_label(&$variables) {
 *   }
 *   $limit = 5;
 *   $result = \Drupal::database()->select('example')
 *     ->fields('example', array('id'))
 *     ->fields('example', ['id'])
 *     ->condition('id', $context['sandbox']['current_id'], '>')
 *     ->orderBy('id')
 *     ->range(0, $limit)
@@ -671,7 +671,7 @@ function template_preprocess_form_element_label(&$variables) {
 *   \Drupal::messenger()->addMessage($message);
 *   // Providing data for the redirected page is done through the session.
 *   foreach ($results as $result) {
 *     $items[] = t('Loaded node %title.', array('%title' => $result));
 *     $items[] = t('Loaded node %title.', ['%title' => $result)];
 *   }
 *   $session = \Drupal::getRequest()->getSession();
 *   $session->set('my_batch_results', $items);
@@ -702,10 +702,10 @@ function template_preprocess_form_element_label(&$variables) {
 *     callback_batch_operation() and an array of parameter.
 *     Example:
 *     @code
 *     array(
 *       array('callback_batch_operation_1', array($arg1)),
 *       array('callback_batch_operation_2', array($arg2_1, $arg2_2)),
 *     )
 *     [
 *       ['callback_batch_operation_1', [$arg1)],
 *       ['callback_batch_operation_2', [$arg2_1, $arg2_2]],
 *     ]
 *     @endcode
 *   - title: A safe, translated string to use as the title for the progress
 *     page. Defaults to t('Processing').
+22 −22
Original line number Diff line number Diff line
@@ -727,16 +727,16 @@ function template_preprocess_image(&$variables) {
 *     - Any HTML attributes, such as "colspan", to apply to the table cell.
 *     Here's an example for $rows:
 *     @code
 *     $rows = array(
 *     $rows = [
 *       // Simple row
 *       array(
 *       [
 *         'Cell 1', 'Cell 2', 'Cell 3'
 *       ),
 *       ],
 *       // Row with attributes on the row and some of its cells.
 *       array(
 *         'data' => array('Cell 1', array('data' => 'Cell 2', 'colspan' => 2)), 'class' => array('funky')
 *       ),
 *     );
 *       [
 *         'data' => ['Cell 1', ['data' => 'Cell 2', 'colspan' => 2]], 'class' => ['funky']
 *       ],
 *     ];
 *     @endcode
 *   - footer: An array of table rows which will be printed within a <tfoot>
 *     tag, in the same format as the rows element (see above).
@@ -752,23 +752,23 @@ function template_preprocess_image(&$variables) {
 *       associative array of HTML attributes.
 *     Here's an example for $colgroup:
 *     @code
 *     $colgroup = array(
 *     $colgroup = [
 *       // <colgroup> with one <col> element.
 *       array(
 *         array(
 *           'class' => array('funky'), // Attribute for the <col> element.
 *         ),
 *       ),
 *       [
 *         [
 *           'class' => ['funky'], // Attribute for the <col> element.
 *         ],
 *       ],
 *       // <colgroup> with attributes and inner <col> elements.
 *       array(
 *         'data' => array(
 *           array(
 *             'class' => array('funky'), // Attribute for the <col> element.
 *           ),
 *         ),
 *         'class' => array('jazzy'), // Attribute for the <colgroup> element.
 *       ),
 *     );
 *       [
 *         'data' => [
 *           [
 *             'class' => ['funky'], // Attribute for the <col> element.
 *           ],
 *         ],
 *         'class' => ['jazzy'], // Attribute for the <colgroup> element.
 *       ],
 *     ];
 *     @endcode
 *     These optional tags are used to group and set properties on columns
 *     within a table. For example, one may easily group three columns and
+6 −6
Original line number Diff line number Diff line
@@ -21,12 +21,12 @@ interface DependentPluginInterface {
   *   An array of dependencies grouped by type (config, content, module,
   *   theme). For example:
   *   @code
   *   array(
   *     'config' => array('user.role.anonymous', 'user.role.authenticated'),
   *     'content' => array('node:article:f0a189e6-55fb-47fb-8005-5bef81c44d6d'),
   *     'module' => array('node', 'user'),
   *     'theme' => array('claro'),
   *   );
   *   [
   *     'config' => ['user.role.anonymous', 'user.role.authenticated'],
   *     'content' => ['node:article:f0a189e6-55fb-47fb-8005-5bef81c44d6d'],
   *     'module' => ['node', 'user'],
   *     'theme' => ['claro'],
   *   ];
   *   @endcode
   *
   * @see \Drupal\Core\Config\Entity\ConfigDependencyManager
Loading