Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit953288c

Browse files
[FrameworkBundle] Auto-exclude DI extensions, kernel, test cases and messenger messages
1 parentc3c37f2 commit953288c

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

‎src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ CHANGELOG
1414
* Add support for signal plain name in the`messenger.stop_worker_on_signals` configuration
1515
* Deprecate the`framework.validation.cache` option
1616
* Add`--method` option to the`debug:router` command
17+
* Auto-exclude DI extensions, kernel, test cases and messenger messages
1718

1819
7.2
1920
---

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212
namespaceSymfony\Bundle\FrameworkBundle\DependencyInjection;
1313

1414
useComposer\InstalledVersions;
15+
useDoctrine\ORM\Mapping\Entity;
1516
useHttp\Client\HttpAsyncClient;
1617
useHttp\Client\HttpClient;
1718
usephpDocumentor\Reflection\DocBlockFactoryInterface;
1819
usephpDocumentor\Reflection\Types\ContextFactory;
1920
usePhpParser\Parser;
2021
usePHPStan\PhpDocParser\Parser\PhpDocParser;
22+
usePHPUnit\Framework\TestCase;
2123
usePsr\Cache\CacheItemPoolInterface;
2224
usePsr\Clock\ClockInterfaceasPsrClockInterface;
2325
usePsr\Container\ContainerInterfaceasPsrContainerInterface;
@@ -57,6 +59,7 @@
5759
useSymfony\Component\DependencyInjection\Alias;
5860
useSymfony\Component\DependencyInjection\Argument\ServiceLocatorArgument;
5961
useSymfony\Component\DependencyInjection\ChildDefinition;
62+
useSymfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6063
useSymfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass;
6164
useSymfony\Component\DependencyInjection\ContainerBuilder;
6265
useSymfony\Component\DependencyInjection\ContainerInterface;
@@ -99,6 +102,7 @@
99102
useSymfony\Component\HttpKernel\Controller\ValueResolverInterface;
100103
useSymfony\Component\HttpKernel\DataCollector\DataCollectorInterface;
101104
useSymfony\Component\HttpKernel\DependencyInjection\Extension;
105+
useSymfony\Component\HttpKernel\KernelInterface;
102106
useSymfony\Component\HttpKernel\Log\DebugLoggerConfigurator;
103107
useSymfony\Component\JsonStreamer\Attribute\JsonStreamable;
104108
useSymfony\Component\JsonStreamer\JsonStreamWriter;
@@ -117,6 +121,7 @@
117121
useSymfony\Component\Mailer\EventListener\SmimeSignedMessageListener;
118122
useSymfony\Component\Mailer\Mailer;
119123
useSymfony\Component\Mercure\HubRegistry;
124+
useSymfony\Component\Messenger\Attribute\AsMessage;
120125
useSymfony\Component\Messenger\Attribute\AsMessageHandler;
121126
useSymfony\Component\Messenger\BridgeasMessengerBridge;
122127
useSymfony\Component\Messenger\Handler\BatchHandlerInterface;
@@ -757,12 +762,25 @@ static function (ChildDefinition $definition, AsPeriodicTask|AsCronTask $attribu
757762
}
758763
);
759764
}
760-
$container->registerAttributeForAutoconfiguration(JsonStreamable::class,staticfunction (ChildDefinition$definition,JsonStreamable$attribute):void {
761-
$definition->addTag('json_streamer.streamable', [
765+
766+
$container->registerForAutoconfiguration(CompilerPassInterface::class)
767+
->addExcludeTag('container.excluded.compiler_pass');
768+
$container->registerForAutoconfiguration(KernelInterface::class)
769+
->addExcludeTag('container.excluded.kernel');
770+
$container->registerForAutoconfiguration(TestCase::class)
771+
->addExcludeTag('container.excluded.test_case');
772+
$container->registerAttributeForAutoconfiguration(AsMessage::class,staticfunction (ChildDefinition$definition) {
773+
$definition->addExcludeTag('container.excluded.messenger.message');
774+
});
775+
$container->registerAttributeForAutoconfiguration(Entity::class,staticfunction (ChildDefinition$definition) {
776+
$definition->addExcludeTag('container.excluded.doctrine.entity');
777+
});
778+
779+
$container->registerAttributeForAutoconfiguration(JsonStreamable::class,staticfunction (ChildDefinition$definition,JsonStreamable$attribute) {
780+
$definition->addExcludeTag('json_streamer.streamable', [
762781
'object' =>$attribute->asObject,
763782
'list' =>$attribute->asList,
764783
]);
765-
$definition->addTag('container.excluded');
766784
});
767785

768786
if (!$container->getParameter('kernel.debug')) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp