Fix PHP 8.3 compatibility issues

Created on 5 March 2025, about 1 month ago

Problem/Motivation

rector reports PHP 8.3 compatibility issues
phpstan reports a code style issue

Steps to reproduce

$ rector process web/modules/contrib/health_check_url --dry-run
 2/2 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
2 files with changes
====================

1) web/modules/contrib/health_check_url/src/Form/HealthCheckSettingsForm.php:12

    ---------- begin diff ----------
@@ @@
   /**
    * {@inheritdoc}
    */
+  #[\Override]
   public function getFormId() {
....

2) web/modules/contrib/health_check_url/src/Routing/RouteService.php:32

    ---------- begin diff ----------
@@ @@
   public function routes() {
     $route_collection = new RouteCollection();

-    $endpoint = !empty($this->settings->get('endpoint')) ? trim($this->settings->get('endpoint'), '/') : 'health';
+    $endpoint = !empty($this->settings->get('endpoint')) ? trim((string) $this->settings->get('endpoint'), '/') : 'health';
...
Applied rules:
 * StringClassNameToClassConstantRector
 * NullToStrictStringFuncCallArgRector
$ phpstan analyze --level 0 web/modules/contrib/health_check_url
  ------ ------------------------------------------------------------------------------ 
  Line   src/Form/HealthCheckSettingsForm.php                                          
 ------ ------------------------------------------------------------------------------ 
  98     \Drupal calls should be avoided in classes, use dependency injection instead  
 ------ ------------------------------------------------------------------------------ 

Proposed resolution

Fix these issues in code.

📌 Task
Status

Active

Version

3.0

Component

Code

Created by

🇷🇴Romania aludescher

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