GitLab CI - PHPStan - "Unsafe usage of new static()"

Created on 7 January 2024, 10 months ago
Updated 21 January 2024, 10 months ago

Problem/Motivation

GitLab CI now passes, except PHPStan produces the following warnings:

 ------ --------------------------------------------------------------------------------------------
  Line   responsive_image_link_formatter/src/Plugin/Field/FieldFormatter/ResponsiveImageLinkFormatter.php  
 ------ --------------------------------------------------------------------------------------------
  85     Unsafe usage of new static().                                                                     
         💡 See:                                                                                           
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static                      
 ------ --------------------------------------------------------------------------------------------
 ------ ------------------------------------------------------------------------------ 
  Line   src/Plugin/Field/FieldFormatter/ImageLinkFormatter.php                        
 ------ ------------------------------------------------------------------------------ 
  81     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 [ERROR] Found 2 errors   

See: https://git.drupalcode.org/project/image_link_formatter/-/jobs/585932

Steps to reproduce

Run GitLab pipeline.

Proposed resolution

Based on: #3405618-9: GitLab CI - PHPStan - "Unsafe usage of new static()"

Useful links:

Based on the solution suggested for the module Smart Trim in the issue comment linked above:

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Fixed

Version

2.1

Component

Automated testing

Created by

🇫🇷France dydave

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024