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

Issue fork pathauto-3376748

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

keshav.k created an issue. See original summary.

keshavv’s picture

Assigned: keshavv » Unassigned
Status: Active » Needs review

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

riddhi.addweb’s picture

Status: Needs review » Needs work

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
mably’s picture

Status: Needs work » Closed (outdated)

Looks like it's not generating PHPCS warnings anymore.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.