The array content should be split up over multiple lines.

Created on 25 July 2023, over 1 year ago
Updated 11 July 2024, 10 months ago

Problem/Motivation

I ran the PHPCS ../vendor/bin/phpcs --standard=drupal modules/contrib/pathauto/ and found that there are many errors related to The array content that should be split up over multiple lines.
So this issue is specific to this only.

Steps to reproduce

Run the script ../vendor/bin/phpcs --standard=drupal modules/contrib/pathauto/

Proposed resolution

Fix issues related to splitting the array into multiple lines.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

🇮🇳India keshavv India

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @keshavv
  • Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.3 & MySQL 5.7
    last update over 1 year ago
    Not currently mergeable.
  • @keshavk opened merge request.
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.3 & MySQL 5.7
    last update over 1 year ago
    48 pass
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India keshavv India

    I have created the MR for the same.
    Please review.
    Thank you.

  • Status changed to Needs work 10 months ago
  • 🇮🇳India riddhi.addweb

    I tried to apply the patch [MR 50], but some errors were displayed after applying the patch. Please review it as the patch is failing.

    Checking patch src/AliasCleaner.php...
    Checking patch src/Commands/PathautoCommands.php...
    Checking patch src/Form/PathautoAdminDelete.php...
    error: while searching for:
            '#type' => 'checkbox',
            '#title' => (string) $definition['label'],
            '#default_value' => FALSE,
            '#description' => $this->t('Delete aliases for all @label. Number of aliases which will be deleted: %count.', ['@label' => (string) $definition['label'], '%count' => $count]),
          ];
        }
    
    
    error: patch failed: src/Form/PathautoAdminDelete.php:87
    error: src/Form/PathautoAdminDelete.php: patch does not apply
    Checking patch src/Form/PathautoBulkUpdateForm.php...
    Checking patch src/Form/PatternEditForm.php...
    Hunk #1 succeeded at 113 (offset -1 lines).
    Hunk #2 succeeded at 141 (offset -1 lines).
    Hunk #3 succeeded at 227 (offset -1 lines).
    error: while searching for:
                'negate' => FALSE,
                'context_mapping' => [
                  $entity_type => $entity_type,
                ]
              ]
            );
          }
    
    error: patch failed: src/Form/PatternEditForm.php:237
    error: src/Form/PatternEditForm.php: patch does not apply
    Checking patch src/Plugin/Deriver/EntityAliasTypeDeriver.php...
    error: while searching for:
            $this->derivatives[$entity_type_id]['types'] = [$this->tokenEntityMapper->getTokenTypeForEntityType($entity_type_id)];
            $this->derivatives[$entity_type_id]['provider'] = $entity_type->getProvider();
            $this->derivatives[$entity_type_id]['context_definitions'] = [
              $entity_type_id => new EntityContextDefinition("entity:$entity_type_id", $this->t('@label being aliased', ['@label' => $entity_type->getLabel()]))
            ];
          }
        }
    
    error: patch failed: src/Plugin/Deriver/EntityAliasTypeDeriver.php:86
    error: src/Plugin/Deriver/EntityAliasTypeDeriver.php: patch does not apply
    Checking patch src/Plugin/pathauto/AliasType/EntityAliasTypeBase.php...
    error: while searching for:
        $context['sandbox']['count'] += count($ids);
        $context['sandbox']['current'] = !empty($ids) ? max($ids) : 0;
        $context['results']['updates'] += $updates;
        $context['message'] = $this->t('Updated alias for %label @id.', ['%label' => $entity_type->getLabel(), '@id' => end($ids)]);
    
        if ($context['sandbox']['count'] != $context['sandbox']['total']) {
          $context['finished'] = $context['sandbox']['count'] / $context['sandbox']['total'];
    
    error: patch failed: src/Plugin/pathauto/AliasType/EntityAliasTypeBase.php:190
    error: src/Plugin/pathauto/AliasType/EntityAliasTypeBase.php: patch does not apply
    Checking patch src/VerboseMessenger.php...
    Checking patch tests/src/Functional/PathautoBulkUpdateTest.php...
    Hunk #1 succeeded at 102 (offset -2 lines).
    Checking patch tests/src/Functional/PathautoEnablingEntityTypesTest.php...
    Checking patch tests/src/Functional/PathautoMassDeleteTest.php...
    error: while searching for:
    
        // 2. Test deleting only specific (entity type) aliases.
        $manager = $this->container->get('plugin.manager.alias_type');
        $pathauto_plugins = ['canonical_entities:node' => 'nodes', 'canonical_entities:taxonomy_term' => 'terms', 'canonical_entities:user' => 'accounts'];
        foreach ($pathauto_plugins as $pathauto_plugin => $attribute) {
          $this->generateAliases();
          $edit = [
    
    error: patch failed: tests/src/Functional/PathautoMassDeleteTest.php:97
    error: tests/src/Functional/PathautoMassDeleteTest.php: patch does not apply
    Checking patch tests/src/Functional/PathautoNodeWebTest.php...
    Hunk #1 succeeded at 27 (offset -1 lines).
    Hunk #2 succeeded at 190 (offset -1 lines).
    error: while searching for:
        $this->assertSession()->statusCodeEquals(200);
    
        // Now create a node through the API.
        $node = Node::create(['type' => 'article', 'title' => 'Sample article API', 'path' => ['alias' => '/sample-article-api']]);
        $node->save();
    
        // Test the alias.
    
    error: patch failed: tests/src/Functional/PathautoNodeWebTest.php:289
    error: tests/src/Functional/PathautoNodeWebTest.php: patch does not apply
    Checking patch tests/src/Functional/PathautoTestHelperTrait.php...
    error: while searching for:
        $bubbleable_metadata = new BubbleableMetadata();
        $tokens = \Drupal::token()->generate($type, [$token => $token], [$type => $object], [], $bubbleable_metadata);
        $tokens += [$token => ''];
        $this->assertSame($tokens[$token], $expected, t("Token value for [@type:@token] was '@actual', expected value '@expected'.", ['@type' => $type, '@token' => $token, '@actual' => $tokens[$token], '@expected' => $expected]));
      }
    
      public function saveEntityAlias(EntityInterface $entity, $alias, $langcode = NULL) {
    
    error: patch failed: tests/src/Functional/PathautoTestHelperTrait.php:74
    error: tests/src/Functional/PathautoTestHelperTrait.php: patch does not apply
    Checking patch tests/src/FunctionalJavascript/PathautoLocaleTest.php...
    Hunk #1 succeeded at 28 (offset -1 lines).
    Hunk #2 succeeded at 65 (offset -1 lines).
    Hunk #3 succeeded at 86 (offset -1 lines).
    error: while searching for:
        $pattern->save();
    
        // Create a node with language Not Applicable.
        $node = $this->createNode(['type' => 'article', 'title' => 'Test node', 'langcode' => LanguageInterface::LANGCODE_NOT_APPLICABLE]);
    
        // Check that the generated alias has language Not Specified.
        $alias = \Drupal::service('pathauto.alias_storage_helper')->loadBySource('/node/' . $node->id());
    
    error: patch failed: tests/src/FunctionalJavascript/PathautoLocaleTest.php:200
    error: tests/src/FunctionalJavascript/PathautoLocaleTest.php: patch does not apply
    Checking patch tests/src/Kernel/PathautoEntityWithStringIdTest.php...
    error: while searching for:
      public function entityWithStringIdProvider() {
        return [
          'ascii with less or equal 128 chars' => [
            str_repeat('a', 128), str_repeat('a', 128)
          ],
          'ascii with over 128 chars' => [
            str_repeat('a', 191), Crypt::hashBase64(str_repeat('a', 191))
          ],
          'non-ascii with less or equal 128 chars' => [
            str_repeat('社', 128), Crypt::hashBase64(str_repeat('社', 128))
          ],
          'non-ascii with over 128 chars' => [
            str_repeat('社', 191), Crypt::hashBase64(str_repeat('社', 191))
          ],
          'simulating an integer id' => [
            123, '123'
          ],
        ];
      }
    
    error: patch failed: tests/src/Kernel/PathautoEntityWithStringIdTest.php:111
    error: tests/src/Kernel/PathautoEntityWithStringIdTest.php: patch does not apply
    Checking patch tests/src/Kernel/PathautoKernelTest.php...
    error: while searching for:
    
      use PathautoTestHelperTrait;
    
      protected static $modules = ['system', 'field', 'text', 'user', 'node', 'path', 'path_alias', 'pathauto', 'pathauto_custom_punctuation_test', 'taxonomy', 'token', 'filter', 'language'];
    
      protected $currentUser;
    
    
    error: patch failed: tests/src/Kernel/PathautoKernelTest.php:29
    error: tests/src/Kernel/PathautoKernelTest.php: patch does not apply
    Checking patch tests/src/Kernel/PathautoTokenTest.php...
    error: while searching for:
        foreach ($tokens as $name => $expected) {
          $token = $input[$name];
          if (!isset($expected)) {
            $this->assertTrue(!isset($values[$token]), new FormattableMarkup("Token value for @token was not generated.", ['@type' => $type, '@token' => $token]));
          }
          elseif (!isset($replacements[$token])) {
            $this->fail(new FormattableMarkup("Token value for @token was not generated.", ['@type' => $type, '@token' => $token]));
          }
          elseif (!empty($options['regex'])) {
            $this->assertTrue(preg_match('/^' . $expected . '$/', $replacements[$token]), new FormattableMarkup("Token value for @token was '@actual', matching regular expression pattern '@expected'.", ['@type' => $type, '@token' => $token, '@actual' => $replacements[$token], '@expected' => $expected]));
          }
          else {
            $this->assertSame($expected, $replacements[$token], new FormattableMarkup("Token value for @token was '@actual', expected value '@expected'.", ['@type' => $type, '@token' => $token, '@actual' => $replacements[$token], '@expected' => $expected]));
          }
        }
    
    
    error: patch failed: tests/src/Kernel/PathautoTokenTest.php:89
    error: tests/src/Kernel/PathautoTokenTest.php: patch does not apply
    
Production build 0.71.5 2024