Commit 5a0a79c
committed
[TASK] Make
It's a good practice to define interfaces and provide a default
implementation making xclass strategies, stubbing or mocking in
tests and similar techniques easier. Default implementation, if
provided, should be configured in the DI configuration as alias
for the interface, not done for the `ConfigurationInterface` on
the default implementation `Configuration`.
TYPO3 `SingeltonInterface` stems from old times before DI has
been introduced to TYPO3 and has been used to mark classes as
`shared` (only instanciated onces) within `GeneralUtilitiy`,
something is the default behaviour for services in DI as long
as not configured otherwise. Having `ConfigurationInterface`
and `Configuration` DI aware makes the `SingeltonInterface`
obsolete.
Services implementing `SingletonInterface` are automatically
configured as `public: true` by a TYPO3 DI compiler pass and
needs to be set manually when removing the interface from a
service.
This change ...
* Remove `SingletonInterface` from `Configurtion` in favour
of default `shared: true` of the DI.
* Use Symfony `AsAlias` php attribute on `Configuration` to
mark it as the default `ConfigurationInterface` service,
addtional setting the service as `public: true` to allow
retrieval using `GeneralUtility::makeInstance()`.
That prepares towards retrieving services by DI either as
constructor or `inject*` methods in the future.Configuration default for ConfigurationInterface
1 parent ec6923d commit 5a0a79c
1 file changed
+3
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | | - | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
0 commit comments