mglaman / drupal-change-record-triage

Used to triage Drupal change records to ensure phpstan-drupal, drupal-rector, and upgrade_status have appropriate issues.
MIT License
6 stars 0 forks source link

Methods ::loadRevision() and ::deleteRevision() in classes \Drupal\Core\Entity\EntityStorageInterface, \Drupal\Core\Config\Entity\ConfigEntityStorage and \Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage are deprecated #518

Closed github-actions[bot] closed 1 year ago

github-actions[bot] commented 1 year ago

https://www.drupal.org/node/3294237

Introduced in branch/version: 10.1.x / 10.1.0

The following methods are deprecated:

\Drupal\Core\Entity\EntityStorageInterface::loadRevision()
\Drupal\Core\Entity\EntityStorageInterface::deleteRevision()
\Drupal\Core\Config\Entity\ConfigEntityStorage::loadRevision()
\Drupal\Core\Config\Entity\ConfigEntityStorage::deleteRevision()
\Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage::loadRevision()
\Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage::deleteRevision()

Use \Drupal\Core\Entity\RevisionableStorageInterface instead.

Berdir commented 1 year ago

Seeing this pop up in our project when testing the 10.1 update, so it kinda works bout phpstan is understandably pretty confused about it as it's deprecated on one interface but kept another, even when adding /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */, it thinks it knows better and gives me:

Call to deprecated method loadRevision() of class Drupal\Core\Entity\RevisionableStorageInterface:
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use
         \Drupal\Core\Entity\RevisionableStorageInterface::loadRevision instead.

And:

Call to deprecated method loadRevision() of class Drupal\Core\Entity\ContentEntityStorageBase:
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use
         \Drupal\Core\Entity\RevisionableStorageInterface::loadRevision instead.
mglaman commented 1 year ago

@Berdir thanks for commenting. This needs a phpstan-drupal issue. Probably to add stubs and provide @not-deprecated tags on something. Probably RevisionableStorageInterface

This will be messy.

mglaman commented 1 year ago

Fixed with https://github.com/mglaman/phpstan-drupal/releases/tag/1.1.35