Fix what reported by phpcs as well as non-reported Drupal Coding Standards compliance.

Created on 27 October 2022, over 2 years ago
Updated 21 May 2023, almost 2 years ago

Problem/Motivation

Now that we have a stable release version that supports Drupal 10 and PHP 8.1, let's address the outstanding coding standards issues with the module codebase.

Steps to reproduce

Scan for coding standards:

FILE: /var/www/html/web/modules/contrib/address/address.module
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
 67 | WARNING | Unused variable $delta.
----------------------------------------------------------------------


FILE: /var/www/html/web/modules/contrib/address/address.tokens.inc
--------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------
 85 | ERROR | [x] Use null coalesce operator instead of ternary operator.
--------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------


FILE: /var/www/html/web/modules/contrib/address/src/Element/Address.php
-----------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
-----------------------------------------------------------------------------
 254 | WARNING | [ ] Unused variable $field_index.
 261 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
 263 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
-----------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------


FILE: /var/www/html/web/modules/contrib/address/src/FieldHelper.php
--------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------
 36 | ERROR | [x] Use null coalesce operator instead of ternary operator.
 65 | ERROR | [x] Use null coalesce operator instead of ternary operator.
--------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------


FILE: /var/www/html/web/modules/contrib/address/src/Plugin/Field/FieldFormatter/CountryDefaultFormatter.php
-----------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------
 83 | ERROR | [x] Use null coalesce operator instead of ternary operator.
-----------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/contrib/address/src/Plugin/Field/FieldFormatter/ZoneDefaultFormatter.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------------
 188 | ERROR | The array declaration extends to column 97 (the limit is 80). The array content should be split up over
     |       | multiple lines
 204 | ERROR | The array declaration extends to column 118 (the limit is 80). The array content should be split up over
     |       | multiple lines
------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/contrib/address/src/Plugin/Field/FieldType/AddressItem.php
------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------
 204 | ERROR | [x] Use null coalesce operator instead of ternary operator.
------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/contrib/address/src/Plugin/Field/FieldType/ZoneItemList.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------
 21 | ERROR | unserialize() is insecure unless allowed classes are limited. Use a safe format like JSON or use the
    |       | allowed_classes option.
------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/contrib/address/src/Plugin/Field/FieldWidget/AddressDefaultWidget.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------
 128 | ERROR | The array declaration extends to column 86 (the limit is 80). The array content should be split up over
     |       | multiple lines
------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/contrib/address/src/Plugin/Validation/Constraint/AddressFormatConstraintValidator.php
---------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
---------------------------------------------------------------------------------------------------------------------
  5 | WARNING | [x] Unused use statement
 12 | WARNING | [x] Unused use statement
---------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/contrib/address/src/Plugin/diff/Field/AddressFieldBuilder.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------
 29 | ERROR | The array declaration extends to column 83 (the limit is 80). The array content should be split up over
    |       | multiple lines
------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/contrib/address/src/Plugin/views/filter/AdministrativeArea.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 6 LINES
------------------------------------------------------------------------------------------------------------------------------
 265 | ERROR | The array declaration extends to column 84 (the limit is 80). The array content should be split up over
     |       | multiple lines
 268 | ERROR | The array declaration extends to column 95 (the limit is 80). The array content should be split up over
     |       | multiple lines
 280 | ERROR | The array declaration extends to column 91 (the limit is 80). The array content should be split up over
     |       | multiple lines
 292 | ERROR | The array declaration extends to column 91 (the limit is 80). The array content should be split up over
     |       | multiple lines
 344 | ERROR | The array declaration extends to column 84 (the limit is 80). The array content should be split up over
     |       | multiple lines
 432 | ERROR | The array declaration extends to column 102 (the limit is 80). The array content should be split up over
     |       | multiple lines
------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/contrib/address/tests/modules/address_test/address_test.routing.yml
------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------
  7 | WARNING | Open page callback found, please add a comment before the line why there is no access restriction
 15 | WARNING | Open page callback found, please add a comment before the line why there is no access restriction
------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/contrib/address/tests/src/FunctionalJavascript/AddressDefaultWidgetTest.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 12 WARNINGS AFFECTING 16 LINES
------------------------------------------------------------------------------------------------------------------------------
 190 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and
     |         | $this->t() instead
 214 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and
     |         | $this->t() instead
 261 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and
     |         | $this->t() instead
 288 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and
     |         | $this->t() instead
 338 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and
     |         | $this->t() instead
 399 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and
     |         | $this->t() instead
 420 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and
     |         | $this->t() instead
 435 | ERROR   | The array declaration extends to column 88 (the limit is 80). The array content should be split up over
     |         | multiple lines
 436 | ERROR   | The array declaration extends to column 109 (the limit is 80). The array content should be split up over
     |         | multiple lines
 478 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and
     |         | $this->t() instead
 491 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and
     |         | $this->t() instead
 550 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and
     |         | $this->t() instead
 571 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and
     |         | $this->t() instead
 605 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and
     |         | $this->t() instead
 665 | ERROR   | The array declaration extends to column 112 (the limit is 80). The array content should be split up over
     |         | multiple lines
 667 | ERROR   | The array declaration extends to column 177 (the limit is 80). The array content should be split up over
     |         | multiple lines
------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/contrib/address/tests/src/Unit/Plugin/Validation/Constraint/CountryConstraintValidatorTest.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------
 38 | ERROR | The array declaration extends to column 83 (the limit is 80). The array content should be split up over
    |       | multiple lines
------------------------------------------------------------------------------------------------------------------------------

Time: 2.29 secs; Memory: 12MB
πŸ“Œ Task
Status

Closed: outdated

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States lhridley

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

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024