diff --git a/core/modules/contextual/src/Element/ContextualLinks.php b/core/modules/contextual/src/Element/ContextualLinks.php index 62e8966..68021aa 100644 --- a/core/modules/contextual/src/Element/ContextualLinks.php +++ b/core/modules/contextual/src/Element/ContextualLinks.php @@ -45,14 +45,14 @@ public function getInfo() { * - route_parameters: The route parameters passed to the url generator. * - metadata: Any additional data needed in order to alter the link. * @code - * array('#contextual_links' => array( - * 'block' => array( - * 'route_parameters' => array('block' => 'system.menu-tools'), - * ), - * 'menu' => array( - * 'route_parameters' => array('menu' => 'tools'), - * ), - * )) + * ['#contextual_links' => [ + * 'block' => [ + * 'route_parameters' => ['block' => 'system.menu-tools'], + * ], + * 'menu' => [ + * 'route_parameters' => ['menu' => 'tools'], + * ], + * ]] * @endcode * * @return array diff --git a/core/modules/field_ui/src/Form/EntityDisplayFormBase.php b/core/modules/field_ui/src/Form/EntityDisplayFormBase.php index 62a46b1..e420a57 100644 --- a/core/modules/field_ui/src/Form/EntityDisplayFormBase.php +++ b/core/modules/field_ui/src/Form/EntityDisplayFormBase.php @@ -76,8 +76,8 @@ public function getEntityFromRouteMatch(RouteMatchInterface $route_match, $entit * @return array * Example usage: * @code - * return array( - * 'content' => array( + * return [ + * 'content' => [ * // label for the region. * 'title' => $this->t('Content'), * // Indicates if the region is visible in the UI. @@ -85,8 +85,8 @@ public function getEntityFromRouteMatch(RouteMatchInterface $route_match, $entit * // A message to indicate that there is nothing to be displayed in * // the region. * 'message' => $this->t('No field is displayed.'), - * ), - * ); + * ], + * ]; * @endcode */ public function getRegions() { diff --git a/core/modules/locale/locale.bulk.inc b/core/modules/locale/locale.bulk.inc index 3e256c2..2e1977e 100644 --- a/core/modules/locale/locale.bulk.inc +++ b/core/modules/locale/locale.bulk.inc @@ -205,7 +205,7 @@ function locale_translate_batch_import($file, array $options, &$context) { 'seek' => 0, ]; } - // Update the seek and the number of items in the $options array(). + // Update the seek and the number of items in the $options array. $options['seek'] = $context['sandbox']['parse_state']['seek']; $options['items'] = $context['sandbox']['parse_state']['chunk_size']; $report = Gettext::fileToDatabase($file, $options); diff --git a/core/modules/migrate/src/Plugin/Migration.php b/core/modules/migrate/src/Plugin/Migration.php index 13092e7..a5c0252 100644 --- a/core/modules/migrate/src/Plugin/Migration.php +++ b/core/modules/migrate/src/Plugin/Migration.php @@ -162,15 +162,15 @@ class Migration extends PluginBase implements MigrationInterface, RequirementsIn * * The migration_dependencies value is structured like this: * @code - * array( - * 'required' => array( + * [ + * 'required' => [ * // An array of migration IDs that must be run before this migration. - * ), - * 'optional' => array( + * ], + * 'optional' => [ * // An array of migration IDs that, if they exist, must be run before * // this migration. - * ), - * ); + * ], + * ]; * @endcode * * @var array diff --git a/core/modules/node/node.api.php b/core/modules/node/node.api.php index 6041874..828e50d 100644 --- a/core/modules/node/node.api.php +++ b/core/modules/node/node.api.php @@ -43,20 +43,20 @@ * access modules can also grant "view all" permission on their custom realms; * for example, a module could create a record in {node_access} with: * @code - * $record = array( + * $record = [ * 'nid' => 0, * 'gid' => 888, * 'realm' => 'example_realm', * 'grant_view' => 1, * 'grant_update' => 0, * 'grant_delete' => 0, - * ); + * ]; * db_insert('node_access')->fields($record)->execute(); * @endcode * And then in its hook_node_grants() implementation, it would need to return: * @code * if ($op == 'view') { - * $grants['example_realm'] = array(888); + * $grants['example_realm'] = [888]; * } * @endcode * If you decide to do this, be aware that the node_access_rebuild() function @@ -130,14 +130,14 @@ function hook_node_grants(\Drupal\Core\Session\AccountInterface $account, $op) { * A "deny all" grant may be used to deny all access to a particular node or * node translation: * @code - * $grants[] = array( + * $grants[] = [ * 'realm' => 'all', * 'gid' => 0, * 'grant_view' => 0, * 'grant_update' => 0, * 'grant_delete' => 0, * 'langcode' => 'ca', - * ); + * ]; * @endcode * Note that another module node access module could override this by granting * access to one or more nodes, since grants are additive. To enforce that diff --git a/core/modules/node/src/Plugin/Search/NodeSearch.php b/core/modules/node/src/Plugin/Search/NodeSearch.php index 6d7c8eb..d942612 100644 --- a/core/modules/node/src/Plugin/Search/NodeSearch.php +++ b/core/modules/node/src/Plugin/Search/NodeSearch.php @@ -237,7 +237,7 @@ protected function findResults() { // \Drupal::request()->query->get('f') is an array that looks like this in // the URL: ?f[]=type:page&f[]=term:27&f[]=term:13&f[]=langcode:en // So $parameters['f'] looks like: - // array('type:page', 'term:27', 'term:13', 'langcode:en'); + // ['type:page', 'term:27', 'term:13', 'langcode:en']; // We need to parse this out into query conditions, some of which go into // the keywords string, and some of which are separate conditions. $parameters = $this->getParameters(); diff --git a/core/modules/rest/src/Plugin/ResourceInterface.php b/core/modules/rest/src/Plugin/ResourceInterface.php index 7e92c57..43eafb9 100644 --- a/core/modules/rest/src/Plugin/ResourceInterface.php +++ b/core/modules/rest/src/Plugin/ResourceInterface.php @@ -46,7 +46,7 @@ public function permissions(); * Returns the available HTTP request methods on this plugin. * * @return array - * The list of supported methods. Example: array('GET', 'POST', 'PATCH'). + * The list of supported methods. Example: ['GET', 'POST', 'PATCH']. */ public function availableMethods(); diff --git a/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module index 8b1cc23..ae4f2ba 100644 --- a/core/modules/simpletest/simpletest.module +++ b/core/modules/simpletest/simpletest.module @@ -566,13 +566,13 @@ function simpletest_log_read($test_id, $database_prefix, $test_class) { * An array of tests keyed with the groups, and then keyed by test classes. * For example: * @code - * $groups['Block'] => array( - * 'BlockTestCase' => array( + * $groups['Block'] => [ + * 'BlockTestCase' => [ * 'name' => 'Block functionality', * 'description' => 'Add, edit and delete custom block.', * 'group' => 'Block', - * ), - * ); + * ], + * ]; * @endcode * * @deprecated in Drupal 8.3.x, for removal before 9.0.0 release. Use diff --git a/core/modules/simpletest/src/BlockCreationTrait.php b/core/modules/simpletest/src/BlockCreationTrait.php index b252d9e..bef22c5 100644 --- a/core/modules/simpletest/src/BlockCreationTrait.php +++ b/core/modules/simpletest/src/BlockCreationTrait.php @@ -21,9 +21,9 @@ * Override the defaults by specifying the key and value in the array, for * example: * @code - * $this->drupalPlaceBlock('system_powered_by_block', array( + * $this->drupalPlaceBlock('system_powered_by_block', [ * 'label' => t('Hello, world!'), - * )); + * ]); * @endcode * The following defaults are provided: * - label: Random string. diff --git a/core/modules/simpletest/src/NodeCreationTrait.php b/core/modules/simpletest/src/NodeCreationTrait.php index 20dc3f8..2a3d555 100644 --- a/core/modules/simpletest/src/NodeCreationTrait.php +++ b/core/modules/simpletest/src/NodeCreationTrait.php @@ -44,18 +44,18 @@ public function getNodeByTitle($title, $reset = FALSE) { * entity_create(). Override the defaults by specifying the key and value * in the array, for example: * @code - * $this->drupalCreateNode(array( + * $this->drupalCreateNode([ * 'title' => t('Hello, world!'), * 'type' => 'article', - * )); + * ]); * @endcode * The following defaults are provided: * - body: Random string using the default filter format: * @code - * $settings['body'][0] = array( + * $settings['body'][0] = [ * 'value' => $this->randomMachineName(32), * 'format' => filter_default_format(), - * ); + * ]; * @endcode * - title: Random string. * - type: 'page'. diff --git a/core/modules/simpletest/src/TestBase.php b/core/modules/simpletest/src/TestBase.php index 1491cc2..1a94cbd 100644 --- a/core/modules/simpletest/src/TestBase.php +++ b/core/modules/simpletest/src/TestBase.php @@ -854,7 +854,7 @@ protected function verbose($message) { * * @param $methods * (optional) A list of method names in the test case class to run; e.g., - * array('testFoo', 'testBar'). By default, all methods of the class are + * ['testFoo', 'testBar']. By default, all methods of the class are * taken into account, but it can be useful to only run a few selected test * methods during debugging. */ @@ -1351,18 +1351,18 @@ protected function settingsSet($name, $value) { * * Example: * @code - * $parameters = array( - * 'one' => array(0, 1), - * 'two' => array(2, 3), - * ); + * $parameters = [ + * 'one' => [0, 1], + * 'two' => [2, 3], + * ]; * $permutations = TestBase::generatePermutations($parameters); * // Result: - * $permutations == array( - * array('one' => 0, 'two' => 2), - * array('one' => 1, 'two' => 2), - * array('one' => 0, 'two' => 3), - * array('one' => 1, 'two' => 3), - * ) + * $permutations == [ + * ['one' => 0, 'two' => 2], + * ['one' => 1, 'two' => 2], + * ['one' => 0, 'two' => 3], + * ['one' => 1, 'two' => 3], + * ] * @endcode * * @param $parameters diff --git a/core/modules/simpletest/src/TestDiscovery.php b/core/modules/simpletest/src/TestDiscovery.php index 5374520..ff1ca59 100644 --- a/core/modules/simpletest/src/TestDiscovery.php +++ b/core/modules/simpletest/src/TestDiscovery.php @@ -143,13 +143,13 @@ public function registerTestNamespaces() { * @return array * An array of tests keyed by the the group name. * @code - * $groups['block'] => array( - * 'Drupal\block\Tests\BlockTest' => array( + * $groups['block'] => [ + * 'Drupal\block\Tests\BlockTest' => [ * 'name' => 'Drupal\block\Tests\BlockTest', * 'description' => 'Tests block UI CRUD functionality.', * 'group' => 'block', - * ), - * ); + * ], + * ]; * @endcode * * @todo Remove singular grouping; retain list of groups in 'group' key. diff --git a/core/modules/simpletest/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php index 2491bc8..ce5dc7e 100644 --- a/core/modules/simpletest/src/WebTestBase.php +++ b/core/modules/simpletest/src/WebTestBase.php @@ -316,7 +316,7 @@ protected function findBlockInstance(Block $block) { * For example: * @code * // Create a user. - * $account = $this->drupalCreateUser(array()); + * $account = $this->drupalCreateUser([]); * $this->drupalLogin($account); * // Load real user object. * $pass_raw = $account->pass_raw; @@ -562,10 +562,10 @@ protected function getDatabaseTypes() { * Array of values containing the untranslated string and its translation. * For example: * @code - * array( - * '' => array('Sunday' => 'domingo'), - * 'Long month name' => array('March' => 'marzo'), - * ); + * [ + * '' => ['Sunday' => 'domingo'], + * 'Long month name' => ['March' => 'marzo'], + * ]; * @endcode * Pass an empty array to remove all existing custom translations for the * given $langcode. @@ -923,7 +923,7 @@ protected function drupalGet($path, array $options = [], array $headers = []) { * @param array $options * Array of URL options. * @param array $headers - * Array of headers. Eg array('Accept: application/vnd.drupal-ajax'). + * Array of headers. Eg ['Accept: application/vnd.drupal-ajax']. * * @return array * Decoded json. @@ -1002,11 +1002,11 @@ protected function drupalGetXHR($path, array $options = [], array $headers = []) * * @code * // First step in form. - * $edit = array(...); + * $edit = [...]; * $this->drupalPostForm('some_url', $edit, t('Save')); * * // Second step in form. - * $edit = array(...); + * $edit = [...]; * $this->drupalPostForm(NULL, $edit, t('Save')); * @endcode * @param $edit @@ -1030,8 +1030,8 @@ protected function drupalGetXHR($path, array $options = [], array $headers = []) * be unchecked. Multiple select fields can be tested using 'name[]' and * setting each of the desired values in an array: * @code - * $edit = array(); - * $edit['name[]'] = array('value1', 'value2'); + * $edit = []; + * $edit['name[]'] = ['value1', 'value2']; * @endcode * @param $submit * Value of the submit button whose click is to be emulated. For example, @@ -1195,7 +1195,7 @@ protected function drupalPostForm($path, $edit, $submit, array $options = [], ar * The name of the form element that is responsible for triggering the Ajax * functionality to test. May be a string or, if the triggering element is * a button, an associative array where the key is the name of the button - * and the value is the button label. i.e.) array('op' => t('Refresh')). + * and the value is the button label. i.e.) ['op' => t('Refresh')]. * @param $ajax_path * (optional) Override the path set by the Ajax settings of the triggering * element. diff --git a/core/modules/user/user.module b/core/modules/user/user.module index b865e95..c0c2015 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -1112,13 +1112,13 @@ function user_role_load($rid) { * Any value that evaluates to FALSE will cause the permission to be * revoked. * @code - * array( + * [ * 'administer nodes' => 0, // Revoke 'administer nodes' * 'administer blocks' => FALSE, // Revoke 'administer blocks' * 'access user profiles' => 1, // Grant 'access user profiles' * 'access content' => TRUE, // Grant 'access content' * 'access comments' => 'access comments', // Grant 'access comments' - * ) + * ] * @endcode * Existing permissions are not changed, unless specified in $permissions. * diff --git a/core/modules/views/src/Annotation/ViewsDisplay.php b/core/modules/views/src/Annotation/ViewsDisplay.php index 85887e3..97aa5c7 100644 --- a/core/modules/views/src/Annotation/ViewsDisplay.php +++ b/core/modules/views/src/Annotation/ViewsDisplay.php @@ -84,10 +84,10 @@ class ViewsDisplay extends ViewsPluginAnnotationBase { * A list of places where contextual links should be added. * For example: * @code - * array( + * [ * 'page', * 'block', - * ) + * ] * @endcode * * If you don't specify it there will be contextual links rendered for all diff --git a/core/modules/views/src/Plugin/Derivative/ViewsLocalTask.php b/core/modules/views/src/Plugin/Derivative/ViewsLocalTask.php index bc6400c..d7c40c3 100644 --- a/core/modules/views/src/Plugin/Derivative/ViewsLocalTask.php +++ b/core/modules/views/src/Plugin/Derivative/ViewsLocalTask.php @@ -152,10 +152,10 @@ public function alterLocalTasks(&$local_tasks) { * @return array * A list of arrays containing the $view and $display_id. * @code - * array( - * array($view, $display_id), - * array($view, $display_id), - * ); + * [ + * [$view, $display_id], + * [$view, $display_id], + * ]; * @endcode */ protected function getApplicableMenuViews() { diff --git a/core/modules/views/src/Plugin/views/join/JoinPluginBase.php b/core/modules/views/src/Plugin/views/join/JoinPluginBase.php index 0aa6aa3..0f6f69b 100644 --- a/core/modules/views/src/Plugin/views/join/JoinPluginBase.php +++ b/core/modules/views/src/Plugin/views/join/JoinPluginBase.php @@ -24,13 +24,13 @@ * @endcode * Use this configuration: * @code - * $configuration = array( + * $configuration = [ * 'table' => 'two', * 'field' => 'field_b', * 'left_table' => 'one', * 'left_field' => 'field_a', * 'operator' => '=', - * ); + * ]; * $join = Views::pluginManager('join')->createInstance('standard', $configuration); * @endcode * Note that the default join type is a LEFT join when 'type' is not supplied in @@ -42,20 +42,20 @@ * @endcode * Use this configuration: * @code - * $configuration = array( + * $configuration = [ * 'type' => 'INNER', * 'table' => 'two', * 'field' => 'field_b', * 'left_table' => 'one', * 'left_field' => 'field_a', * 'operator' => '=', - * 'extra' => array( - * 0 => array( + * 'extra' => [ + * 0 => [ * 'left_field' => 'field_c', * 'value' => 'some_val', - * ), - * ), - * ); + * ], + * ], + * ]; * $join = Views::pluginManager('join')->createInstance('standard', $configuration); * @endcode * @@ -65,20 +65,20 @@ * @endcode * Use this configuration: * @code - * $configuration = array( + * $configuration = [ * 'type' => 'INNER', * 'table' => 'two', * 'field' => 'field_b', * 'left_table' => 'one', * 'left_field' => 'field_a', * 'operator' => '=', - * 'extra' => array( - * 0 => array( + * 'extra' => [ + * 0 => [ * 'field' => 'field_d', * 'value' => 'other_val', - * ), - * ), - * ); + * ], + * ], + * ]; * $join = Views::pluginManager('join')->createInstance('standard', $configuration); * @endcode * @@ -88,20 +88,20 @@ * @endcode * Use this configuration: * @code - * $configuration = array( + * $configuration = [ * 'type' => 'INNER', * 'table' => 'two', * 'field' => 'field_b', * 'left_table' => 'one', * 'left_field' => 'field_a', * 'operator' => '=', - * 'extra' => array( - * 0 => array( + * 'extra' => [ + * 0 => [ * 'left_field' => 'field_c', * 'field' => 'field_d', - * ), - * ), - * ); + * ], + * ], + * ]; * $join = Views::pluginManager('join')->createInstance('standard', $configuration); * @endcode * diff --git a/core/modules/views/views.api.php b/core/modules/views/views.api.php index c21b9c5..e7a55cf 100644 --- a/core/modules/views/views.api.php +++ b/core/modules/views/views.api.php @@ -837,7 +837,7 @@ function hook_views_pre_render(ViewExecutable $view) { * And then in the post-render, create an array with the text that should * go there: * @code - * strtr($output, array('' => 'output for FIELD of nid 1'); + * strtr($output, ['' => 'output for FIELD of nid 1']; * @endcode * All of the cached result data will be available in $view->result, as well, * so all ids used in the query should be discoverable. diff --git a/core/modules/views_ui/admin.inc b/core/modules/views_ui/admin.inc index a2d9fed..a7c6ac8 100644 --- a/core/modules/views_ui/admin.inc +++ b/core/modules/views_ui/admin.inc @@ -38,7 +38,7 @@ * An array of parent keys that point to the part of the form that will be * refreshed by AJAX. For example, if triggering the AJAX behavior should * cause $form['dynamic_content']['section'] to be refreshed, you would pass - * array('dynamic_content', 'section') for this parameter. + * ['dynamic_content', 'section'] for this parameter. */ function views_ui_add_ajax_trigger(&$wrapping_element, $trigger_key, $refresh_parents) { $seen_ids = &drupal_static(__FUNCTION__ . ':seen_ids', []); diff --git a/core/modules/views_ui/src/Form/Ajax/RearrangeFilter.php b/core/modules/views_ui/src/Form/Ajax/RearrangeFilter.php index 3298681..c150617 100644 --- a/core/modules/views_ui/src/Form/Ajax/RearrangeFilter.php +++ b/core/modules/views_ui/src/Form/Ajax/RearrangeFilter.php @@ -77,12 +77,12 @@ public function buildForm(array $form, FormStateInterface $form_state) { /** * Filter groups is an array that contains: - * array( + * [ * 'operator' => 'and' || 'or', - * 'groups' => array( + * 'groups' => [ * $group_id => 'and' || 'or', - * ), - * ); + * ], + * ]; */ $grouping = count(array_keys($groups['groups'])) > 1; @@ -330,7 +330,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { /** * Adds one to each key of an array. * - * For example array(0 => 'foo') would be array(1 => 'foo'). + * For example [0 => 'foo'] would be [1 => 'foo']. * * @param array $array * The array to increment keys on.