Fix the issues reported by phpcs

Created on 19 December 2022, over 1 year ago
Updated 1 June 2023, about 1 year ago

Problem/Motivation

Getting following error/warnings

FILE: /app/modules/contrib/maillog/src/Controller/MaillogController.php
--------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------------------------
126 | ERROR | unserialize() is insecure unless allowed classes are limited. Use a safe format like JSON or use the allowed_classes option.
--------------------------------------------------------------------------------------------------------------------------------------------

FILE: /app/modules/contrib/maillog/src/Plugin/Mail/Maillog.php
---------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
---------------------------------------------------------------------------
43 | ERROR | [x] Use null coalesce operator instead of ternary operator.
47 | ERROR | [x] Use null coalesce operator instead of ternary operator.
63 | ERROR | [x] Use null coalesce operator instead of ternary operator.
81 | ERROR | [x] Use null coalesce operator instead of ternary operator.
100 | ERROR | [x] Use null coalesce operator instead of ternary operator.
---------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------

FILE: /app/modules/contrib/maillog/tests/src/Kernel/MailTest.php
-------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------
77 | ERROR | unserialize() is insecure unless allowed classes are limited. Use a safe format like JSON or use the allowed_classes option.
-------------------------------------------------------------------------------------------------------------------------------------------

Time: 2.02 secs; Memory: 10MB

Steps to reproduce

Run following command

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

Proposed resolution

Above error/warnings need to be fixed

๐Ÿ“Œ Task
Status

Fixed

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia samit.310@gmail.com

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024