Skip to content

Commit 9a24052

Browse files
authored
Merge pull request #238 from phpfui/PSR-4Autoloading
Replace global DI library functions with corresponding objects for PSR-4 compliance
2 parents 6ade63b + aa53306 commit 9a24052

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

src/di_config.php

+24-22
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* @license http://opensource.org/licenses/bsd-license.php BSD
66
*/
77

8+
use DI\Definition\Helper\AutowireDefinitionHelper;
9+
use DI\Definition\Reference;
810
use Psr\Log\LoggerInterface;
911
use Psr\Log\NullLogger;
1012
use ZBateson\MailMimeParser\Header\Consumer\Received\DomainConsumerService;
@@ -16,47 +18,47 @@
1618
use ZBateson\MailMimeParser\Stream\StreamFactory;
1719

1820
return [
19-
LoggerInterface::class => DI\autowire(NullLogger::class),
21+
LoggerInterface::class => new AutowireDefinitionHelper(NullLogger::class),
2022

2123
// only affects reading part content, not for instance decoding mime encoded
2224
// header parts
2325
'throwExceptionReadingPartContentFromUnsupportedCharsets' => false,
2426

25-
'fromDomainConsumerService' => DI\autowire(DomainConsumerService::class)
27+
'fromDomainConsumerService' => (new AutowireDefinitionHelper(DomainConsumerService::class))
2628
->constructorParameter('partName', 'from'),
27-
'byDomainConsumerService' => DI\autowire(DomainConsumerService::class)
29+
'byDomainConsumerService' => (new AutowireDefinitionHelper(DomainConsumerService::class))
2830
->constructorParameter('partName', 'by'),
29-
'viaGenericReceivedConsumerService' => DI\autowire(GenericReceivedConsumerService::class)
31+
'viaGenericReceivedConsumerService' => (new AutowireDefinitionHelper(GenericReceivedConsumerService::class))
3032
->constructorParameter('partName', 'via'),
31-
'withGenericReceivedConsumerService' => DI\autowire(GenericReceivedConsumerService::class)
33+
'withGenericReceivedConsumerService' => (new AutowireDefinitionHelper(GenericReceivedConsumerService::class))
3234
->constructorParameter('partName', 'with'),
33-
'idGenericReceivedConsumerService' => DI\autowire(GenericReceivedConsumerService::class)
35+
'idGenericReceivedConsumerService' => (new AutowireDefinitionHelper(GenericReceivedConsumerService::class))
3436
->constructorParameter('partName', 'id'),
35-
'forGenericReceivedConsumerService' => DI\autowire(GenericReceivedConsumerService::class)
37+
'forGenericReceivedConsumerService' => (new AutowireDefinitionHelper(GenericReceivedConsumerService::class))
3638
->constructorParameter('partName', 'for'),
37-
ReceivedConsumerService::class => DI\autowire()
39+
ReceivedConsumerService::class => (new AutowireDefinitionHelper())
3840
->constructor(
39-
fromDomainConsumerService: DI\get('fromDomainConsumerService'),
40-
byDomainConsumerService: DI\get('byDomainConsumerService'),
41-
viaGenericReceivedConsumerService: DI\get('viaGenericReceivedConsumerService'),
42-
withGenericReceivedConsumerService: DI\get('withGenericReceivedConsumerService'),
43-
idGenericReceivedConsumerService: DI\get('idGenericReceivedConsumerService'),
44-
forGenericReceivedConsumerService: DI\get('forGenericReceivedConsumerService')
41+
fromDomainConsumerService: new Reference('fromDomainConsumerService'),
42+
byDomainConsumerService: new Reference('byDomainConsumerService'),
43+
viaGenericReceivedConsumerService: new Reference('viaGenericReceivedConsumerService'),
44+
withGenericReceivedConsumerService: new Reference('withGenericReceivedConsumerService'),
45+
idGenericReceivedConsumerService: new Reference('idGenericReceivedConsumerService'),
46+
forGenericReceivedConsumerService: new Reference('forGenericReceivedConsumerService')
4547
),
46-
PartStreamContainer::class => DI\autowire()
48+
PartStreamContainer::class => (new AutowireDefinitionHelper())
4749
->constructor(
48-
throwExceptionReadingPartContentFromUnsupportedCharsets: DI\get('throwExceptionReadingPartContentFromUnsupportedCharsets')
50+
throwExceptionReadingPartContentFromUnsupportedCharsets: new Reference('throwExceptionReadingPartContentFromUnsupportedCharsets')
4951
),
50-
PartStreamContainerFactory::class => DI\autowire()
52+
PartStreamContainerFactory::class => (new AutowireDefinitionHelper())
5153
->constructor(
52-
throwExceptionReadingPartContentFromUnsupportedCharsets: DI\get('throwExceptionReadingPartContentFromUnsupportedCharsets')
54+
throwExceptionReadingPartContentFromUnsupportedCharsets: new Reference('throwExceptionReadingPartContentFromUnsupportedCharsets')
5355
),
54-
ParserPartStreamContainerFactory::class => DI\autowire()
56+
ParserPartStreamContainerFactory::class => (new AutowireDefinitionHelper())
5557
->constructor(
56-
throwExceptionReadingPartContentFromUnsupportedCharsets: DI\get('throwExceptionReadingPartContentFromUnsupportedCharsets')
58+
throwExceptionReadingPartContentFromUnsupportedCharsets: new Reference('throwExceptionReadingPartContentFromUnsupportedCharsets')
5759
),
58-
StreamFactory::class => DI\autowire()
60+
StreamFactory::class => (new AutowireDefinitionHelper())
5961
->constructor(
60-
throwExceptionReadingPartContentFromUnsupportedCharsets: DI\get('throwExceptionReadingPartContentFromUnsupportedCharsets')
62+
throwExceptionReadingPartContentFromUnsupportedCharsets: new Reference('throwExceptionReadingPartContentFromUnsupportedCharsets')
6163
),
6264
];

0 commit comments

Comments
 (0)