Fix the warnings/errors reported by PHP_CodeSniffer

Created on 6 July 2023, over 1 year ago
Updated 21 July 2023, over 1 year ago

Problem/Motivation

FILE: ...one-number/web/modules/contrib/phone_number/modules/sms_phone_number/src/Plugin/TfaValidation/SmsPhoneNumberTfa.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------------------------------
  16 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is
     |       |     Drupal\tfa\Plugin\TfaSendInterface.
 204 | ERROR | [ ] The array declaration extends to column 124 (the limit is 80). The array content should be split up
     |       |     over multiple lines
-------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------


FILE: ...-number/web/modules/contrib/phone_number/modules/sms_phone_number/src/Plugin/Field/FieldType/SmsPhoneNumberItem.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------------------------------
   7 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is
     |         |     Drupal\Core\Form\FormStateInterface.
 238 | WARNING | [ ] Only string literals should be passed to t() where possible
-------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------


FILE: ...s/contrib/phone_number/modules/sms_phone_number/src/Plugin/Field/FieldFormatter/SmsPhoneNumberVerifiedFormatter.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------
 7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is
   |       |     Drupal\Core\Field\FieldItemListInterface.
-------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------


FILE: .../modules/contrib/phone_number/modules/sms_phone_number/src/Plugin/rest/resource/RequestVerificationCodeResource.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------
 8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\rest\Plugin\ResourceBase.
-------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------


FILE: ...modules/contrib/phone_number/modules/sms_phone_number/src/Plugin/Validation/Constraint/SmsPhoneNumberConstraint.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
-------------------------------------------------------------------------------------------------------------------------
 24 | ERROR | Missing member variable doc comment
 25 | ERROR | Missing member variable doc comment
 26 | ERROR | Missing member variable doc comment
-------------------------------------------------------------------------------------------------------------------------


FILE: .../modules/contrib/phone_number/modules/sms_phone_number/src/Plugin/Validation/Constraint/SmsPhoneNumberValidator.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------
 131 | WARNING | Only string literals should be passed to t() where possible
-------------------------------------------------------------------------------------------------------------------------


FILE: ...ects/drupal10-phone-number/web/modules/contrib/phone_number/modules/sms_phone_number/src/Element/SmsPhoneNumber.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------
 7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is
   |       |     Drupal\phone_number\Exception\PhoneNumberException.
-------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------


FILE: ...projects/drupal10-phone-number/web/modules/contrib/phone_number/modules/sms_phone_number/src/SmsPhoneNumberUtil.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
-------------------------------------------------------------------------------------------------------------------------
  6 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is
    |         |     Drupal\Core\Flood\FloodInterface.
 13 | WARNING | [x] Unused use statement
 95 | WARNING | [ ] Only string literals should be passed to t() where possible
-------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------


FILE: /Users/timdiels/projects/drupal10-phone-number/web/modules/contrib/phone_number/src/PhoneNumberUtilInterface.php
----------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------
 115 | ERROR | Public method name "PhoneNumberUtilInterface::getRFC3966uri" is not in lowerCamel format
----------------------------------------------------------------------------------------------------------------------


FILE: .../timdiels/projects/drupal10-phone-number/web/modules/contrib/phone_number/src/Plugin/WebformElement/PhoneNumber.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------
 158 | ERROR | [x] Use null coalesce operator instead of ternary operator.
-------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------


FILE: .../projects/drupal10-phone-number/web/modules/contrib/phone_number/src/Plugin/Field/FieldWidget/PhoneNumberWidget.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
-------------------------------------------------------------------------------------------------------------------------
  92 | ERROR | [x] Use null coalesce operator instead of ternary operator.
 108 | ERROR | [x] Use null coalesce operator instead of ternary operator.
 141 | ERROR | [x] Use null coalesce operator instead of ternary operator.
 142 | ERROR | [x] Use null coalesce operator instead of ternary operator.
-------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------


FILE: ...iels/projects/drupal10-phone-number/web/modules/contrib/phone_number/src/Plugin/Field/FieldType/PhoneNumberItem.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------
 7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Field\FieldItemBase.
-------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------


FILE: ...phone-number/web/modules/contrib/phone_number/src/Plugin/Field/FieldFormatter/PhoneNumberInternationalFormatter.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------------------------------
  7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is
    |       |     Drupal\Core\Field\FieldItemListInterface.
 28 | ERROR | [ ] Missing member variable doc comment
-------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------


FILE: ...pal10-phone-number/web/modules/contrib/phone_number/src/Plugin/Field/FieldFormatter/PhoneNumberCountryFormatter.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------
 7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is
   |       |     Drupal\Core\Field\FieldItemListInterface.
-------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------


FILE: ...rupal10-phone-number/web/modules/contrib/phone_number/src/Plugin/Field/FieldFormatter/PhoneNumberLocalFormatter.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------
 21 | ERROR | Missing member variable doc comment
-------------------------------------------------------------------------------------------------------------------------


FILE: ...s/drupal10-phone-number/web/modules/contrib/phone_number/src/Plugin/Validation/Constraint/PhoneNumberConstraint.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
-------------------------------------------------------------------------------------------------------------------------
 22 | ERROR | Missing member variable doc comment
 23 | ERROR | Missing member variable doc comment
 24 | ERROR | Missing member variable doc comment
-------------------------------------------------------------------------------------------------------------------------


FILE: ...ts/drupal10-phone-number/web/modules/contrib/phone_number/src/Plugin/Validation/Constraint/PhoneNumberValidator.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------
 91 | WARNING | Only string literals should be passed to t() where possible
-------------------------------------------------------------------------------------------------------------------------


FILE: /Users/timdiels/projects/drupal10-phone-number/web/modules/contrib/phone_number/src/Element/PhoneNumber.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------------------------------
   9 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is
     |         |     Drupal\Core\Render\Element\FormElement.
 174 | WARNING | [ ] Only string literals should be passed to t() where possible
-------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------


FILE: /Users/timdiels/projects/drupal10-phone-number/web/modules/contrib/phone_number/src/PhoneNumberUtil.php
------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
------------------------------------------------------------------------------------------------------------------------
   7 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is libphonenumber\PhoneNumber.
 159 | ERROR   | [ ] Public method name "PhoneNumberUtil::getRFC3966uri" is not in lowerCamel format
 339 | WARNING | [ ] Only string literals should be passed to t() where possible
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------


FILE: /Users/timdiels/projects/drupal10-phone-number/web/modules/contrib/phone_number/src/Exception/CountryException.php
------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------
 5 | ERROR | [x] Non-namespaced classes/interfaces/traits should not be referenced with use statements
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------


FILE: /Users/timdiels/projects/drupal10-phone-number/web/modules/contrib/phone_number/src/Exception/TypeException.php
---------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------
 5 | ERROR | [x] Non-namespaced classes/interfaces/traits should not be referenced with use statements
---------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------

Steps to reproduce

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

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Fixed

Version

2.0

Component

Code

Created by

🇮🇳India roshni27

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

Comments & Activities

Production build 0.71.5 2024