Resolve PHPStan warnings found in GitLab CI runs

Created on 8 November 2023, over 1 year ago
Updated 24 November 2023, over 1 year ago

Problem/Motivation

GitLab CI runs result in PHPStan warnings.

------ ---------------------------------------------------------------------- 
  Line   src/EventSubscriber/BackwardsCompatibilitySubscriber.php              
 ------ ---------------------------------------------------------------------- 
  29     \Drupal calls should be avoided in classes, use dependency injection  
         instead                                                               
  35     \Drupal calls should be avoided in classes, use dependency injection  
         instead                                                               
  42     \Drupal calls should be avoided in classes, use dependency injection  
         instead                                                               
 ------ ---------------------------------------------------------------------- 
 ------ ---------------------------------------------------------------------- 
  Line   src/Plugin/WebformHandler/SalesforceWebToLeadPostWebformHandler.php   
 ------ ---------------------------------------------------------------------- 
  211    \Drupal calls should be avoided in classes, use dependency injection  
         instead                                                               
 ------ ---------------------------------------------------------------------- 
 [ERROR] Found 4 errors     

Proposed resolution

Resolve PHPStan warnings found in GitLab CI runs.

📌 Task
Status

Fixed

Version

6.0

Component

Code

Created by

🇺🇸United States markdorison

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @markdorison
  • First commit to issue fork.
  • Merge request !7Issue #3400252: Fix phpcs errors. → (Merged) created by ankithashetty
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India ankithashetty Karnataka, India

    Only seeing the following errors, which are addressed in the MR:
    $ phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml .

    FILE: /sfweb2lead_webform/src/Plugin/WebformHandler/SalesforceWebToLeadPostWebformHandler.php
    ---------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------
     41 | ERROR | The array declaration extends to column 115 (the limit is 80). The array content should be split up over multiple lines
    ---------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /sfweb2lead_webform/src/EventSubscriber/BackwardsCompatibilitySubscriber.php
    ---------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    ---------------------------------------------------------------------------------------------------------------------------
     29 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     35 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     42 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    ---------------------------------------------------------------------------------------------------------------------------

    Please review, Thanks!

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

Production build 0.71.5 2024