Skip to content

Commit 6f5f9d2

Browse files
CS fixes
1 parent 16a1871 commit 6f5f9d2

File tree

4 files changed

+27
-18
lines changed

4 files changed

+27
-18
lines changed

Command/ContainerLintCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
2626
use Symfony\Component\DependencyInjection\Compiler\ResolveFactoryClassPass;
2727
use Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass;
28-
use Symfony\Component\DependencyInjection\Container;
2928
use Symfony\Component\DependencyInjection\ContainerBuilder;
3029
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
3130
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;

DependencyInjection/FrameworkExtension.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
use Symfony\Bundle\FrameworkBundle\Routing\RouteLoaderInterface;
3434
use Symfony\Bundle\FullStack;
3535
use Symfony\Bundle\MercureBundle\MercureBundle;
36+
use Symfony\Component\Asset\Package;
3637
use Symfony\Component\Asset\PackageInterface;
3738
use Symfony\Component\AssetMapper\AssetMapper;
3839
use Symfony\Component\AssetMapper\Compiler\AssetCompilerInterface;
@@ -133,6 +134,8 @@
133134
use Symfony\Component\Messenger\MessageBusInterface;
134135
use Symfony\Component\Messenger\Middleware\DeduplicateMiddleware;
135136
use Symfony\Component\Messenger\Middleware\RouterContextMiddleware;
137+
use Symfony\Component\Messenger\Transport\AmqpExt\AmqpTransportFactory;
138+
use Symfony\Component\Messenger\Transport\RedisExt\RedisTransportFactory;
136139
use Symfony\Component\Messenger\Transport\Serialization\SerializerInterface;
137140
use Symfony\Component\Messenger\Transport\TransportFactoryInterface as MessengerTransportFactoryInterface;
138141
use Symfony\Component\Messenger\Transport\TransportInterface;
@@ -176,6 +179,7 @@
176179
use Symfony\Component\Scheduler\Messenger\Serializer\Normalizer\SchedulerTriggerNormalizer;
177180
use Symfony\Component\Security\Core\AuthenticationEvents;
178181
use Symfony\Component\Security\Core\Exception\AuthenticationException;
182+
use Symfony\Component\Security\Csrf\CsrfToken;
179183
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
180184
use Symfony\Component\Semaphore\PersistingStoreInterface as SemaphoreStoreInterface;
181185
use Symfony\Component\Semaphore\Semaphore;
@@ -389,7 +393,7 @@ public function load(array $configs, ContainerBuilder $container): void
389393
}
390394

