Fix PHPCS Reported Issues

Created on 31 October 2023, about 1 year ago
Updated 2 November 2023, about 1 year ago

Problem/Motivation

The following phpcs issues were reported on executing the command:
vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml /path/to/module

Reported Issues:

FILE: entity_autocomplete_suggestions/src/EntityAutocompleteSuggestionsMatcher.php
-------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Utility\Html.
-------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------


FILE: entity_autocomplete_suggestions/src/Controller/EntityAutocompleteSuggestionsController.php
---------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\KeyValueStore\KeyValueStoreInterface.
---------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: entity_autocomplete_suggestions/src/Form/AutocompleteSuggestionsConfigForm.php
---------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------------------------------
 7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\ConfigFactoryInterface.
---------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

šŸ“Œ Task
Status

RTBC

Version

3.0

Component

Code

Created by

šŸ‡®šŸ‡³India keshav patel

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @keshav patel
  • šŸ‡®šŸ‡³India keshav patel

    The provided patch file "fix_coding_standards-3398035-2.patch", fixes all the phpcs reported issues.

  • Status changed to Needs review about 1 year ago
  • Status changed to RTBC about 1 year ago
  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi Keshav,

    I applied your patch #2 and I confirmed that it fixes all the PHPCS issues, the only remaining issues being flagged are "project", "datestamp", and "version" which I believe appears when the module is installed via composer.

    āžœ  entity_autocomplete_suggestions git:(master) āœ— curl https://www.drupal.org/files/issues/2023-10-31/fix_coding_standards-3398035-2.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  2103  100  2103    0     0   3723      0 --:--:-- --:--:-- --:--:--  3775
    patching file 'src/Controller/EntityAutocompleteSuggestionsController.php'
    patching file 'src/EntityAutocompleteSuggestionsMatcher.php'
    patching file 'src/Form/AutocompleteSuggestionsConfigForm.php'
    āžœ  entity_autocomplete_suggestions git:(master) āœ— ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml entity_autocomplete_suggestions
    
    FILE: ...b/entity_autocomplete_suggestions/entity_autocomplete_suggestions.info.yml
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     1 | WARNING | Remove "project" from the info file, it will be added by
       |         | drupal.org packaging automatically
     1 | WARNING | Remove "datestamp" from the info file, it will be added by
       |         | drupal.org packaging automatically
     1 | WARNING | Remove "version" from the info file, it will be added by
       |         | drupal.org packaging automatically
    --------------------------------------------------------------------------------
    
    Time: 311ms; Memory: 10MB
    
    āžœ  contrib git:(master) āœ— 
    
Production build 0.71.5 2024