Fix phpcs Drupal.Classes, DrupalPractice.FunctionCalls, SlevomatCodingStandard.PHP, Drupal.Semantics

Created on 1 January 2024, 11 months ago
Updated 19 February 2024, 9 months ago

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

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇷🇺Russia zniki.ru

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