diff --git a/src/Plugin/Linkit/Matcher/EntityMatcher.php b/src/Plugin/Linkit/Matcher/EntityMatcher.php index c326752cc0ebf10bd01d56de2ec62172e2d97e46..5dc3420835d96904538e471c669973fdc69a39b1 100644 --- a/src/Plugin/Linkit/Matcher/EntityMatcher.php +++ b/src/Plugin/Linkit/Matcher/EntityMatcher.php @@ -180,12 +180,12 @@ class EntityMatcher extends ConfigurableMatcherBase { public function buildConfigurationForm(array $form, FormStateInterface $form_state) { $entity_type = $this->entityTypeManager->getDefinition($this->targetType); - $form['metadata'] = array( + $form['metadata'] = [ '#type' => 'details', '#title' => $this->t('Suggestion metadata'), '#open' => TRUE, '#weight' => -100, - ); + ]; $form['metadata']['metadata'] = [ '#title' => $this->t('Metadata'), @@ -206,12 +206,12 @@ class EntityMatcher extends ConfigurableMatcherBase { $bundle_options[$bundle_name] = $bundle_info['label']; } - $form['bundle_restrictions'] = array( + $form['bundle_restrictions'] = [ '#type' => 'details', '#title' => $this->t('Bundle restrictions'), '#open' => TRUE, '#weight' => -90, - ); + ]; $form['bundle_restrictions']['bundles'] = [ '#type' => 'checkboxes', @@ -222,11 +222,11 @@ class EntityMatcher extends ConfigurableMatcherBase { '#element_validate' => [[get_class($this), 'elementValidateFilter']], ]; - $form['bundle_grouping'] = array( + $form['bundle_grouping'] = [ '#type' => 'details', '#title' => $this->t('Bundle grouping'), '#open' => TRUE, - ); + ]; // Group the suggestions by bundle. $form['bundle_grouping']['group_by_bundle'] = [ @@ -238,13 +238,13 @@ class EntityMatcher extends ConfigurableMatcherBase { } $substitution_options = $this->substitutionManager->getApplicablePluginsOptionList($this->targetType); - $form['substitution'] = array( + $form['substitution'] = [ '#type' => 'details', '#title' => $this->t('URL substitution'), '#open' => TRUE, '#weight' => 100, '#access' => count($substitution_options) !== 1, - ); + ]; $form['substitution']['substitution_type'] = [ '#title' => $this->t('Substitution Type'), '#type' => 'select', diff --git a/src/Plugin/Linkit/Matcher/FileMatcher.php b/src/Plugin/Linkit/Matcher/FileMatcher.php index 9a7b1995586e8efa4910cf46333da3cd4d6ea383..20b5214fade07d8365cd3110a8466c658af6c8ae 100644 --- a/src/Plugin/Linkit/Matcher/FileMatcher.php +++ b/src/Plugin/Linkit/Matcher/FileMatcher.php @@ -89,12 +89,12 @@ class FileMatcher extends EntityMatcher { public function buildConfigurationForm(array $form, FormStateInterface $form_state) { $form = parent::buildConfigurationForm($form, $form_state); - $form['extensions'] = array( + $form['extensions'] = [ '#type' => 'details', '#title' => $this->t('File extensions'), '#open' => TRUE, '#weight' => -100, - ); + ]; $file_extensions = str_replace(' ', ', ', $this->configuration['file_extensions']); $form['extensions']['file_extensions'] = [ diff --git a/src/Plugin/Linkit/Matcher/NodeMatcher.php b/src/Plugin/Linkit/Matcher/NodeMatcher.php index 4f5f5577195638167484f773eb8ceea4cedc8d53..3a1424cc8a78cd8ab85b400db980e4e1358c1443 100644 --- a/src/Plugin/Linkit/Matcher/NodeMatcher.php +++ b/src/Plugin/Linkit/Matcher/NodeMatcher.php @@ -53,11 +53,11 @@ class NodeMatcher extends EntityMatcher { public function buildConfigurationForm(array $form, FormStateInterface $form_state) { $form = parent::buildConfigurationForm($form, $form_state); - $form['unpublished_nodes'] = array( + $form['unpublished_nodes'] = [ '#type' => 'details', '#title' => $this->t('Unpublished nodes'), '#open' => TRUE, - ); + ]; $form['unpublished_nodes']['include_unpublished'] = [ '#title' => $this->t('Include unpublished nodes'), diff --git a/src/Plugin/Linkit/Matcher/UserMatcher.php b/src/Plugin/Linkit/Matcher/UserMatcher.php index 2d78a06e7a590d6865ca74bbc0b7649f8427cee4..b1f707e686109b8130eb6a18e060a9270406de57 100644 --- a/src/Plugin/Linkit/Matcher/UserMatcher.php +++ b/src/Plugin/Linkit/Matcher/UserMatcher.php @@ -60,12 +60,12 @@ class UserMatcher extends EntityMatcher { public function buildConfigurationForm(array $form, FormStateInterface $form_state) { $form = parent::buildConfigurationForm($form, $form_state); - $form['role_restrictions'] = array( + $form['role_restrictions'] = [ '#type' => 'details', '#title' => $this->t('Role restrictions'), '#open' => TRUE, '#weight' => -90, - ); + ]; $form['role_restrictions']['roles'] = [ '#type' => 'checkboxes', @@ -76,11 +76,11 @@ class UserMatcher extends EntityMatcher { '#element_validate' => [[get_class($this), 'elementValidateFilter']], ]; - $form['blocked_users'] = array( + $form['blocked_users'] = [ '#type' => 'details', '#title' => $this->t('Blocked users'), '#open' => TRUE, - ); + ]; $form['blocked_users']['include_blocked'] = [ '#title' => $this->t('Include blocked user'), diff --git a/tests/src/FunctionalJavascript/LinkitDialogTest.php b/tests/src/FunctionalJavascript/LinkitDialogTest.php index 7420ae026c0ec7653571c793074366097ab52490..f6d201dcf9a9ba230a56ef85c3aceeb018c9a0d6 100644 --- a/tests/src/FunctionalJavascript/LinkitDialogTest.php +++ b/tests/src/FunctionalJavascript/LinkitDialogTest.php @@ -30,7 +30,7 @@ class LinkitDialogTest extends JavascriptTestBase { /** * An instance of the "CKEditor" text editor plugin. * - * @var \Drupal\ckeditor\Plugin\Editor\CKEditor; + * @var \Drupal\ckeditor\Plugin\Editor\CKEditor */ protected $ckeditor; diff --git a/tests/src/Kernel/LinkitFilterEntityTest.php b/tests/src/Kernel/LinkitFilterEntityTest.php index d97283df67dd3fde44fa2eb9de559e511b7be3bb..e93af40a2387d984c9574cb0db3fc5e1010fdd62 100644 --- a/tests/src/Kernel/LinkitFilterEntityTest.php +++ b/tests/src/Kernel/LinkitFilterEntityTest.php @@ -111,13 +111,13 @@ class LinkitFilterEntityTest extends LinkitKernelTestBase { * Tests the linkit filter for file entities. */ public function testFilterFileEntity() { - $file = File::create(array( + $file = File::create([ 'uid' => 1, 'filename' => 'druplicon.txt', 'uri' => 'public://druplicon.txt', 'filemime' => 'text/plain', 'status' => FILE_STATUS_PERMANENT, - )); + ]); $file->save(); // Disable the automatic title attribute. diff --git a/tests/src/Kernel/LinkitKernelTestBase.php b/tests/src/Kernel/LinkitKernelTestBase.php index e3ff5c6ca7aa67fd59642acae2844ae1c22b1dd1..737a0bb1f4e5972ea95d688ce919318029cc24f6 100644 --- a/tests/src/Kernel/LinkitKernelTestBase.php +++ b/tests/src/Kernel/LinkitKernelTestBase.php @@ -47,22 +47,22 @@ abstract class LinkitKernelTestBase extends KernelTestBase { * @return \Drupal\user\Entity\User * The created user entity. */ - protected function createUser($values = array(), $permissions = array()) { + protected function createUser(array $values = [], array $permissions = []) { if ($permissions) { // Create a new role and apply permissions to it. - $role = Role::create(array( + $role = Role::create([ 'id' => strtolower($this->randomMachineName(8)), 'label' => $this->randomMachineName(8), - )); + ]); $role->save(); user_role_grant_permissions($role->id(), $permissions); $values['roles'][] = $role->id(); } - $account = User::create($values + array( + $account = User::create($values + [ 'name' => $this->randomMachineName(), 'status' => 1, - )); + ]); $account->enforceIsNew(); $account->save(); return $account; diff --git a/tests/src/Kernel/Matchers/FileMatcherTest.php b/tests/src/Kernel/Matchers/FileMatcherTest.php index 1c6da4b6805a503b06c087678339c3d17703dbe1..e890b465b12442b4eae69be6c5483e9563d84c31 100644 --- a/tests/src/Kernel/Matchers/FileMatcherTest.php +++ b/tests/src/Kernel/Matchers/FileMatcherTest.php @@ -34,7 +34,7 @@ class FileMatcherTest extends LinkitKernelTestBase { $this->installEntitySchema('file'); $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'); diff --git a/tests/src/Kernel/Matchers/NodeMatcherTest.php b/tests/src/Kernel/Matchers/NodeMatcherTest.php index 58eeef99ffa4b5591a6f2e7bd6d2d456cdc47693..8783a4f9762ea601eb826dffd1eeb9dc08c674c7 100644 --- a/tests/src/Kernel/Matchers/NodeMatcherTest.php +++ b/tests/src/Kernel/Matchers/NodeMatcherTest.php @@ -42,44 +42,44 @@ class NodeMatcherTest extends LinkitKernelTestBase { // anonymous user. \Drupal::currentUser()->setAccount($this->createUser()); - $type1 = NodeType::create(array( + $type1 = NodeType::create([ 'type' => 'test1', 'name' => 'Test1', - )); + ]); $type1->save(); - $type2 = NodeType::create(array( + $type2 = NodeType::create([ 'type' => 'test2', 'name' => 'Test2', - )); + ]); $type2->save(); // Nodes with type 1. - $node = Node::create(array( + $node = Node::create([ 'title' => 'Lorem Ipsum 1', 'type' => $type1->id(), - )); + ]); $node->save(); - $node = Node::create(array( + $node = Node::create([ 'title' => 'Lorem Ipsum 2', 'type' => $type1->id(), - )); + ]); $node->save(); // Node with type 2. - $node = Node::create(array( + $node = Node::create([ 'title' => 'Lorem Ipsum 3', 'type' => $type2->id(), - )); + ]); $node->save(); // Unpublished node. - $node = Node::create(array( + $node = Node::create([ 'title' => 'Lorem unpublishd', 'type' => $type1->id(), 'status' => FALSE, - )); + ]); $node->save(); // Set the current user to someone that is not the node owner. diff --git a/tests/src/Kernel/Matchers/TermMatcherTest.php b/tests/src/Kernel/Matchers/TermMatcherTest.php index ce81bffa1371aa631015f709696c15d7cf8961a6..2bc49985ed9bf2d93d846ffd49f33f6e106aac97 100644 --- a/tests/src/Kernel/Matchers/TermMatcherTest.php +++ b/tests/src/Kernel/Matchers/TermMatcherTest.php @@ -105,7 +105,7 @@ class TermMatcherTest extends LinkitKernelTestBase { * @param string $name * The vocabulary name. * - * @return VocabularyInterface The new vocabulary object. + * @return \Drupal\Core\Entity\EntityInterface|\Drupal\taxonomy\VocabularyInterface * The new vocabulary object. */ private function createVocabulary($name) { @@ -132,7 +132,7 @@ class TermMatcherTest extends LinkitKernelTestBase { * @return \Drupal\taxonomy\Entity\Term * The new taxonomy term object. */ - private function createTerm(VocabularyInterface $vocabulary, $values = []) { + private function createTerm(VocabularyInterface $vocabulary, array $values = []) { $filter_formats = filter_formats(); $format = array_pop($filter_formats); diff --git a/tests/src/Kernel/Matchers/UserMatcherTest.php b/tests/src/Kernel/Matchers/UserMatcherTest.php index 7050ea8504737e26c7a1aa7ce3b8c6bb7763c774..e6bca5380f89ac7fd5448299d89418191a260836 100644 --- a/tests/src/Kernel/Matchers/UserMatcherTest.php +++ b/tests/src/Kernel/Matchers/UserMatcherTest.php @@ -27,16 +27,16 @@ class UserMatcherTest extends LinkitKernelTestBase { $this->manager = $this->container->get('plugin.manager.linkit.matcher'); - $custom_role = Role::create(array( + $custom_role = Role::create([ 'id' => 'custom_role', 'label' => 'custom_role', - )); + ]); $custom_role->save(); - $custom_role_admin = Role::create(array( + $custom_role_admin = Role::create([ 'id' => 'custom_role_admin', 'label' => 'custom_role_admin', - )); + ]); $custom_role_admin->save(); $this->createUser(['name' => 'lorem']);