This is a bit critical/controversial as containers define
services to be shared by default. PSR-11 does so as well.
Therefore https://review.typo3.org/c/Packages/TYPO3.CMS/+/58255
kept the default value, as suggested by symfony.
BUT: We'll run into problems with autowiring
of the current, stateful classes that rely on the fact
being prototypes.
When these services are wired as dependencies into other
services, symfony DI will share these services
between multiple dependants – even though the
the service might not be prepared for shared use.
(stateful)
Therefore we have to default to non-shared services
(prototypes).
TODO:
* Maybe this can enable this per extension (choice?)
that way would could drop this from core
once we have configured all services, but provide
this as sane/easy-migratable default for 3rd party
extensions
Note: This change applies to services without an explicit
shared state. Services that implement SingletonInterface
and services defined in service providers will explicitly be
set to be shared. Therefore the ServiceProviderCompilationPass
is adpated to explicitly share service provider managed
services. (That's what the current spec specifies)