PHP 8.1 compatibility. Multiple warnings

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

Problem/Motivation

while using phpstan tool, many deprecation issues were found in following files:

  • service_container/lib/Drupal/Component/Plugin/LazyPluginCollection.php
  • service_container/modules/providers/service_container_annotation_discovery/lib/Doctrine/common/lib/Doctrine/Common/Reflection/RuntimePublicReflectionProperty.php
  • service_container/modules/providers/service_container_annotation_discovery/lib/Doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionClass.php
  • service_container/modules/providers/service_container_annotation_discovery/lib/Doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionMethod.php
  • service_container/modules/providers/service_container_annotation_discovery/lib/Doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionProperty.php

The root cause of all issues is the same: Return type of method is not covariant with tentative return type of parent method.

Proposed resolution

Update return type to match the root method return type or use the #[\ReturnTypeWillChange] attribute to temporarily suppress the error.

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇧🇾Belarus yurikulinkovich

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

Comments & Activities

Production build 0.71.5 2024