Fix PHPSTAN issues

Created on 12 December 2023, about 1 year ago
Updated 13 December 2023, about 1 year ago

Problem/Motivation

Now that we have the Gitlab CI running, the job failed on PHPSTAN with the following:

------ -------------------------------------------------------------------------------------- 
  Line   modules/cloudflare_stream_hosted_video/src/Plugin/media/Source/HostedVideoSource.php  
 ------ -------------------------------------------------------------------------------------- 
  75     Unsafe usage of new static().                                                         
         💡 See:                                                                               
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static          
 ------ -------------------------------------------------------------------------------------- 
 ------ ------------------------------------------------------------- 
  Line   modules/cloudflare_stream_sync/src/Commands/SyncCommand.php  
 ------ ------------------------------------------------------------- 
  56     Call to deprecated function watchdog_exception():            
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use      
           Use \Drupal\Core\Utility\Error::logException() instead.    
 ------ ------------------------------------------------------------- 
 ------ ------------------------------------------------------------------------------ 
  Line   modules/cloudflare_stream_sync/src/Form/SyncVideosSettings.php                
 ------ ------------------------------------------------------------------------------ 
  55     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------ 
  Line   src/Plugin/Field/FieldFormatter/CloudflareVideoFormatter.php                  
 ------ ------------------------------------------------------------------------------ 
  95     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------ 
  Line   src/Plugin/Field/FieldType/CloudflareVideoItem.php                            
 ------ ------------------------------------------------------------------------------ 
  99     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ---------------------------------------------------------------------------------- 
  Line   src/Service/CloudflareStreamApi.php                                               
 ------ ---------------------------------------------------------------------------------- 
  85     Method                                                                            
         Drupal\cloudflare_stream\Service\CloudflareStreamApi::uploadVideoByHttpRequest()  
         should return Psr\Http\Message\ResponseInterface but return statement             
         is missing.                                                                       
  109    Method                                                                            
         Drupal\cloudflare_stream\Service\CloudflareStreamApi::getEmbedCodeHtml()          
         should return Psr\Http\Message\ResponseInterface but return statement             
         is missing.                                                                       
  127    Method                                                                            
         Drupal\cloudflare_stream\Service\CloudflareStreamApi::deleteVideo()               
         should return Psr\Http\Message\ResponseInterface but return statement             
         is missing.                                                                       
  145    Method                                                                            
         Drupal\cloudflare_stream\Service\CloudflareStreamApi::listVideos()                
         should return Psr\Http\Message\ResponseInterface but return statement             
         is missing.                                                                       
  231    Call to deprecated function watchdog_exception():                                 
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use                           
           Use \Drupal\Core\Utility\Error::logException() instead.                         
 ------ ---------------------------------------------------------------------------------- 
 [ERROR] Found 10 errors                                                        

Steps to reproduce

-

Proposed resolution

Fix the errors.

Remaining tasks

Provide and review MR.

User interface changes

-

API changes

-

Data model changes

-

📌 Task
Status

Fixed

Version

3.0

Component

Code

Created by

🇧🇪Belgium tim-diels Belgium 🇧🇪

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