Fix the issues reported by phpcs

Created on 18 April 2023, about 1 year ago
Updated 29 May 2024, about 1 month ago

Problem/Motivation

FILE: ...upal10/web/modules/contrib/parameters/tests/src/Kernel/ParametersTokenTest.php
------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------
189 | ERROR | The array declaration extends to column 119 (the limit is 80). The
| | array content should be split up over multiple lines
190 | ERROR | The array declaration extends to column 119 (the limit is 80). The
| | array content should be split up over multiple lines
------------------------------------------------------------------------------------

FILE: ...bution/drupal10/web/modules/contrib/parameters/src/Plugin/ParameterManager.php
------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
------------------------------------------------------------------------------------
63 | WARNING | [ ] Possible useless method overriding detected
72 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------

FILE: .../modules/contrib/parameters/src/Plugin/Derivative/Parameter/ContentDeriver.php
------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------
88 | WARNING | Only string literals should be passed to t() where possible
------------------------------------------------------------------------------------

FILE: ...bution/drupal10/web/modules/contrib/parameters/src/Plugin/Parameter/Fields.php
------------------------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 5 LINES
------------------------------------------------------------------------------------
250 | ERROR | [ ] Expected type hint "ParameterManager"; found
| | "PluginManagerInterface" for $manager
267 | ERROR | [x] Expected 1 space before opening brace; found 0
430 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
448 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
537 | ERROR | [ ] The array declaration extends to column 94 (the limit is 80).
| | The array content should be split up over multiple lines
537 | ERROR | [ ] The array declaration extends to column 111 (the limit is 80).
| | The array content should be split up over multiple lines
------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------

FILE: ...ion/drupal10/web/modules/contrib/parameters/src/Plugin/Parameter/Increment.php
------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------
29 | ERROR | [x] Doc comment long description must start with a capital letter
29 | ERROR | [x] Doc comment long description must end with a full stop
30 | ERROR | [ ] Missing @var tag in member variable comment
------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------

FILE: ...on/drupal10/web/modules/contrib/parameters/src/Plugin/Parameter/NullObject.php
------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------
38 | ERROR | [x] Missing function doc comment
------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------

FILE: ...ution/drupal10/web/modules/contrib/parameters/src/Plugin/Parameter/Content.php
------------------------------------------------------------------------------------
FOUND 9 ERRORS AND 13 WARNINGS AFFECTING 21 LINES
------------------------------------------------------------------------------------
127 | ERROR | [x] Doc comment long description must start with a capital letter
127 | ERROR | [x] Doc comment long description must end with a full stop
128 | ERROR | [ ] Missing @var tag in member variable comment
186 | WARNING | [ ] Unused variable $bundle.
189 | WARNING | [ ] Unused variable $bundle.
357 | WARNING | [ ] Unused variable $cleanupFieldValues.
358 | WARNING | [ ] Unused variable $normalizeNewEntities.
363 | WARNING | [ ] Unused variable $cleanupFieldValues.
364 | WARNING | [ ] Unused variable $normalizeNewEntities.
381 | WARNING | [ ] Unused variable $cleanupFieldValues.
382 | WARNING | [ ] Unused variable $normalizeNewEntities.
387 | WARNING | [ ] Unused variable $cleanupFieldValues.
388 | WARNING | [ ] Unused variable $normalizeNewEntities.
561 | ERROR | [x] Closing parenthesis of array declaration must be on a new
| | line
576 | WARNING | [ ] Unused variable $bundle.
579 | WARNING | [ ] Unused variable $bundle.
714 | ERROR | [ ] Parameter $form is not described in comment
717 | ERROR | [ ] Doc comment for parameter &$element does not match actual
| | variable name $form_state
754 | WARNING | [ ] Unused variable $rk.
814 | ERROR | [ ] Expected type hint "ParameterManager"; found
| | "PluginManagerInterface" for $manager
1156 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 12
1238 | ERROR | [x] Closing parenthesis of array declaration must be on a new
| | line
------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------

