[DOCS] Recommend $container->hasDefinition() for optional dependencies
ExtensionManagementUtility() usage in Services.php has never been an intended usage, but was technically possible in TYPO3 v10 as a side effect of runtime activated packages, and therefore got documented in example code. Container builds should generally be stateless and should only take explicit service configuration and ContainerBuilder compile time state into account. Therefore conditional service registration should only use compile time container state, which can be achieved with: ContainerBuilder->hasDefinition(ClassNameOfOptionalDependency::class) Resolves: #95359 Related: #95358 Releases: master, 10.4 Change-Id: I36073e9600a636d4b65f246e27109883e2dc80a1 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/71272 Tested-by:core-ci <typo3@b13.com> Tested-by:
Chris Müller <typo3@krue.ml> Tested-by:
Jörg Bösche <typo3@joergboesche.de> Tested-by:
Helmut Hummel <typo3@helhum.io> Reviewed-by:
Chris Müller <typo3@krue.ml> Reviewed-by:
Jörg Bösche <typo3@joergboesche.de> Reviewed-by:
Helmut Hummel <typo3@helhum.io>
Please register or sign in to comment