Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Fix phpcs errors:
- Drupal.Classes.UnusedUseStatement
- DrupalPractice.FunctionCalls.InsecureUnserialize
- SlevomatCodingStandard.PHP.ShortList
- Drupal.Semantics.FunctionT
Command
phpcs --standard=Drupal,DrupalPractice --extensions=php,inc,module,install,info,test,profile,theme modules/custom/pathauto/ --sniffs="Drupal.Classes.UnusedUseStatement,DrupalPractice.FunctionCalls.InsecureUnserialize,SlevomatCodingStandard.PHP.ShortList,Drupal.Semantics.FunctionT" -s
Result
FILE: tests/src/Functional/PathautoBulkUpdateTest.php
-------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------
5 | WARNING | [x] Unused use statement (Drupal.Classes.UnusedUseStatement.UnusedUse)
-------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------
FILE: tests/src/FunctionalJavascript/PathautoUiTest.php
-----------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------
5 | WARNING | [x] Unused use statement (Drupal.Classes.UnusedUseStatement.UnusedUse)
-----------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------
FILE: pathauto.module
-----------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------
168 | WARNING | Avoid backslash escaping in translatable strings when possible, use "" quotes instead
| | (Drupal.Semantics.FunctionT.BackslashSingleQuote)
-----------------------------------------------------------------------------
FILE: pathauto.install
------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------
137 | ERROR | [x] list(...) is forbidden, use [...] instead.
| | (SlevomatCodingStandard.PHP.ShortList.LongListUsed)
------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------
FILE: src/Entity/PathautoPattern.php
------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------
418 | ERROR | [x] list(...) is forbidden, use [...] instead.
| | (SlevomatCodingStandard.PHP.ShortList.LongListUsed)
------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------
FILE: src/Plugin/migrate/source/PathautoPattern.php
-------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-------------------------------------------------------------------------------
98 | ERROR | unserialize() is insecure unless allowed classes are limited. Use a safe format like JSON or use the allowed_classes option.
| | (DrupalPractice.FunctionCalls.InsecureUnserialize.InsecureUnserialize)
117 | ERROR | unserialize() is insecure unless allowed classes are limited. Use a safe format like JSON or use the allowed_classes option.
| | (DrupalPractice.FunctionCalls.InsecureUnserialize.InsecureUnserialize)
-------------------------------------------------------------------------------
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork pathauto-3411804
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
Nikolay ShapovalovReady for review.
Comment #4
Nikolay ShapovalovComment #5
Nikolay ShapovalovUpdate MR, add phpcs.xml file and exclude rules that will be fixed in different issues.
Gitlab CI check phpcs passed.
Comment #6
Nikolay ShapovalovUpdate IS
Comment #9
BerdirCommitted.