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
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
Comment #4
sergeydruua commentedComment #6
sergeydruua commented