Fix wrongly deprecated method RevisionableStorageInterface::loadRevision#980
Conversation
5028a77 to
5532dd0
Compare
|
In my Drupal 10.6.8 project, the following code gives me a PhpStan error: $storage = \Drupal::entityTypeManager()->getStorage('paragraph');
if (!$storage instanceof RevisionableStorageInterface) {
return null;
}
foreach ($node->get('field_content')->getValue() as $content) {
if (isset($content['target_revision_id'])) {
$firstLevelParagraph = $storage->loadRevision($content['target_revision_id']); // <----ERROR
// ...
}
}This is obviously a false positive and after some research I found https://phpstan.org/writing-php-code/phpdocs-basics#deprecations where the When I add Some details about my project setup: I changed my PR commit to add the |
|
Thanks for the info! |
There was a problem hiding this comment.
Pull request overview
Adjusts Drupal entity storage stubs so PHPStan’s deprecation analysis does not incorrectly report RevisionableStorageInterface revision operations as deprecated.
Changes:
- Add
@not-deprecatedtoRevisionableStorageInterface::loadRevision(). - Add
@not-deprecatedtoRevisionableStorageInterface::deleteRevision().
Since
RevisionableStorageInterfaceextendsEntityStorageInterface, the deprecations are also inherited.The
loadRevision()method is not supposed to be deprecated onRevisionableStorageInterfacethough.