Fix the issues reported by phpcs

Created on 5 April 2023, over 1 year ago
Updated 20 April 2023, over 1 year ago

Problem/Motivation

Getting the following errors/warnings.

FILE: /link_attributes/src/Plugin/Field/FieldWidget/LinkWithAttributesWidget.php
---------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
---------------------------------------------------------------------------------
  94 | ERROR | [x] Use null coalesce operator instead of ternary operator.
 114 | ERROR | [x] Use null coalesce operator instead of ternary operator.
---------------------------------------------------------------------------------

FILE: /link_attributes/src/LinkAttributesManager.php
---------------------------------------------------------------------------------
FOUND 5 ERRORS AND 1 WARNING AFFECTING 4 LINES
---------------------------------------------------------------------------------
 66 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
 66 | ERROR   | [x] Expected 1 space after closing parenthesis; found 0
 67 | ERROR   | [x] Expected 1 space after FOREACH keyword; 0 found
 67 | ERROR   | [x] Expected 1 space after closing parenthesis; found 0
 68 | WARNING | [ ] Only string literals should be passed to t() where possible
 70 | ERROR   | [x] Whitespace found at end of line
----------------------------------------------------------------------------------

Steps to reproduce

Run the following command

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

Proposed resolution

The above errors/warnings need to be fixed.

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India omkar_yewale Mumbai

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

  • Issue created by @omkar_yewale
  • @omkar_yewale opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India omkar_yewale Mumbai

    The !5 MR was created and all errors/warnings are fixed except that 68 | WARNING | [ ] Only string literals should be passed to t() where possible

  • First commit to issue fork.
  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    @omkar_yewale whilst I appreciate coding standards patches, my policy is not to give credit to contributors who already have credit for coding standards patches. Coding standards patches are great for folks finding their feet with the mechanics of contribution, but more experienced developers can help in other ways. Please refer to tip 2 on https://www.previousnext.com.au/blog/5-simple-tips-increase-your-drupal-... for more information. As I can see from your profile that you have a number of phpcs credits already, I've decided to remove your credit in this instance. Feel free to comment here if you'd like some assistance finding the next step in your contribution - there's plenty of more interesting issues I'd love help on.

    Merged to 8.x-1.x

  • Status changed to Fixed over 1 year ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024