FILE: ...ribution/drupal10/web/modules/contrib/parameters/src/Plugin/Parameter/Yaml.php
------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------
133 | ERROR | Expected type hint "ParameterManager"; found
| | "PluginManagerInterface" for $manager
------------------------------------------------------------------------------------

FILE: ...ribution/drupal10/web/modules/contrib/parameters/src/Plugin/Parameter/Http.php
------------------------------------------------------------------------------------
FOUND 6 ERRORS AND 5 WARNINGS AFFECTING 10 LINES
------------------------------------------------------------------------------------
73 | ERROR | [x] Doc comment long description must start with a capital letter
73 | ERROR | [x] Doc comment long description must end with a full stop
74 | ERROR | [ ] Missing @var tag in member variable comment
114 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with
| | use statements
260 | ERROR | [ ] Type hint "\GuzzleHttp\ClientInterface" missing for $client
302 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
323 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
335 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
344 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
357 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
687 | ERROR | [ ] Expected type hint "ParameterManager"; found
| | "PluginManagerInterface" for $manager
------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------

FILE: ...ibution/drupal10/web/modules/contrib/parameters/src/Plugin/Parameter/Types.php
------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------
133 | ERROR | Expected type hint "ParameterManager"; found
| | "PluginManagerInterface" for $manager
257 | ERROR | The array declaration extends to column 94 (the limit is 80). The
| | array content should be split up over multiple lines
257 | ERROR | The array declaration extends to column 111 (the limit is 80). The
| | array content should be split up over multiple lines
------------------------------------------------------------------------------------

FILE: ...ibution/drupal10/web/modules/contrib/parameters/src/Plugin/Parameter/Roles.php
------------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 4 LINES
------------------------------------------------------------------------------------
144 | ERROR | [ ] Expected type hint "ParameterManager"; found
| | "PluginManagerInterface" for $manager
151 | ERROR | [x] Expected 1 space before opening brace; found 0
272 | ERROR | [ ] The array declaration extends to column 113 (the limit is 80).
| | The array content should be split up over multiple lines
298 | ERROR | [ ] The array declaration extends to column 94 (the limit is 80).
| | The array content should be split up over multiple lines
298 | ERROR | [ ] The array declaration extends to column 111 (the limit is 80).
| | The array content should be split up over multiple lines
------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------

FILE: ...ution/drupal10/web/modules/contrib/parameters/src/Plugin/Parameter/Bundles.php
------------------------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 5 LINES
------------------------------------------------------------------------------------
140 | ERROR | [ ] Expected type hint "ParameterManager"; found
| | "PluginManagerInterface" for $manager
147 | ERROR | [x] Expected 1 space before opening brace; found 0
251 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
269 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
339 | ERROR | [ ] The array declaration extends to column 94 (the limit is 80).
| | The array content should be split up over multiple lines
339 | ERROR | [ ] The array declaration extends to column 111 (the limit is 80).
| | The array content should be split up over multiple lines
------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------

FILE: ...ion/drupal10/web/modules/contrib/parameters/src/Plugin/Parameter/Reference.php
------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------
266 | ERROR | Expected type hint "ParametersCollectionStorage"; found
| | "EntityStorageInterface" for $storage
------------------------------------------------------------------------------------

FILE: .../contrib/parameters/src/EventSubscriber/ParametersConfigOverrideSubscriber.php
------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
------------------------------------------------------------------------------------
17 | ERROR | [x] Missing function doc comment
21 | ERROR | [x] Missing function doc comment
25 | ERROR | [x] Missing function doc comment
31 | ERROR | [ ] The array declaration extends to column 81 (the limit is 80). The
| | array content should be split up over multiple lines
------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------

FILE: ...al10/web/modules/contrib/parameters/src/Entity/ParametersCollectionStorage.php
------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------
40 | ERROR | [x] Doc comment long description must start with a capital letter
------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------