391395
if ($this->readConfigEnabled('assets', $container, $config['assets'])) {
392-
if (!class_exists(\Symfony\Component\Asset\Package::class)) {
396+
if (!class_exists(Package::class)) {
393397
throw new LogicException('Asset support cannot be enabled as the Asset component is not installed. Try running "composer require symfony/asset".');
394398
}
395399

@@ -594,19 +598,19 @@ public function load(array $configs, ContainerBuilder $container): void
594598
$container->removeDefinition('cache.messenger.restart_workers_signal');
595599

596600
if ($container->hasDefinition('messenger.transport.amqp.factory') && !class_exists(MessengerBridge\Amqp\Transport\AmqpTransportFactory::class)) {
597-
if (class_exists(\Symfony\Component\Messenger\Transport\AmqpExt\AmqpTransportFactory::class)) {
601+
if (class_exists(AmqpTransportFactory::class)) {
598602
$container->getDefinition('messenger.transport.amqp.factory')
599-
->setClass(\Symfony\Component\Messenger\Transport\AmqpExt\AmqpTransportFactory::class)
603+
->setClass(AmqpTransportFactory::class)
600604
->addTag('messenger.transport_factory');
601605
} else {
602606
$container->removeDefinition('messenger.transport.amqp.factory');
603607
}
604608
}
605609

606610
if ($container->hasDefinition('messenger.transport.redis.factory') && !class_exists(MessengerBridge\Redis\Transport\RedisTransportFactory::class)) {
607-
if (class_exists(\Symfony\Component\Messenger\Transport\RedisExt\RedisTransportFactory::class)) {
611+
if (class_exists(RedisTransportFactory::class)) {
608612
$container->getDefinition('messenger.transport.redis.factory')
609-
->setClass(\Symfony\Component\Messenger\Transport\RedisExt\RedisTransportFactory::class)
613+
->setClass(RedisTransportFactory::class)
610614
->addTag('messenger.transport_factory');
611615
} else {
612616
$container->removeDefinition('messenger.transport.redis.factory');
@@ -1971,7 +1975,7 @@ private function registerSecurityCsrfConfiguration(array $config, ContainerBuild
19711975
return;
19721976
}
19731977

1974-
if (!class_exists(\Symfony\Component\Security\Csrf\CsrfToken::class)) {
1978+
if (!class_exists(CsrfToken::class)) {
19751979
throw new LogicException('CSRF support cannot be enabled as the Security CSRF component is not installed. Try running "composer require symfony/security-csrf".');
19761980
}
19771981
if (!$config['stateless_token_ids'] && !$this->isInitializedConfigEnabled('session')) {

Resources/config/console.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
use Symfony\Component\Console\Messenger\RunCommandMessageHandler;
4646
use Symfony\Component\Dotenv\Command\DebugCommand as DotenvDebugCommand;
4747
use Symfony\Component\ErrorHandler\Command\ErrorDumpCommand;
48+
use Symfony\Component\Form\Command\DebugCommand;
4849
use Symfony\Component\Messenger\Command\ConsumeMessagesCommand;
4950
use Symfony\Component\Messenger\Command\DebugCommand as MessengerDebugCommand;
5051
use Symfony\Component\Messenger\Command\FailedMessagesRemoveCommand;
@@ -327,7 +328,7 @@
327328
])
328329
->tag('console.command')
329330

330-
->set('console.command.form_debug', \Symfony\Component\Form\Command\DebugCommand::class)
331+
->set('console.command.form_debug', DebugCommand::class)
331332
->args([
332333
service('form.registry'),
333334
[], // All form types namespaces are stored here by FormPass

Tests/DependencyInjection/FrameworkExtensionTestCase.php

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use PHPUnit\Framework\Attributes\DataProvider;
1515
use Psr\Cache\CacheItemPoolInterface;
1616
use Psr\Log\LoggerAwareInterface;
17+
use Psr\Log\LogLevel;
1718
use Symfony\Bundle\FrameworkBundle\DependencyInjection\FrameworkExtension;
1819
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
1920
use Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Fixtures\Workflow\Validator\DefinitionValidator;
@@ -59,6 +60,10 @@
5960
use Symfony\Component\HttpClient\ThrottlingHttpClient;
6061
use Symfony\Component\HttpFoundation\IpUtils;
6162
use Symfony\Component\HttpKernel\DependencyInjection\LoggerPass;
63+
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
64+
use Symfony\Component\HttpKernel\Exception\ConflictHttpException;
65+
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
66+
use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException;
6267
use Symfony\Component\HttpKernel\Fragment\FragmentUriGeneratorInterface;
6368
use Symfony\Component\Lock\Store\SemaphoreStore;
6469
use Symfony\Component\Messenger\Bridge\AmazonSqs\Transport\AmazonSqsTransportFactory;
@@ -599,8 +604,8 @@ public function testPhpErrorsWithLogLevels()
599604
$definition = $container->getDefinition('debug.error_handler_configurator');
600605
$this->assertEquals(new Reference('logger', ContainerInterface::NULL_ON_INVALID_REFERENCE), $definition->getArgument(0));
601606
$this->assertSame([
602-
\E_NOTICE => \Psr\Log\LogLevel::ERROR,
603-
\E_WARNING => \Psr\Log\LogLevel::ERROR,
607+
\E_NOTICE => LogLevel::ERROR,
608+
\E_WARNING => LogLevel::ERROR,
604609
], $definition->getArgument(1));
605610
}
606611

@@ -611,35 +616,35 @@ public function testExceptionsConfig()
611616
$configuration = $container->getDefinition('exception_listener')->getArgument(3);
612617

613618
$this->assertSame([
614-
\Symfony\Component\HttpKernel\Exception\BadRequestHttpException::class,
615-
\Symfony\Component\HttpKernel\Exception\NotFoundHttpException::class,
616-
\Symfony\Component\HttpKernel\Exception\ConflictHttpException::class,
617-
\Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException::class,
619+
BadRequestHttpException::class,
620+
NotFoundHttpException::class,
621+
ConflictHttpException::class,
622+
ServiceUnavailableHttpException::class,
618623
], array_keys($configuration));
619624

620625
$this->assertEqualsCanonicalizing([
621626
'log_channel' => null,
622627
'log_level' => 'info',
623628
'status_code' => 422,
624-
], $configuration[\Symfony\Component\HttpKernel\Exception\BadRequestHttpException::class]);
629+
], $configuration[BadRequestHttpException::class]);
625630

626631
$this->assertEqualsCanonicalizing([
627632
'log_channel' => null,
628633
'log_level' => 'info',
629634
'status_code' => null,
630-
], $configuration[\Symfony\Component\HttpKernel\Exception\NotFoundHttpException::class]);
635+
], $configuration[NotFoundHttpException::class]);
631636

632637
$this->assertEqualsCanonicalizing([
633638
'log_channel' => null,
634639
'log_level' => 'info',
635640
'status_code' => null,
636-
], $configuration[\Symfony\Component\HttpKernel\Exception\ConflictHttpException::class]);
641+
], $configuration[ConflictHttpException::class]);
637642

638643
$this->assertEqualsCanonicalizing([
639644
'log_channel' => null,
640645
'log_level' => null,
641646
'status_code' => 500,
642-
], $configuration[\Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException::class]);
647+
], $configuration[ServiceUnavailableHttpException::class]);
643648
}
644649

645650
public function testRouter()

0 commit comments

Comments
 (0)