Problem/Motivation

#3383279: Bump mglaman/phpstan-drupal to latest to make daily "updated deps" QA run pass again introduced (a lot of) deprecation warnings like:

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

Currently they are suppressed in core/phpstan-baseline.neon.

This issue is here to remove all of them from the baseline by type-hinting.

Steps to reproduce

Proposed resolution

Use type-hinting on the likes of \Drupal::entityTypeManager()->getStorage($entity_type_id) to clarify (to PHPStan) we intend to use the more specific RevisionableStorageInterface instead of EntityStorageInterface.

This issue should leave none of the above mentioned deprecation suppressions in the baseline.

In the process of doing so we also remove two of these suppressions:

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

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3383513

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Spokje created an issue. See original summary.

spokje’s picture

Title: Ue type-hinting on deprecation warnings for loadRevision() introduced by mglaman/phpstan-drupal:1.2.0 » Use type-hinting on deprecation warnings for loadRevision() introduced by mglaman/phpstan-drupal:1.2.0
Status: Active » Needs work

spokje’s picture

spokje’s picture

Issue summary: View changes
spokje’s picture

Assigned: spokje » Unassigned
Status: Needs work » Needs review
spokje’s picture

Issue summary: View changes
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative

Applied the MR and searched for Call to deprecated method loadRevision\ in the baseline file and all instances were replaced. Tests are all green so believe this is good.

catch’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

Needs a re-roll for the phpstan baseline.

A couple of these I wondered if we should think about adding assertions/instanceof checks, but not for here.

spokje’s picture

Status: Needs work » Reviewed & tested by the community
Issue tags: -Needs reroll

  • catch committed cc0c9fdd on 11.x
    Issue #3383513 by Spokje, smustgrave: Use type-hinting on deprecation...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed cc0c9fd and pushed to 11.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.