FILE: ...ntribution/drupal10/web/modules/contrib/parameters/src/ParameterRepository.php
------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
------------------------------------------------------------------------------------
15 | WARNING | [x] Unused use statement
81 | ERROR | [ ] Expected type hint "ParameterManager"; found
| | "PluginManagerInterface" for $plugin_manager
168 | ERROR | [x] Doc comment long description must start with a capital letter
------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------

FILE: ...10/web/modules/contrib/parameters/src/Exception/ParameterNotFoundException.php
------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------
27 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found
| | "null"
------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------

FILE: ...odules/contrib/parameters/src/Normalizer/ParametersContentEntityNormalizer.php
------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
------------------------------------------------------------------------------------
128 | ERROR | The array declaration extends to column 132 (the limit is 80). The
| | array content should be split up over multiple lines
150 | WARNING | \Drupal calls should be avoided in classes, use dependency
| | injection instead
157 | ERROR | The array declaration extends to column 120 (the limit is 80). The
| | array content should be split up over multiple lines
------------------------------------------------------------------------------------

FILE: ...contrib/parameters/src/Normalizer/Legacy/ParametersContentEntityNormalizer.php
------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------
128 | ERROR | The array declaration extends to column 132 (the limit is 80). The
| | array content should be split up over multiple lines
157 | ERROR | The array declaration extends to column 98 (the limit is 80). The
| | array content should be split up over multiple lines
------------------------------------------------------------------------------------

FILE: ...w/html/contribution/drupal10/web/modules/contrib/parameters/parameters.install
------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------
10 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 1
------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------

FILE: ...dules/contrib/parameters/modules/parameters_ui/src/ParametersUiListBuilder.php
------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------
80 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
------------------------------------------------------------------------------------

FILE: ...rib/parameters/modules/parameters_ui/src/Controller/ParametersUiController.php
------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
------------------------------------------------------------------------------------
204 | ERROR | [x] Incorrect spacing between argument "$parameters_parameter_name"
| | and equals sign; expected 1 but found 0
285 | ERROR | [ ] Parameter $parameters_collection is not described in comment
336 | ERROR | [ ] Expected type hint "ParametersCollectionStorage"; found
| | "EntityStorageInterface" for $storage
361 | ERROR | [x] Each PHP statement must be on a line by itself
------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------

FILE: ...b/parameters/modules/parameters_ui/src/Form/ParametersCollectionUnlockForm.php
------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------
7 | WARNING | [x] Unused use statement
------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------

FILE: ...eb/modules/contrib/parameters/modules/parameters_ui/src/Form/ParameterForm.php
------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 2 WARNINGS AFFECTING 4 LINES
------------------------------------------------------------------------------------
201 | WARNING | \Drupal calls should be avoided in classes, use dependency
| | injection instead
282 | WARNING | Avoid backslash escaping in translatable strings when possible,
| | use "" quotes instead
313 | ERROR | The array declaration extends to column 102 (the limit is 80). The
| | array content should be split up over multiple lines
394 | ERROR | The array declaration extends to column 126 (the limit is 80). The
| | array content should be split up over multiple lines
------------------------------------------------------------------------------------

FILE: ...contrib/parameters/modules/parameters_ui/src/Form/ParametersCollectionForm.php
------------------------------------------------------------------------------------
FOUND 7 ERRORS AND 2 WARNINGS AFFECTING 8 LINES
------------------------------------------------------------------------------------
36 | ERROR | [ ] Expected type hint "ParameterManager"; found
| | "PluginManagerInterface" for $parameter_manager
150 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
| | injection instead
224 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
225 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
226 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
226 | ERROR | [ ] The array declaration extends to column 90 (the limit is 80).
| | The array content should be split up over multiple lines
227 | ERROR | [x] Array closing indentation error, expected 8 spaces but found
| | 10
229 | ERROR | [ ] The array declaration extends to column 90 (the limit is 80).
| | The array content should be split up over multiple lines
385 | WARNING | [ ] Unused variable $bundle_type_id.
------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------

