Problem/Motivation
While fixing #3386719: Fatal error when viewing a static_page revision due to core type upcasting change, eager contributors wanted to convert StaticPageSubscriber to use DI. I also ran into this while getting a green pipeline at #3563026: Enable GitLab CI for static_page since phpstan was complaining about the \Drupal:: calls.
Steps to reproduce
Proposed resolution
- Use DI not
\Drupal::insrc/EventSubscriber/StaticPageSubscriber.php - Remove that warning from
phpstan-baseline.neon
Remaining tasks
Move commits/diff about DI from #3386719: Fatal error when viewing a static_page revision due to core type upcasting change into here.
User interface changes
API changes
Data model changes
Issue fork static_page-3563027
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:
- 3563027-use-di-in-StaticPageSubscriber
changes, plain diff MR !5
Comments
Comment #3
dwwMoved the DI changes from #3386719: Fatal error when viewing a static_page revision due to core type upcasting change to here. However, this is still gonna conflict with #3386719, so let's resolve that, first. Also, still need to remove the DI stuff from the phpstan baseline.
Comment #4
joelpittetIs it ok to expand the scope a bit and deal with
StaticPageSettingsFormas well @dww?Comment #5
dwwRe: #4: Slightly confused, I don't see any
\Drupal::inStaticPageSettingsForm. What else needs DI in there?Comment #6
joelpittet@dww sorry it's not
Drupalstatic. Here is what I had in mind forNodeTypethe gist as there is a constructor change too:Comment #7
dwwOh, gotcha. Sure, we can fix both in here. Thanks!
Comment #8
dwwRebased after recent merges. Fixed
StaticPageSettingsForm.Comment #11
dwwMerged. Thanks!