89985[TASK] Consistently use self::new in all ServiceProviders
Commit message
Review
-
Code review CR -1
- Benjamin Franzke -1
- Simon Schaufelberger +1
-
Verified V 0
- core-ci +1 CI
Issues 1
Files 7
- typo3/sysext/backend/Classes/ServiceProvider.php+8 −7
- typo3/sysext/core/Classes/Package/AbstractServiceProvider.php+2 −2
- typo3/sysext/core/Classes/ServiceProvider.php+54 −47
- typo3/sysext/dashboard/Classes/ServiceProvider.php+6 −6
- typo3/sysext/fluid/Classes/ServiceProvider.php+2 −2
- typo3/sysext/frontend/Classes/ServiceProvider.php+3 −3
- typo3/sysext/install/Classes/ServiceProvider.php+79 −75
Review log 69
-
TYPO3com uploaded patch set 1 07/03/25, 18:48
-
core-ci voted on patch set 1 V +1 07/03/25, 18:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81286
-
Garvin Hicking updated the commit message in patch set 2
V +107/03/25, 20:35 -
core-ci voted on patch set 2 V +1 07/03/25, 20:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81292
-
Simon Schaufelberger voted on patch set 2 CR +1 07/04/25, 08:12
-
Benjamin Franzke commented on patch set 2 CR -1 07/04/25, 08:22
Hi, thanks for the patch. The idea to add a `new()`-helper method was mainly to add transparent support for `LoggerAwareInterface` in lowlevel services and to ensure that XCLASSES are still possible where really needed/or supported before DI introduction. We avoided this for new classes, since we do not want to support XCLASSing for lowlevel services in general… Other than that our current plan is to: * reduce defined classes in service providers and use symfony DI even in install tool, wherever possible and where failsafe mode is not a requirement (e.g. update wizard, install process), see for example https://review.typo3.org/c/Packages/TYPO3.CMS/+/89956/2/typo3/sysext/core/Classes/ServiceProvider.php for a WIP patch that works in that area * Once we have the *bare* minimum list of services in service providers, that is needed for a failsafe bootstrap of the installtool (e.g. to enable logging into the install tool despite a broken extension), I'd then rather remove the `AbstractServiceProvider::new()` method and use plain `new` everywhere inside these lowlevel services, that are really not intended to be overwritten (again to ensure that the installtool can always be started). Note: There is another way to override service-provider provided services if *really* needed, but that is internal API. Extensions can provide an own service provider and provide a class extension (that can replace an existing instance) in an own provider, example: https://github.com/FriendsOfTYPO3/content-blocks/blob/25ecf071b738d7f877ce37eaa7e620b6435f08c0/composer.json#L52 https://github.com/FriendsOfTYPO3/content-blocks/blob/25ecf071b738d7f877ce37eaa7e620b6435f08c0/Classes/ServiceProvider.php#L85 For that reason I'd like to reject this change. Sorry! -
Oliver Eglseder commented on patch set 2 07/07/25, 22:36
It's okay to discardReply
I kinda get that some things should not be XCLASSable, because you really want to ship a rock solid install tool, which is much appreciated. On the other hand, i will resort to composer patches or any other ways to achieve my use case, which defies your noble goal. So in the end, you could've just approved it, maybe with a big disclaimer. But still, developers will get their way, one way or another 😜 I'm not one to give up easily, but i'm not going to push or insist on this specific change. Anyway, i felt the need to drop my 2 cents along the way before letting go, but i am fine. Composer Patches FTW ;D -
Benjamin Franzke abandoned the change 07/08/25, 06:35
-
Benjamin Franzke commented on patch set 2 07/08/25, 17:04
Reply
Hey, I abandoned this morning but didn't actually see this comment by that time (only the other one "It's okay to discord"). Now that I've noticed this one I want to answer to your understandable criticism: I really understand that our "noble" goals sometimes feel like blockers and sometimes even are. It's not always easy to find the right compromise between technically perfect solutions and compromises. In this case I decided to "block" because I saw another way – service providers – and therefore depicted that one. That way – although being internal – is actually superior to XCLASSES, since it allows to control *what* is injected. So whatever, sorry that this is upsetting, but I really tried to find the best compromise.