Problem/Motivation

Two findings from the work that introduced the PHPStan configuration are large enough to be their own issue. The helper methods that were extracted into MyrestImageBuilder, MyrestMenuBuilder and MyrestPageUrlResolver are deprecated, but 172 call sites inside the module still go through the deprecated wrappers rather than the services. Separately, analysis above level 1 reports 78 errors at level 2 and 410 at level 5, almost all of them calls such as hasTranslation(), getTranslation() or field accessors made on ContentEntityInterface and EntityInterface, which do not declare those methods.

Proposed resolution

  • Inject the extracted services where they are used and move the call sites onto them, wrapper by wrapper, then drop the ignore pattern that covers them.
  • Narrow the entity type hints to the interfaces that actually declare what is called - TranslatableInterface, FieldableEntityInterface, NodeInterface, TermInterface - rather than asserting or suppressing.
  • Raise the level to 2, then further, fixing each step before moving on.

Remaining tasks

Migrate the call sites, then work through the levels.

User interface changes

None.

API changes

The deprecated wrappers stay until 2.0.0; only the module's internal use of them goes away.

Issue fork myrest-3617545

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

sergeydruua created an issue. See original summary.

  • sergeydruua committed ba1b94a2 on 1.0.x
    Issue #3617545: Migrate off the deprecated helper wrappers, raise...
sergeydruua’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

sergeydruua’s picture

Status: Fixed » Closed (fixed)