Declaration of __sleep() must be compatible with ConfigEntityBase::__sleep(): array

Created on 12 November 2024, 5 months ago

Problem/Motivation

When trying to install this module in an environment using PHP 8.3, I received the error Fatal error: Declaration of Drupal\oauth2_server\Entity\Scope::__sleep() must be compatible with Drupal\Core\Config\Entity\ConfigEntityBase::__sleep(): array
for both the Scope and Client classes. This is because of a signature mismatch because of PHP LSP enforcement requiring a method in a class that extends another to have the same return type as the method being extended.

Steps to reproduce

  1. Download oauth2_server onto environment with PHP 8.0+
  2. Attempt to install oauth2_server using drush en oauth2_server
  3. Note that installation causes fatal PHP error.

Proposed resolution

Update the methods that are inherited to match the parent signatures.

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States dorficus

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