Commit d3118bdf authored by anon's avatar anon

by anon: Use short array syntax

parent b3838aee
...@@ -180,12 +180,12 @@ class EntityMatcher extends ConfigurableMatcherBase { ...@@ -180,12 +180,12 @@ class EntityMatcher extends ConfigurableMatcherBase {
public function buildConfigurationForm(array $form, FormStateInterface $form_state) { public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$entity_type = $this->entityTypeManager->getDefinition($this->targetType); $entity_type = $this->entityTypeManager->getDefinition($this->targetType);
$form['metadata'] = array( $form['metadata'] = [
'#type' => 'details', '#type' => 'details',
'#title' => $this->t('Suggestion metadata'), '#title' => $this->t('Suggestion metadata'),
'#open' => TRUE, '#open' => TRUE,
'#weight' => -100, '#weight' => -100,
); ];
$form['metadata']['metadata'] = [ $form['metadata']['metadata'] = [
'#title' => $this->t('Metadata'), '#title' => $this->t('Metadata'),
...@@ -206,12 +206,12 @@ class EntityMatcher extends ConfigurableMatcherBase { ...@@ -206,12 +206,12 @@ class EntityMatcher extends ConfigurableMatcherBase {
$bundle_options[$bundle_name] = $bundle_info['label']; $bundle_options[$bundle_name] = $bundle_info['label'];
} }
$form['bundle_restrictions'] = array( $form['bundle_restrictions'] = [
'#type' => 'details', '#type' => 'details',
'#title' => $this->t('Bundle restrictions'), '#title' => $this->t('Bundle restrictions'),
'#open' => TRUE, '#open' => TRUE,
'#weight' => -90, '#weight' => -90,
); ];
$form['bundle_restrictions']['bundles'] = [ $form['bundle_restrictions']['bundles'] = [
'#type' => 'checkboxes', '#type' => 'checkboxes',
...@@ -222,11 +222,11 @@ class EntityMatcher extends ConfigurableMatcherBase { ...@@ -222,11 +222,11 @@ class EntityMatcher extends ConfigurableMatcherBase {
'#element_validate' => [[get_class($this), 'elementValidateFilter']], '#element_validate' => [[get_class($this), 'elementValidateFilter']],
]; ];
$form['bundle_grouping'] = array( $form['bundle_grouping'] = [
'#type' => 'details', '#type' => 'details',
'#title' => $this->t('Bundle grouping'), '#title' => $this->t('Bundle grouping'),
'#open' => TRUE, '#open' => TRUE,
); ];
// Group the suggestions by bundle. // Group the suggestions by bundle.
$form['bundle_grouping']['group_by_bundle'] = [ $form['bundle_grouping']['group_by_bundle'] = [
...@@ -238,13 +238,13 @@ class EntityMatcher extends ConfigurableMatcherBase { ...@@ -238,13 +238,13 @@ class EntityMatcher extends ConfigurableMatcherBase {
} }
$substitution_options = $this->substitutionManager->getApplicablePluginsOptionList($this->targetType); $substitution_options = $this->substitutionManager->getApplicablePluginsOptionList($this->targetType);
$form['substitution'] = array( $form['substitution'] = [
'#type' => 'details', '#type' => 'details',
'#title' => $this->t('URL substitution'), '#title' => $this->t('URL substitution'),
'#open' => TRUE, '#open' => TRUE,
'#weight' => 100, '#weight' => 100,
'#access' => count($substitution_options) !== 1, '#access' => count($substitution_options) !== 1,
); ];
$form['substitution']['substitution_type'] = [ $form['substitution']['substitution_type'] = [
'#title' => $this->t('Substitution Type'), '#title' => $this->t('Substitution Type'),
'#type' => 'select', '#type' => 'select',
......
...@@ -89,12 +89,12 @@ class FileMatcher extends EntityMatcher { ...@@ -89,12 +89,12 @@ class FileMatcher extends EntityMatcher {
public function buildConfigurationForm(array $form, FormStateInterface $form_state) { public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = parent::buildConfigurationForm($form, $form_state); $form = parent::buildConfigurationForm($form, $form_state);
$form['extensions'] = array( $form['extensions'] = [
'#type' => 'details', '#type' => 'details',
'#title' => $this->t('File extensions'), '#title' => $this->t('File extensions'),
'#open' => TRUE, '#open' => TRUE,
'#weight' => -100, '#weight' => -100,
); ];
$file_extensions = str_replace(' ', ', ', $this->configuration['file_extensions']); $file_extensions = str_replace(' ', ', ', $this->configuration['file_extensions']);
$form['extensions']['file_extensions'] = [ $form['extensions']['file_extensions'] = [
......
...@@ -53,11 +53,11 @@ class NodeMatcher extends EntityMatcher { ...@@ -53,11 +53,11 @@ class NodeMatcher extends EntityMatcher {
public function buildConfigurationForm(array $form, FormStateInterface $form_state) { public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = parent::buildConfigurationForm($form, $form_state); $form = parent::buildConfigurationForm($form, $form_state);
$form['unpublished_nodes'] = array( $form['unpublished_nodes'] = [
'#type' => 'details', '#type' => 'details',
'#title' => $this->t('Unpublished nodes'), '#title' => $this->t('Unpublished nodes'),
'#open' => TRUE, '#open' => TRUE,
); ];
$form['unpublished_nodes']['include_unpublished'] = [ $form['unpublished_nodes']['include_unpublished'] = [
'#title' => $this->t('Include unpublished nodes'), '#title' => $this->t('Include unpublished nodes'),
......
...@@ -60,12 +60,12 @@ class UserMatcher extends EntityMatcher { ...@@ -60,12 +60,12 @@ class UserMatcher extends EntityMatcher {
public function buildConfigurationForm(array $form, FormStateInterface $form_state) { public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = parent::buildConfigurationForm($form, $form_state); $form = parent::buildConfigurationForm($form, $form_state);
$form['role_restrictions'] = array( $form['role_restrictions'] = [
'#type' => 'details', '#type' => 'details',
'#title' => $this->t('Role restrictions'), '#title' => $this->t('Role restrictions'),
'#open' => TRUE, '#open' => TRUE,
'#weight' => -90, '#weight' => -90,
); ];
$form['role_restrictions']['roles'] = [ $form['role_restrictions']['roles'] = [
'#type' => 'checkboxes', '#type' => 'checkboxes',
...@@ -76,11 +76,11 @@ class UserMatcher extends EntityMatcher { ...@@ -76,11 +76,11 @@ class UserMatcher extends EntityMatcher {
'#element_validate' => [[get_class($this), 'elementValidateFilter']], '#element_validate' => [[get_class($this), 'elementValidateFilter']],
]; ];
$form['blocked_users'] = array( $form['blocked_users'] = [
'#type' => 'details', '#type' => 'details',
'#title' => $this->t('Blocked users'), '#title' => $this->t('Blocked users'),
'#open' => TRUE, '#open' => TRUE,
); ];
$form['blocked_users']['include_blocked'] = [ $form['blocked_users']['include_blocked'] = [
'#title' => $this->t('Include blocked user'), '#title' => $this->t('Include blocked user'),
......
...@@ -30,7 +30,7 @@ class LinkitDialogTest extends JavascriptTestBase { ...@@ -30,7 +30,7 @@ class LinkitDialogTest extends JavascriptTestBase {
/** /**
* An instance of the "CKEditor" text editor plugin. * An instance of the "CKEditor" text editor plugin.
* *
* @var \Drupal\ckeditor\Plugin\Editor\CKEditor; * @var \Drupal\ckeditor\Plugin\Editor\CKEditor
*/ */
protected $ckeditor; protected $ckeditor;
......
...@@ -111,13 +111,13 @@ class LinkitFilterEntityTest extends LinkitKernelTestBase { ...@@ -111,13 +111,13 @@ class LinkitFilterEntityTest extends LinkitKernelTestBase {
* Tests the linkit filter for file entities. * Tests the linkit filter for file entities.
*/ */
public function testFilterFileEntity() { public function testFilterFileEntity() {
$file = File::create(array( $file = File::create([
'uid' => 1, 'uid' => 1,
'filename' => 'druplicon.txt', 'filename' => 'druplicon.txt',
'uri' => 'public://druplicon.txt', 'uri' => 'public://druplicon.txt',
'filemime' => 'text/plain', 'filemime' => 'text/plain',
'status' => FILE_STATUS_PERMANENT, 'status' => FILE_STATUS_PERMANENT,
)); ]);
$file->save(); $file->save();
// Disable the automatic title attribute. // Disable the automatic title attribute.
......
...@@ -47,22 +47,22 @@ abstract class LinkitKernelTestBase extends KernelTestBase { ...@@ -47,22 +47,22 @@ abstract class LinkitKernelTestBase extends KernelTestBase {
* @return \Drupal\user\Entity\User * @return \Drupal\user\Entity\User
* The created user entity. * The created user entity.
*/ */
protected function createUser($values = array(), $permissions = array()) { protected function createUser(array $values = [], array $permissions = []) {
if ($permissions) { if ($permissions) {
// Create a new role and apply permissions to it. // Create a new role and apply permissions to it.
$role = Role::create(array( $role = Role::create([
'id' => strtolower($this->randomMachineName(8)), 'id' => strtolower($this->randomMachineName(8)),
'label' => $this->randomMachineName(8), 'label' => $this->randomMachineName(8),
)); ]);
$role->save(); $role->save();
user_role_grant_permissions($role->id(), $permissions); user_role_grant_permissions($role->id(), $permissions);
$values['roles'][] = $role->id(); $values['roles'][] = $role->id();
} }
$account = User::create($values + array( $account = User::create($values + [
'name' => $this->randomMachineName(), 'name' => $this->randomMachineName(),
'status' => 1, 'status' => 1,
)); ]);
$account->enforceIsNew(); $account->enforceIsNew();
$account->save(); $account->save();
return $account; return $account;
......
...@@ -34,7 +34,7 @@ class FileMatcherTest extends LinkitKernelTestBase { ...@@ -34,7 +34,7 @@ class FileMatcherTest extends LinkitKernelTestBase {
$this->installEntitySchema('file'); $this->installEntitySchema('file');
$this->installSchema('system', ['key_value_expire']); $this->installSchema('system', ['key_value_expire']);
$this->installSchema('file', array('file_usage')); $this->installSchema('file', ['file_usage']);
$this->manager = $this->container->get('plugin.manager.linkit.matcher'); $this->manager = $this->container->get('plugin.manager.linkit.matcher');
......
...@@ -42,44 +42,44 @@ class NodeMatcherTest extends LinkitKernelTestBase { ...@@ -42,44 +42,44 @@ class NodeMatcherTest extends LinkitKernelTestBase {
// anonymous user. // anonymous user.
\Drupal::currentUser()->setAccount($this->createUser()); \Drupal::currentUser()->setAccount($this->createUser());
$type1 = NodeType::create(array( $type1 = NodeType::create([
'type' => 'test1', 'type' => 'test1',
'name' => 'Test1', 'name' => 'Test1',
)); ]);
$type1->save(); $type1->save();
$type2 = NodeType::create(array( $type2 = NodeType::create([
'type' => 'test2', 'type' => 'test2',
'name' => 'Test2', 'name' => 'Test2',
)); ]);
$type2->save(); $type2->save();
// Nodes with type 1. // Nodes with type 1.
$node = Node::create(array( $node = Node::create([
'title' => 'Lorem Ipsum 1', 'title' => 'Lorem Ipsum 1',
'type' => $type1->id(), 'type' => $type1->id(),
)); ]);
$node->save(); $node->save();
$node = Node::create(array( $node = Node::create([
'title' => 'Lorem Ipsum 2', 'title' => 'Lorem Ipsum 2',
'type' => $type1->id(), 'type' => $type1->id(),
)); ]);
$node->save(); $node->save();
// Node with type 2. // Node with type 2.
$node = Node::create(array( $node = Node::create([
'title' => 'Lorem Ipsum 3', 'title' => 'Lorem Ipsum 3',
'type' => $type2->id(), 'type' => $type2->id(),
)); ]);
$node->save(); $node->save();
// Unpublished node. // Unpublished node.
$node = Node::create(array( $node = Node::create([
'title' => 'Lorem unpublishd', 'title' => 'Lorem unpublishd',
'type' => $type1->id(), 'type' => $type1->id(),
'status' => FALSE, 'status' => FALSE,
)); ]);
$node->save(); $node->save();
// Set the current user to someone that is not the node owner. // Set the current user to someone that is not the node owner.
......
...@@ -105,7 +105,7 @@ class TermMatcherTest extends LinkitKernelTestBase { ...@@ -105,7 +105,7 @@ class TermMatcherTest extends LinkitKernelTestBase {
* @param string $name * @param string $name
* The vocabulary name. * The vocabulary name.
* *
* @return VocabularyInterface The new vocabulary object. * @return \Drupal\Core\Entity\EntityInterface|\Drupal\taxonomy\VocabularyInterface
* The new vocabulary object. * The new vocabulary object.
*/ */
private function createVocabulary($name) { private function createVocabulary($name) {
...@@ -132,7 +132,7 @@ class TermMatcherTest extends LinkitKernelTestBase { ...@@ -132,7 +132,7 @@ class TermMatcherTest extends LinkitKernelTestBase {
* @return \Drupal\taxonomy\Entity\Term * @return \Drupal\taxonomy\Entity\Term
* The new taxonomy term object. * The new taxonomy term object.
*/ */
private function createTerm(VocabularyInterface $vocabulary, $values = []) { private function createTerm(VocabularyInterface $vocabulary, array $values = []) {
$filter_formats = filter_formats(); $filter_formats = filter_formats();
$format = array_pop($filter_formats); $format = array_pop($filter_formats);
......
...@@ -27,16 +27,16 @@ class UserMatcherTest extends LinkitKernelTestBase { ...@@ -27,16 +27,16 @@ class UserMatcherTest extends LinkitKernelTestBase {
$this->manager = $this->container->get('plugin.manager.linkit.matcher'); $this->manager = $this->container->get('plugin.manager.linkit.matcher');
$custom_role = Role::create(array( $custom_role = Role::create([
'id' => 'custom_role', 'id' => 'custom_role',
'label' => 'custom_role', 'label' => 'custom_role',
)); ]);
$custom_role->save(); $custom_role->save();
$custom_role_admin = Role::create(array( $custom_role_admin = Role::create([
'id' => 'custom_role_admin', 'id' => 'custom_role_admin',
'label' => 'custom_role_admin', 'label' => 'custom_role_admin',
)); ]);
$custom_role_admin->save(); $custom_role_admin->save();
$this->createUser(['name' => 'lorem']); $this->createUser(['name' => 'lorem']);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment