Prepare CI: PHPStan, PHPCS, and test suite fixes

PHPStan (level 4):

  • Remove create() from abstract base classes (SitePluginBase, SiteWithContentBase, ContentSiteActionBase); add concrete create() with new self() to every leaf class to fix unsafe new static()
  • Add missing ): static / ): self return types to all create() methods
  • Narrow applies() return type from ?bool to bool in final example plugins (valid covariant narrowing)
  • Move hidden-plugin removal from getDefinitions() into alterDefinitions() where it belongs
  • Baseline reduced from 477 errors to 11 genuinely unfixable entries

Test suite:

  • Replace removed withConsecutive() with willReturnCallback (PHPUnit 11)
  • Fix ReflectionMethod::invoke() not passing by reference; switch to invokeArgs(sut, [&definitions])
  • Fix SitesUrlGeneratorTest mocks: wire getSite() on proxy, use correct request host, make setContext callback propagate host changes
  • Fix SitesServiceTest: add parameter bag stubs for buildRouteMatchKey
  • Fix SitesServiceRouteMatchCacheTest: mock getStorage() for scalar entity-upcast path
  • Fix SiteSettingsInheritanceSubscriberTest: use willReturnCallback with &$ignore so the alter hook actually modifies the ignore list

Resolves #3601636

Closes #3601636

Merge request reports

Loading