summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Stjerneman2017-01-08 12:20:41 +0100
committerEmil Stjerneman2017-01-08 12:20:41 +0100
commitd3118bdf5faa0b225831fe44400cd9f0726b4a3e (patch)
tree6cfe94576e64b80386007a4cde3543c46b490255
parentb3838aeee874c4660e4e7e3c909ab1106eada546 (diff)
by anon: Use short array syntax
-rw-r--r--src/Plugin/Linkit/Matcher/EntityMatcher.php16
-rw-r--r--src/Plugin/Linkit/Matcher/FileMatcher.php4
-rw-r--r--src/Plugin/Linkit/Matcher/NodeMatcher.php4
-rw-r--r--src/Plugin/Linkit/Matcher/UserMatcher.php8
-rw-r--r--tests/src/FunctionalJavascript/LinkitDialogTest.php2
-rw-r--r--tests/src/Kernel/LinkitFilterEntityTest.php4
-rw-r--r--tests/src/Kernel/LinkitKernelTestBase.php10
-rw-r--r--tests/src/Kernel/Matchers/FileMatcherTest.php2
-rw-r--r--tests/src/Kernel/Matchers/NodeMatcherTest.php24
-rw-r--r--tests/src/Kernel/Matchers/TermMatcherTest.php4
-rw-r--r--tests/src/Kernel/Matchers/UserMatcherTest.php8
11 files changed, 43 insertions, 43 deletions
diff --git a/src/Plugin/Linkit/Matcher/EntityMatcher.php b/src/Plugin/Linkit/Matcher/EntityMatcher.php
index c326752..5dc3420 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 9a7b199..20b5214 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 4f5f557..3a1424c 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 2d78a06..b1f707e 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 7420ae0..f6d201d 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 d97283d..e93af40 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 e3ff5c6..737a0bb 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 1c6da4b..e890b46 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 58eeef9..8783a4f 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 ce81bff..2bc4998 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 7050ea8..e6bca53 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']);