Rearrange interfaces TranslatableRevisionableStorageInterface extends to fix deprecation warnings

Created on 24 August 2023, over 1 year ago
Updated 8 November 2023, about 1 year ago

Problem/Motivation

This is a quirky issue relating to EntityStorageInterface::loadRevision being deprecated.

PHPStan is caching interface methods from left to right.

@Kingdutch had some information on the internals for how PHP handles this: https://drupal.slack.com/archives/C033S2JUMLJ/p1692251803456129?thread_t...

Kingdutch on August 17th at 7:56:43 AM
This sounds very similar to https://github.com/phpstan/phpstan/issues/8437 that I filed for https://www.drupal.org/project/drupal/issues/3324733 β†’ which was slightly different
(We have more of these hidden in Drupal core)
Usually these things are not PHPStan issues but PHP quirks :sweat_smile:
PHP does not document its interface inheritance order, but I can find https://www.php.net/manual/en/language.oop5.interfaces.php#125893 which links to 3 bug reports that suggest that the evaluation happens from right to left?
If we follow the right to left logic, I think things suddenly make sense and that's exactly why flipping them fixes it (because RevisionableStorageInterface which has the most specific method, comes last)

I don't think it really matters. Drupal core just extends EntityStorageInterface a lot.

Steps to reproduce

Scan code with PHPStan and deprecation rules package. Get warnings.

Proposed resolution

Stop extending `EntityStorageInterface` if another interface is extending it.

Rearrange extends for TranslatableRevisionableStorageInterface

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Fixed

Version

11.0 πŸ”₯

Component
EntityΒ  β†’

Last updated about 10 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States mglaman WI, USA

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

Comments & Activities

Production build 0.71.5 2024