Fix the issues reported by phpcs

Created on 24 March 2023, almost 2 years ago
Updated 5 April 2023, over 1 year ago

Problem/Motivation

Getting following error/warnings.

FILE: /var/www/html/modules/contrib/audiorecorder/src/Element/AudioFileRecorder.php
-----------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------
47 | ERROR | [x] Use null coalesce operator instead of ternary operator.
-----------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/audiorecorder/modules/audiorecorder_webform_integration/src/Plugin/WebformElement/WebFormAudioRecorderFileElement.php
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 1 WARNING AFFECTING 5 LINES
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
7 | WARNING | [x] Unused use statement
23 | ERROR | [ ] Class name doesn't match filename; expected "class WebFormAudioRecorderFileElement"
53 | ERROR | [x] No space found before comment text; expected "// '#default_value' => $this->getSetting('max_recording_time')," but found "//'#default_value' =>
| | $this->getSetting('max_recording_time'),"
58 | ERROR | [x] Expected 1 blank line after function; 0 found
59 | ERROR | [x] The closing brace for the class must have an empty line before it
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/audiorecorder/modules/audiorecorder_webform_integration/src/Element/WebformAudioRecorderFileElement.php
-------------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
-------------------------------------------------------------------------------------------------------------------------------------------
31 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
57 | ERROR | [x] Expected 1 blank line after function; 2 found
60 | ERROR | [x] The closing brace for the class must have an empty line before it
-------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/audiorecorder/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
----------------------------------------------------------------------
15 | WARNING | Line exceeds 80 characters; contains 82 characters
41 | WARNING | Line exceeds 80 characters; contains 81 characters
50 | WARNING | Line exceeds 80 characters; contains 96 characters
83 | WARNING | Line exceeds 80 characters; contains 81 characters
----------------------------------------------------------------------

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/audiorecorder/

Proposed resolution

Above error/warnings need to be fixed.

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

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

Production build 0.71.5 2024