FILE: ...rib/parameters/modules/parameters_ui/src/Form/ParametersCollectionLockForm.php
------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------
7 | WARNING | [x] Unused use statement
------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------

FILE: ...trib/parameters/modules/parameters_ui/src/Form/ParametersCollectionAddForm.php
------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
------------------------------------------------------------------------------------
56 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 3
57 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
58 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------

FILE: ...ules/contrib/parameters/modules/parameters_ui/src/Form/ParameterDeleteForm.php
------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------
113 | WARNING | Avoid backslash escaping in translatable strings when possible,
| | use "" quotes instead
------------------------------------------------------------------------------------

Time: 8.19 secs; Memory: 18MB

Steps to reproduce

Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig parameters/

Proposed resolution

Fix all the issues reported for Drupal and DrupalPractice Coding standards

Remaining tasks

Patch Review and fix remaining issues:-
FILE: ...bution/drupal10/web/modules/contrib/parameters/src/Plugin/ParameterManager.php
------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------
63 | WARNING | Possible useless method overriding detected
------------------------------------------------------------------------------------

FILE: .../modules/contrib/parameters/src/Plugin/Derivative/Parameter/ContentDeriver.php
------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------
88 | WARNING | Only string literals should be passed to t() where possible
------------------------------------------------------------------------------------

FILE: ...ution/drupal10/web/modules/contrib/parameters/src/Plugin/Parameter/Content.php
------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 12 WARNINGS AFFECTING 12 LINES
------------------------------------------------------------------------------------
186 | WARNING | Unused variable $bundle.
189 | WARNING | Unused variable $bundle.
357 | WARNING | Unused variable $cleanupFieldValues.
358 | WARNING | Unused variable $normalizeNewEntities.
363 | WARNING | Unused variable $cleanupFieldValues.
364 | WARNING | Unused variable $normalizeNewEntities.
381 | WARNING | Unused variable $cleanupFieldValues.
382 | WARNING | Unused variable $normalizeNewEntities.
387 | WARNING | Unused variable $cleanupFieldValues.
388 | WARNING | Unused variable $normalizeNewEntities.
577 | WARNING | Unused variable $bundle.
580 | WARNING | Unused variable $bundle.
------------------------------------------------------------------------------------

FILE: ...odules/contrib/parameters/src/Normalizer/ParametersContentEntityNormalizer.php
------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------
152 | WARNING | \Drupal calls should be avoided in classes, use dependency
| | injection instead
------------------------------------------------------------------------------------

FILE: ...eb/modules/contrib/parameters/modules/parameters_ui/src/Form/ParameterForm.php
------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------
201 | WARNING | \Drupal calls should be avoided in classes, use dependency
| | injection instead
------------------------------------------------------------------------------------

FILE: ...contrib/parameters/modules/parameters_ui/src/Form/ParametersCollectionForm.php
------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
------------------------------------------------------------------------------------
149 | WARNING | \Drupal calls should be avoided in classes, use dependency
| | injection instead
390 | WARNING | Unused variable $bundle_type_id.
------------------------------------------------------------------------------------

Time: 8.24 secs; Memory: 18MB

šŸ“Œ Task
Status

Needs work

Version

1.0

Component

Code

Created by

šŸ‡®šŸ‡³India urvashi_vora Madhya Pradesh, India

