Skip to content

Commit f93d69c

Browse files
CS fixes
1 parent 6df1a43 commit f93d69c

File tree

56 files changed

+276
-152
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+276
-152
lines changed

src/Symfony/Bridge/Doctrine/Tests/Types/DatePointTypeTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Doctrine\DBAL\Exception;
1515
use Doctrine\DBAL\Platforms\AbstractPlatform;
1616
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
17+
use Doctrine\DBAL\Platforms\SQLitePlatform;
1718
use Doctrine\DBAL\Types\Type;
1819
use PHPUnit\Framework\TestCase;
1920
use Symfony\Bridge\Doctrine\Types\DatePointType;
@@ -93,9 +94,9 @@ private static function getSqlitePlatform(): AbstractPlatform
9394
{
9495
if (interface_exists(Exception::class)) {
9596
// DBAL 4+
96-
return new \Doctrine\DBAL\Platforms\SQLitePlatform();
97+
return new SQLitePlatform();
9798
}
9899

99-
return new \Doctrine\DBAL\Platforms\SqlitePlatform();
100+
return new SQLitePlatform();
100101
}
101102
}

src/Symfony/Bridge/Doctrine/Tests/Types/UlidTypeTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Doctrine\DBAL\Platforms\MariaDBPlatform;
1717
use Doctrine\DBAL\Platforms\MySQLPlatform;
1818
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
19+
use Doctrine\DBAL\Platforms\SQLitePlatform;
1920
use Doctrine\DBAL\Types\ConversionException;
2021
use Doctrine\DBAL\Types\Type;
2122
use PHPUnit\Framework\Attributes\DataProvider;
@@ -153,9 +154,9 @@ private static function getSqlitePlatform(): AbstractPlatform
153154
{
154155
if (interface_exists(Exception::class)) {
155156
// DBAL 4+
156-
return new \Doctrine\DBAL\Platforms\SQLitePlatform();
157+
return new SQLitePlatform();
157158
}
158159

159-
return new \Doctrine\DBAL\Platforms\SqlitePlatform();
160+
return new SQLitePlatform();
160161
}
161162
}

src/Symfony/Bridge/Doctrine/Tests/Types/UuidTypeTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Doctrine\DBAL\Platforms\MariaDBPlatform;
1717
use Doctrine\DBAL\Platforms\MySQLPlatform;
1818
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
19+
use Doctrine\DBAL\Platforms\SQLitePlatform;
1920
use Doctrine\DBAL\Types\ConversionException;
2021
use Doctrine\DBAL\Types\Type;
2122
use PHPUnit\Framework\Attributes\DataProvider;
@@ -164,9 +165,9 @@ private static function getSqlitePlatform(): AbstractPlatform
164165
{
165166
if (interface_exists(Exception::class)) {
166167
// DBAL 4+
167-
return new \Doctrine\DBAL\Platforms\SQLitePlatform();
168+
return new SQLitePlatform();
168169
}
169170

170-
return new \Doctrine\DBAL\Platforms\SqlitePlatform();
171+
return new SQLitePlatform();
171172
}
172173
}

src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface;
2424
use Symfony\Component\HttpKernel\Fragment\FragmentUriGenerator;
2525
use Twig\Environment;
26+
use Twig\Error\RuntimeError;
2627
use Twig\Loader\ArrayLoader;
2728
use Twig\RuntimeLoader\RuntimeLoaderInterface;
2829

@@ -32,7 +33,7 @@ public function testFragmentWithError()
3233
{
3334
$renderer = $this->getFragmentHandler(new \Exception('foo'));
3435

35-
$this->expectException(\Twig\Error\RuntimeError::class);
36+
$this->expectException(RuntimeError::class);
3637

3738
$this->renderTemplate($renderer);
3839
}

src/Symfony/Bridge/Twig/Tests/Extension/StopwatchExtensionTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818
use Symfony\Component\Stopwatch\StopwatchEvent;
1919
use Twig\Environment;
2020
use Twig\Error\RuntimeError;
21+
use Twig\Error\SyntaxError;
2122
use Twig\Loader\ArrayLoader;
2223

2324
class StopwatchExtensionTest extends TestCase
2425
{
2526
public function testFailIfStoppingWrongEvent()
2627
{
27-
$this->expectException(\Twig\Error\SyntaxError::class);
28+
$this->expectException(SyntaxError::class);
2829
$this->testTiming('{% stopwatch "foo" %}{% endstopwatch "bar" %}', []);
2930
}
3031

src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Symfony\Component\Translation\Translator;
1919
use Symfony\Contracts\Translation\TranslatorInterface;
2020
use Twig\Environment;
21+
use Twig\Error\SyntaxError;
2122
use Twig\Loader\ArrayLoader as TwigArrayLoader;
2223
use Twig\TemplateWrapper;
2324

@@ -48,14 +49,14 @@ public function testTrans($template, $expected, array $variables = [])
4849

4950
public function testTransUnknownKeyword()
5051
{
51-
$this->expectException(\Twig\Error\SyntaxError::class);
52+
$this->expectException(SyntaxError::class);
5253
$this->expectExceptionMessage('Unexpected token. Twig was looking for the "with", "from", or "into" keyword in "index" at line 3.');
5354
$this->getTemplate("{% trans \n\nfoo %}{% endtrans %}")->render();
5455
}
5556

5657
public function testTransComplexBody()
5758
{
58-
$this->expectException(\Twig\Error\SyntaxError::class);
59+
$this->expectException(SyntaxError::class);
5960
$this->expectExceptionMessage('A message inside a trans tag must be a simple text in "index" at line 2.');
6061
$this->getTemplate("{% trans %}\n{{ 1 + 2 }}{% endtrans %}")->render();
6162
}

src/Symfony/Bundle/FrameworkBundle/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;

src/Symfony/Bundle/FrameworkBundle/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')) {

src/Symfony/Bundle/FrameworkBundle/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

src/Symfony/Bundle/FrameworkBundle/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)