Fix coding standards on the Daterange Simplify module

Created on 13 February 2025, 2 months ago

Problem/Motivation

It would be great to address the below minor PHPCS issues :

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml daterange_simplify/

FILE: /var/www/web/modules/contrib/daterange_simplify/README.txt
-----------------------------------------------------------------------
FOUND 1 ERROR AND 5 WARNINGS AFFECTING 6 LINES
-----------------------------------------------------------------------
  1 | WARNING | [ ] Line exceeds 80 characters; contains 90 characters
  2 | WARNING | [ ] Line exceeds 80 characters; contains 91 characters
  5 | WARNING | [ ] Line exceeds 80 characters; contains 95 characters
  6 | WARNING | [ ] Line exceeds 80 characters; contains 94 characters
 11 | WARNING | [ ] Line exceeds 80 characters; contains 97 characters
 12 | ERROR   | [x] Expected 1 newline at end of file; 0 found
-----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------


FILE: /var/www/web/modules/contrib/daterange_simplify/drupalci.yml
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 31 | ERROR | [x] Expected 1 newline at end of file; 2 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: /var/www/web/modules/contrib/daterange_simplify/src/Plugin/Field/FieldFormatter/SimplifyFormatterBase.php
---------------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 2 LINES
---------------------------------------------------------------------------------------------------------------------------------------------
  7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Plugin\ContainerFactoryPluginInterface.
 97 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with use statements
 97 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with use statements
---------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/web/modules/contrib/daterange_simplify/src/Plugin/Field/FieldFormatter/IntlFormatter.php
-----------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------
 7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Datetime\DrupalDateTime.
-----------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/web/modules/contrib/daterange_simplify/src/Plugin/Field/FieldFormatter/SimplifyFormatter.php
-----------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------
 7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Datetime\DrupalDateTime.
-----------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/web/modules/contrib/daterange_simplify/src/Simplify.php
-------------------------------------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 4 LINES
-------------------------------------------------------------------------------------------------------------------------------
   1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
   5 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Datetime\DrupalDateTime.
  57 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
  57 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "NULL" but found "null"
 102 | ERROR | [ ] Comment indentation error, expected only 1 spaces
-------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/web/modules/contrib/daterange_simplify/src/TwigExtension/Extension.php
--------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------------------------------------------------------
  8 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Datetime\DrupalDateTime.
 47 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 60 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
--------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/web/modules/contrib/daterange_simplify/daterange_simplify.services.yml
-------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------
 10 | ERROR | [x] Expected 1 newline at end of file; 0 found
-------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------

Time: 352ms; Memory: 10MB

Steps to reproduce

Run the command,
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml daterange_simplify/

Proposed resolution

Fix the phpcs issues.

📌 Task
Status

Active

Version

2.0

Component

Code

Created by

🇮🇳India abhiyanshu

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

Production build 0.71.5 2024