Problem/Motivation
FILE: ...mpp\htdocs\abc\drupal\modules\country_state\country_state.module
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but
| | found "\r\n"
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...te\src\Plugin\Field\FieldFormatter\CountryStateFormatterType.php
----------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
----------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n"
| | but found "\r\n"
58 | WARNING | [ ] Unused variable $output.
60 | ERROR | [ ] unserialize() is insecure unless allowed classes
| | are limited. Use a safe format like JSON or use
| | the allowed_classes option.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...untry_state\src\Plugin\Field\FieldType\CountryStateFieldType.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but
| | found "\r\n"
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...ry_state\src\Plugin\Field\FieldWidget\CountryStateWidgetType.php
----------------------------------------------------------------------
FOUND 5 ERRORS AND 8 WARNINGS AFFECTING 11 LINES
----------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n"
| | but found "\r\n"
47 | WARNING | [ ] Line exceeds 80 characters; contains 86
| | characters
47 | ERROR | [x] No space found before comment text; expected "//
| | $summary[] = t('Textfield size: @size', ['@size'
| | => $this->getSetting('size')]);" but found
| | "//$summary[] = t('Textfield size: @size',
| | ['@size' => $this->getSetting('size')]);"
49 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait
| | and $this->t() instead
60 | WARNING | [ ] \Drupal calls should be avoided in classes, use
| | dependency injection instead
70 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait
| | and $this->t() instead
73 | ERROR | [x] Use null coalesce operator instead of ternary
| | operator.
84 | ERROR | [ ] unserialize() is insecure unless allowed classes
| | are limited. Use a safe format like JSON or use
| | the allowed_classes option.
85 | WARNING | [ ] \Drupal calls should be avoided in classes, use
| | dependency injection instead
85 | ERROR | [x] Use null coalesce operator instead of ternary
| | operator.
88 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait
| | and $this->t() instead
90 | WARNING | [ ] t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait
| | and $this->t() instead
125 | WARNING | [ ] \Drupal calls should be avoided in classes, use
| | dependency injection instead
----------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
Steps to reproduce
Run the following command :
phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml /10.1.x/drupal/modules/contrib/country_state
Proposed resolution
Fix all the PHP coding standard issues.