Live updates comments and jobs are added and updated live.
  • Coding standards

    It involves compliance with, or the content of coding standards. Requires broad community agreement.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @urvashi_vora
  • Status changed to Needs work about 1 year ago
  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi urvashi_vora,

    I applied patch https://www.drupal.org/files/issues/2023-04-18/coding-standard-fixes_3.patch ā†’ to the "Parameters" module against Version 1.0.x-dev. and noticed that there are still phpcs issues reported

    Please see the screenshots attached.

    For your review.
    Thank you.

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    The issue summary should always describe what the issue is trying to fix and, in the case, of coding standards issues, show which command has been used, which arguments have been used, and which report that command shown.

  • Status changed to Needs review about 1 year ago
  • Open in Jenkins ā†’ Open on Drupal.org ā†’
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 8
    last update about 1 year ago
    2 pass
  • šŸ‡®šŸ‡³India Ashutosh Ahirwal India

    Providing patch with fixes.
    please review.

  • Status changed to Needs work about 1 year ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
    -      $form_state->setError($form, $this->t('You don\'t have permission to manage this configuration.'));
    +      $form_state->setError($form, $this->t("You don\'t have permission to manage this configuration."));
       public function validateForm(array &$form, FormStateInterface $form_state) {
         if (!$this->collection->access('update')) {
    -      $form_state->setError($form, $this->t('You don\'t have permission to manage this configuration.'));
    +      $form_state->setError($form, $this->t("You don\'t have permission to manage this configuration."));
         }

    There is no need to escape the single-quote character, since that is not anymore the string delimiter.

    -    $config['name'] = $form_state->getValue('name', $form_state->getValue(['config', 'parameter_name'], $config['name'] ?? ''));
    +    $config['name'] = $form_state->getValue('name', $form_state->getValue([
    +      'config',
    +      'parameter_name',
    +    ], $config['name'] ?? ''));

    Code lines are allowed to exceed 80 characters, if they are more readable. I find the existing code more readable.

    -    if (($form_state->getValue(['config', 'parameter_name'], '') !== '') && $form_state->getValue(['config', 'parameter_name']) !== $parameter_name) {
    -      unset($parameters_array[$form_state->getValue(['config', 'parameter_name'], '')]);
    +    if (($form_state->getValue([
    +      'config', 'parameter_name',
    +    ], '') !== '') && $form_state->getValue([
    +      'config', 'parameter_name',
    +    ]) !== $parameter_name) {
    +      unset($parameters_array[$form_state->getValue([
    +        'config',
    +        'parameter_name',
    +      ], '')]);
         }

    Control structure conditions are allowed to exceed the 80 characters, if they are more readable. The existing code is more readable.

    -   * return \Drupal\Core\StringTranslation\TranslatableMarkup[]
    +   * Return \Drupal\Core\StringTranslation\TranslatableMarkup[]
        *   The options.
        */
       public static function options(): array {

    return must be changed to @return, not Return.

    +  /**
    +   * {@inheritdoc}
    +   */
       public function onOverrideSave($event) {
         $this->applyChanges($event, 'config_override_save');
       }
     
    +  /**
    +   * {@inheritdoc}
    +   */
       public function onOverrideDelete($event) {
         $this->applyChanges($event, 'config_override_delete');
       }
    +  /**
    +   * {@inheritdoc}
    +   */
       protected function applyChanges($event, string $op): void {

    Those methods are not inherited from a parent class, nor defined in an interface. Their documentation comment cannot contain {@inheritdoc}.

    -    [$provider, $type, $id] = array_merge(explode('.', $config_name, 3), ['', '']);
    +    [$provider, $type, $id] = array_merge(explode('.', $config_name, 3), [
    +      '',
    +      '',
    +    ]);

    The existing code is more readable.

    + /**
    + * The UUID for this entity.
    + *
    + * @var string
    + */
    + protected $uuid;

    Since that property is initialized with a \Drupal\Component\Uuid\UuidInterface instance, it is not an entity UUID nor can its type be string. The correct description is the same used for the constructor parameter.

    +  /**
    +   * Constructs a new block form.
    +   *

    The description for a constructor must start with Constructs a new followed by the class name (including its namespace), and end with object.
    Also, since the class for that constructor is ParametersContentEntityNormalizer, which extends ContentEntityNormalizer, the constructor does not construct a new block form.

    -   * return string[]
    +   * Return string[]
        *   The contained parts.
        */

    The tag to use for the return value type is @return.

    -        $bundle_label = isset($info['label']) ? ($info['label'] instanceof TranslatableMarkup ? $info['label'] : new TranslatableMarkup((string) $info['label'])) : $bundle;
    +        $bundle_label = $info['label'] ?? $bundle;

    The changed code is not equivalent to the existing code. The existing code also checks $info['label'] is an instance of TranslatableMarkup.

    -   * var \Drupal\Core\Lock\LockBackendInterface
    +   * Var \Drupal\Core\Lock\LockBackendInterface.

    That line must start with @var. The period at the end is not necessary.

           $values['pass'] = [[
             'value' => $entity->getPassword(),
             'pre_hashed' => TRUE,
    -      ]];
    +      ],
    +      ];

    The existing code is already correct.

       /**
        * Submit callback for elements of the user account form.
        *
    -   * @param array &$element
    -   *   The element being processed.
    +   * @param array $form
    +   *   The form array to add elements to.
        * @param \Drupal\Core\Form\FormStateInterface $form_state
        *   The form state.
        */

    Documentation comments for submission callbacks do not need to describe the parameters they get.

    -        $this->logger->warning(t('Lock wait exceeded for endpoint @uri. Now trying to fetch data from it. This may cause more traffic than needed.', ['@url' => $uri]));
    +        $this->logger->warning($this->t('Lock wait exceeded for endpoint @uri. Now trying to fetch data from it. This may cause more traffic than needed.', ['@url' => $uri]));
           }

    Since that code is changed, the first argument passed to $this->logger->warning() must be changed too: It must be a literal string, not the value returned from $this->t().

    -      $this->logger->error(t('Failed to read response body contents from @url. Exception message: @message',
    +      $this->logger->error($this->t('Failed to read response body contents from @url. Exception message: @message',
             ['@url' => $uri, '@message' => $e->getMessage()]));

    The same holds true for the first argument passed to $this->logger->error().

  • First commit to issue fork.
  • Merge request !5Fixed the issues reported by phpcs ā†’ (Open) created by realsp
  • Open in Jenkins ā†’ Open on Drupal.org ā†’
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 8
    last update 6 months ago
    2 pass
  • Open in Jenkins ā†’ Open on Drupal.org ā†’
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 8
    last update 6 months ago
    2 pass
  • Open in Jenkins ā†’ Open on Drupal.org ā†’
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 8
    last update 6 months ago
    2 pass
  • Open in Jenkins ā†’ Open on Drupal.org ā†’
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 8
    last update 6 months ago
    2 pass
  • Open in Jenkins ā†’ Open on Drupal.org ā†’
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 8
    last update 6 months ago
    2 pass
  • Status changed to Needs review 6 months ago
  • Status changed to Needs work 6 months ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • Assigned to realsp
  • Open in Jenkins ā†’ Open on Drupal.org ā†’
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 8
    last update 5 months ago
    PHPLint Failed
  • Open in Jenkins ā†’ Open on Drupal.org ā†’
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 8
    last update 5 months ago
    PHPLint Failed
  • Issue was unassigned.
  • Status changed to Needs review 5 months ago
  • šŸ‡®šŸ‡³India realsp

    Thanks @apaderno for the suggestions, I've updated the MR, Please review the MR.
    Thank you.

  • Status changed to Needs work about 1 month ago
  • Hi @realsp,

    Applied the plain diff of MR !5 latest version, it applied successfully, however multiple errors/warnings still persist.

    parameters git:(1.0.x) curl https://git.drupalcode.org/project/parameters/-/merge_requests/5.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 43464    0 43464    0     0   109k      0 --:--:-- --:--:-- --:--:--  113k
    patching file modules/parameters_ui/src/Controller/ParametersUiController.php
    patching file modules/parameters_ui/src/Form/ParameterDeleteForm.php
    patching file modules/parameters_ui/src/Form/ParameterForm.php
    patching file modules/parameters_ui/src/Form/ParametersCollectionAddForm.php
    patching file modules/parameters_ui/src/Form/ParametersCollectionForm.php
    patching file modules/parameters_ui/src/Form/ParametersCollectionLockForm.php
    patching file modules/parameters_ui/src/Form/ParametersCollectionUnlockForm.php
    patching file modules/parameters_ui/src/ParametersUiListBuilder.php
    patching file modules/parameters_ui/src/Routing/ParametersUiRouteEnhancer.php
    patching file parameters.install
    patching file src/Entity/ParametersCollectionStorage.php
    patching file src/EventSubscriber/ParametersConfigOverrideSubscriber.php
    patching file src/Exception/ParameterNotFoundException.php
    patching file src/Internals/ContentSerializationCompilerPass.php
    patching file src/Normalizer/ParametersContentEntityNormalizer.php
    patching file src/ParameterRepository.php
    patching file src/Plugin/Derivative/Parameter/ContentDeriver.php
    patching file src/Plugin/Parameter/Bundles.php
    patching file src/Plugin/Parameter/Content.php
    patching file src/Plugin/Parameter/Fields.php
    patching file src/Plugin/Parameter/Http.php
    patching file src/Plugin/Parameter/Increment.php
    patching file src/Plugin/Parameter/NullObject.php
    patching file src/Plugin/Parameter/Roles.php
    patching file src/Plugin/Parameter/Types.php
    patching file src/Plugin/ParameterManager.php
    patching file tests/src/Kernel/ParametersTokenTest.php
    āžœ  parameters git:(1.0.x) āœ— cd ..
    āžœ  contrib git:(main) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig parameters
    
    FILE: ...odules/contrib/parameters/modules/parameters_ui/src/Form/ParameterForm.php
    --------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    --------------------------------------------------------------------------------
      21 | ERROR | [x] Use statements should be sorted alphabetically. The first
         |       |     wrong one is Drupal\Core\Session\AccountInterface.
     405 | ERROR | [ ] The array declaration extends to column 126 (the limit is
         |       |     120). The array content should be split up over multiple
         |       |     lines
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...l-orgissue/web/modules/contrib/parameters/src/Plugin/Parameter/Content.php
    --------------------------------------------------------------------------------
    FOUND 2 ERRORS AND 10 WARNINGS AFFECTING 12 LINES
    --------------------------------------------------------------------------------
      186 | WARNING | [ ] Unused variable $bundle.
      189 | WARNING | [ ] Unused variable $bundle.
      357 | WARNING | [ ] Unused variable $cleanupFieldValues.
      358 | WARNING | [ ] Unused variable $normalizeNewEntities.
      363 | WARNING | [ ] Unused variable $cleanupFieldValues.
      364 | WARNING | [ ] Unused variable $normalizeNewEntities.
      381 | WARNING | [ ] Unused variable $cleanupFieldValues.
      382 | WARNING | [ ] Unused variable $normalizeNewEntities.
      387 | WARNING | [ ] Unused variable $cleanupFieldValues.
      388 | WARNING | [ ] Unused variable $normalizeNewEntities.
      561 | ERROR   | [x] Closing parenthesis of array declaration must be on a new
          |         |     line
     1232 | ERROR   | [x] Closing parenthesis of array declaration must be on a new
          |         |     line
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...rib/parameters/src/Normalizer/Legacy/ParametersContentEntityNormalizer.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     128 | ERROR | The array declaration extends to column 132 (the limit is 120).
         |       | The array content should be split up over multiple lines
    --------------------------------------------------------------------------------
    
    Time: 4.35 secs; Memory: 20MB

    Kindly check

    Thanks,
    Jake

Production build 0.69.0 2024