Reference core services by FQCN instead of removed string service ids - #626
Reference core services by FQCN instead of removed string service ids#626promptless-for-oss wants to merge 1 commit into
Conversation
mautic/mautic PR #17124 dropped the redundant 'mautic.helper.core_parameters' and 'mautic.cache.provider' string service aliases on Mautic 8. The classes stay registered and autowire-injectable, so plugin config.php examples and the cache sample now reference them by fully-qualified class name.
| 'serviceAlias' => 'swiftmailer.mailer.transport.%s', | ||
| 'arguments' => [ | ||
| 'mautic.helper.core_parameters', | ||
| \Mautic\CoreBundle\Helper\CoreParametersHelper::class, |
There was a problem hiding this comment.
Mautic 8.x PR #17124 (merge commit dc0a515) dropped the mautic.helper.core_parameters alias from CoreBundle/Config/services.php (previously aliased at old line ~94) and switched the sole internal consumer to service(Mautic\CoreBundle\Helper\CoreParametersHelper::class). CoreParametersHelper.php is not in MauticCoreExtension::DEFAULT_EXCLUDES nor CoreBundle's local excludes, so it remains auto-registered/autowirable under its FQCN via the bundle's services->load() call. Confirms the doc's FQCN reference is the correct current way to reference this service.
| 'class' => MauticPlugin\HelloWorldBundle\Form\Validator\Constraints\MarsValidator::class, | ||
| 'arguments' => [ | ||
| 'mautic.helper.core_parameters', | ||
| \Mautic\CoreBundle\Helper\CoreParametersHelper::class, |
There was a problem hiding this comment.
Same evidence as emails.rst:574 — PR #17124 removed the mautic.helper.core_parameters string alias on 8.x; Mautic\CoreBundle\Helper\CoreParametersHelper remains registered/autowirable under its FQCN (see services.php load() call and DEFAULT_EXCLUDES), so \Mautic\CoreBundle\Helper\CoreParametersHelper::class is the correct current reference.
|
|
||
| /** @var CacheProvider $cache */ | ||
| $cache = $this->get('mautic.cache.provider'); | ||
| $cache = $this->get(\Mautic\CacheBundle\Cache\CacheProvider::class); |
There was a problem hiding this comment.
Mautic 8.x PR #17124 (merge commit dc0a515) dropped the mautic.cache.provider alias from CacheBundle/Config/services.php (previously at old line ~30, aliasing 'mautic.cache.provider' to Mautic\CacheBundle\Cache\CacheProvider::class). Mautic\CacheBundle\Cache\CacheProvider is still a registered service (see the surviving alias of CacheProviderInterface::class to CacheProvider::class on L36, and CacheProvider.php is not excluded from the bundle's services->load() autoregistration), confirming CacheProvider::class resolves as a valid service id. Note: the doc sample omits a use Mautic\CacheBundle\Cache\CacheProvider; import or leading backslash, unlike the other two FQCN replacements in this PR — flagged separately as a prose correction.
|
All good 👍 |
Open in Promptless
mautic/mautic PR #17124 ("[phpstan] Prefer class service references, drop redundant aliases and setter calls", merged into
8.x) adds PHPStan rules that drop redundant string container service aliases across bundles. Two of the removed ids appear in the plugin developer docs as the way to reference a core service, so those code samples go stale on Mautic 8: the string ids no longer resolve, while the classes stay registered and autowire-injectable under their Fully Qualified Class Name (FQCN). This mirrors the already-accepted FQCN-swap pattern from PR #16875 (docs PR #612).This updates each affected reference to use the FQCN instead of the removed string service id:
docs/plugin_extensions/emails.rst— the Email transport pluginconfig.phpexample passed'mautic.helper.core_parameters'as a constructor argument; it now passes\Mautic\CoreBundle\Helper\CoreParametersHelper::class(fully qualified, since thatconfig.phpblock has nousestatements).docs/plugins/config.rst— thehelloworld.mars.validatorpluginconfig.phpexample passed the same removed id as an argument; it now passes\Mautic\CoreBundle\Helper\CoreParametersHelper::class. The adjacent'helloworld.helper.world'entry is a plugin-defined service and is left as a string.docs/plugins/cache.rst— the cache code sample retrieved the provider via$this->get('mautic.cache.provider'); it now uses$this->get(\Mautic\CacheBundle\Cache\CacheProvider::class).Trigger Events