Skip to content

Commit fb11d06

Browse files
minor #61088 CS fixes (nicolas-grekas)
This PR was squashed before being merged into the 6.4 branch. Discussion ---------- CS fixes | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT I ran php-cs-fixer on the codebase and cherry-picked relevant changes. This is aimed at reducing conflicts when merging into upper branches and at helping contributors, which currently get unrelated suggestions from fabbot. Commits ------- cf9312f - 77bd236 CS fixes
2 parents 25bbdca + cf9312f commit fb11d06

File tree

1,536 files changed

+5039
-5011
lines changed

Some content is hidden

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

1,536 files changed

+5039
-5011
lines changed

.git-blame-ignore-revs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
f4118e110a46de3ffb799e7d79bf15128d1646ea
33
9519b54417c09c49496a4a6be238e63be9a73465
44
ae0a783425b80b78376488619bf9106e69193fa4
5+
77bd236b8da064c90b19b84a35becfb3e43348db

.github/expected-missing-return-types.diff

Lines changed: 92 additions & 92 deletions
Large diffs are not rendered by default.

src/Symfony/Bridge/Doctrine/ArgumentResolver/EntityValueResolver.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function resolve(Request $request, ArgumentMetadata $argument): array
5757
$message = '';
5858
if (null !== $options->expr) {
5959
if (null === $object = $this->findViaExpression($manager, $request, $options)) {
60-
$message = sprintf(' The expression "%s" returned null.', $options->expr);
60+
$message = \sprintf(' The expression "%s" returned null.', $options->expr);
6161
}
6262
// find by identifier?
6363
} elseif (false === $object = $this->find($manager, $request, $options, $argument->getName())) {
@@ -73,7 +73,7 @@ public function resolve(Request $request, ArgumentMetadata $argument): array
7373
}
7474

7575
if (null === $object && !$argument->isNullable()) {
76-
throw new NotFoundHttpException(sprintf('"%s" object not found by "%s".', $options->class, self::class).$message);
76+
throw new NotFoundHttpException(\sprintf('"%s" object not found by "%s".', $options->class, self::class).$message);
7777
}
7878

7979
return [$object];
@@ -129,7 +129,7 @@ private function getIdentifier(Request $request, MapEntity $options, string $nam
129129
foreach ($options->id as $field) {
130130
// Convert "%s_uuid" to "foobar_uuid"
131131
if (str_contains($field, '%s')) {
132-
$field = sprintf($field, $name);
132+
$field = \sprintf($field, $name);
133133
}
134134

135135
$id[$field] = $request->attributes->get($field);
@@ -198,7 +198,7 @@ private function getCriteria(Request $request, MapEntity $options, ObjectManager
198198
private function findViaExpression(ObjectManager $manager, Request $request, MapEntity $options): ?object
199199
{
200200
if (!$this->expressionLanguage) {
201-
throw new \LogicException(sprintf('You cannot use the "%s" if the ExpressionLanguage component is not available. Try running "composer require symfony/expression-language".', __CLASS__));
201+
throw new \LogicException(\sprintf('You cannot use the "%s" if the ExpressionLanguage component is not available. Try running "composer require symfony/expression-language".', __CLASS__));
202202
}
203203

204204
$repository = $manager->getRepository($options->class);

src/Symfony/Bridge/Doctrine/CacheWarmer/ProxyCacheWarmer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ public function warmUp(string $cacheDir, ?string $buildDir = null): array
4444
// we need the directory no matter the proxy cache generation strategy
4545
if (!is_dir($proxyCacheDir = $em->getConfiguration()->getProxyDir())) {
4646
if (false === @mkdir($proxyCacheDir, 0777, true) && !is_dir($proxyCacheDir)) {
47-
throw new \RuntimeException(sprintf('Unable to create the Doctrine Proxy directory "%s".', $proxyCacheDir));
47+
throw new \RuntimeException(\sprintf('Unable to create the Doctrine Proxy directory "%s".', $proxyCacheDir));
4848
}
4949
} elseif (!is_writable($proxyCacheDir)) {
50-
throw new \RuntimeException(sprintf('The Doctrine Proxy directory "%s" is not writeable for the current system user.', $proxyCacheDir));
50+
throw new \RuntimeException(\sprintf('The Doctrine Proxy directory "%s" is not writeable for the current system user.', $proxyCacheDir));
5151
}
5252

5353
// if proxies are autogenerated we don't need to generate them in the cache warmer

src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ protected function getCasters(): array
189189
return [Caster::PREFIX_VIRTUAL.'__toString()' => (string) $o->getObject()];
190190
}
191191

192-
return [Caster::PREFIX_VIRTUAL.'' => sprintf('Object of class "%s" could not be converted to string.', $o->getClass())];
192+
return [Caster::PREFIX_VIRTUAL.'' => \sprintf('Object of class "%s" could not be converted to string.', $o->getClass())];
193193
},
194194
];
195195
}
@@ -278,7 +278,7 @@ private function sanitizeParam(mixed $var, ?\Throwable $error): array
278278
}
279279

280280
if (\is_resource($var)) {
281-
return [sprintf('/* Resource(%s) */', get_resource_type($var)), false, false];
281+
return [\sprintf('/* Resource(%s) */', get_resource_type($var)), false, false];
282282
}
283283

284284
return [$var, true, true];

src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ protected function loadMappingInformation(array $objectManager, ContainerBuilder
8686
}
8787

8888
if (null === $bundle) {
89-
throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled.', $mappingName));
89+
throw new \InvalidArgumentException(\sprintf('Bundle "%s" does not exist or it is not enabled.', $mappingName));
9090
}
9191

9292
$mappingConfig = $this->getMappingDriverBundleConfigDefaults($mappingConfig, $bundle, $container, $bundleMetadata['path']);
@@ -130,7 +130,7 @@ protected function setMappingDriverConfig(array $mappingConfig, string $mappingN
130130
{
131131
$mappingDirectory = $mappingConfig['dir'];
132132
if (!is_dir($mappingDirectory)) {
133-
throw new \InvalidArgumentException(sprintf('Invalid Doctrine mapping path given. Cannot load Doctrine mapping/bundle named "%s".', $mappingName));
133+
throw new \InvalidArgumentException(\sprintf('Invalid Doctrine mapping path given. Cannot load Doctrine mapping/bundle named "%s".', $mappingName));
134134
}
135135

136136
$this->drivers[$mappingConfig['type']][$mappingConfig['prefix']] = realpath($mappingDirectory) ?: $mappingDirectory;
@@ -242,15 +242,15 @@ protected function registerMappingDrivers(array $objectManager, ContainerBuilder
242242
protected function assertValidMappingConfiguration(array $mappingConfig, string $objectManagerName)
243243
{
244244
if (!$mappingConfig['type'] || !$mappingConfig['dir'] || !$mappingConfig['prefix']) {
245-
throw new \InvalidArgumentException(sprintf('Mapping definitions for Doctrine manager "%s" require at least the "type", "dir" and "prefix" options.', $objectManagerName));
245+
throw new \InvalidArgumentException(\sprintf('Mapping definitions for Doctrine manager "%s" require at least the "type", "dir" and "prefix" options.', $objectManagerName));
246246
}
247247

248248
if (!is_dir($mappingConfig['dir'])) {
249-
throw new \InvalidArgumentException(sprintf('Specified non-existing directory "%s" as Doctrine mapping source.', $mappingConfig['dir']));
249+
throw new \InvalidArgumentException(\sprintf('Specified non-existing directory "%s" as Doctrine mapping source.', $mappingConfig['dir']));
250250
}
251251

252252
if (!\in_array($mappingConfig['type'], ['xml', 'yml', 'annotation', 'php', 'staticphp', 'attribute'])) {
253-
throw new \InvalidArgumentException(sprintf('Can only configure "xml", "yml", "annotation", "php", "staticphp" or "attribute" through the DoctrineBundle. Use your own bundle to configure other metadata drivers. You can register them by adding a new driver to the "%s" service definition.', $this->getObjectManagerElementName($objectManagerName.'_metadata_driver')));
253+
throw new \InvalidArgumentException(\sprintf('Can only configure "xml", "yml", "annotation", "php", "staticphp" or "attribute" through the DoctrineBundle. Use your own bundle to configure other metadata drivers. You can register them by adding a new driver to the "%s" service definition.', $this->getObjectManagerElementName($objectManagerName.'_metadata_driver')));
254254
}
255255
}
256256

@@ -358,8 +358,8 @@ protected function loadCacheDriver(string $cacheName, string $objectManagerName,
358358
$memcachedInstance->addMethodCall('addServer', [
359359
$memcachedHost, $memcachedPort,
360360
]);
361-
$container->setDefinition($this->getObjectManagerElementName(sprintf('%s_memcached_instance', $objectManagerName)), $memcachedInstance);
362-
$cacheDef->addMethodCall('setMemcached', [new Reference($this->getObjectManagerElementName(sprintf('%s_memcached_instance', $objectManagerName)))]);
361+
$container->setDefinition($this->getObjectManagerElementName(\sprintf('%s_memcached_instance', $objectManagerName)), $memcachedInstance);
362+
$cacheDef->addMethodCall('setMemcached', [new Reference($this->getObjectManagerElementName(\sprintf('%s_memcached_instance', $objectManagerName)))]);
363363
break;
364364
case 'redis':
365365
$redisClass = !empty($cacheDriver['class']) ? $cacheDriver['class'] : '%'.$this->getObjectManagerElementName('cache.redis.class').'%';
@@ -371,19 +371,19 @@ protected function loadCacheDriver(string $cacheName, string $objectManagerName,
371371
$redisInstance->addMethodCall('connect', [
372372
$redisHost, $redisPort,
373373
]);
374-
$container->setDefinition($this->getObjectManagerElementName(sprintf('%s_redis_instance', $objectManagerName)), $redisInstance);
375-
$cacheDef->addMethodCall('setRedis', [new Reference($this->getObjectManagerElementName(sprintf('%s_redis_instance', $objectManagerName)))]);
374+
$container->setDefinition($this->getObjectManagerElementName(\sprintf('%s_redis_instance', $objectManagerName)), $redisInstance);
375+
$cacheDef->addMethodCall('setRedis', [new Reference($this->getObjectManagerElementName(\sprintf('%s_redis_instance', $objectManagerName)))]);
376376
break;
377377
case 'apc':
378378
case 'apcu':
379379
case 'array':
380380
case 'xcache':
381381
case 'wincache':
382382
case 'zenddata':
383-
$cacheDef = new Definition('%'.$this->getObjectManagerElementName(sprintf('cache.%s.class', $cacheDriver['type'])).'%');
383+
$cacheDef = new Definition('%'.$this->getObjectManagerElementName(\sprintf('cache.%s.class', $cacheDriver['type'])).'%');
384384
break;
385385
default:
386-
throw new \InvalidArgumentException(sprintf('"%s" is an unrecognized Doctrine cache driver.', $cacheDriver['type']));
386+
throw new \InvalidArgumentException(\sprintf('"%s" is an unrecognized Doctrine cache driver.', $cacheDriver['type']));
387387
}
388388

389389
if (!isset($cacheDriver['namespace'])) {
@@ -475,7 +475,7 @@ private function validateAutoMapping(array $managerConfigs): ?string
475475
}
476476

477477
if (null !== $autoMappedManager) {
478-
throw new \LogicException(sprintf('You cannot enable "auto_mapping" on more than one manager at the same time (found in "%s" and "%s"").', $autoMappedManager, $name));
478+
throw new \LogicException(\sprintf('You cannot enable "auto_mapping" on more than one manager at the same time (found in "%s" and "%s"").', $autoMappedManager, $name));
479479
}
480480

481481
$autoMappedManager = $name;

src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ private function addTaggedServices(ContainerBuilder $container): array
8383
? [$container->getParameterBag()->resolveValue($tag['connection'])]
8484
: array_keys($this->connections);
8585
if ($listenerTag === $tagName && !isset($tag['event'])) {
86-
throw new InvalidArgumentException(sprintf('Doctrine event listener "%s" must specify the "event" attribute.', $id));
86+
throw new InvalidArgumentException(\sprintf('Doctrine event listener "%s" must specify the "event" attribute.', $id));
8787
}
8888
foreach ($connections as $con) {
8989
if (!isset($this->connections[$con])) {
90-
throw new RuntimeException(sprintf('The Doctrine connection "%s" referenced in service "%s" does not exist. Available connections names: "%s".', $con, $id, implode('", "', array_keys($this->connections))));
90+
throw new RuntimeException(\sprintf('The Doctrine connection "%s" referenced in service "%s" does not exist. Available connections names: "%s".', $con, $id, implode('", "', array_keys($this->connections))));
9191
}
9292

9393
if (!isset($managerDefs[$con])) {
@@ -127,7 +127,7 @@ private function addTaggedServices(ContainerBuilder $container): array
127127
private function getEventManagerDef(ContainerBuilder $container, string $name): Definition
128128
{
129129
if (!isset($this->eventManagers[$name])) {
130-
$this->eventManagers[$name] = $container->getDefinition(sprintf($this->managerTemplate, $name));
130+
$this->eventManagers[$name] = $container->getDefinition(\sprintf($this->managerTemplate, $name));
131131
}
132132

133133
return $this->eventManagers[$name];

src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public function process(ContainerBuilder $container)
157157
*/
158158
protected function getChainDriverServiceName(ContainerBuilder $container): string
159159
{
160-
return sprintf($this->driverPattern, $this->getManagerName($container));
160+
return \sprintf($this->driverPattern, $this->getManagerName($container));
161161
}
162162

163163
/**
@@ -179,7 +179,7 @@ protected function getDriver(ContainerBuilder $container): Definition|Reference
179179
*/
180180
private function getConfigurationServiceName(ContainerBuilder $container): string
181181
{
182-
return sprintf($this->configurationPattern, $this->getManagerName($container));
182+
return \sprintf($this->configurationPattern, $this->getManagerName($container));
183183
}
184184

185185
/**
@@ -201,7 +201,7 @@ private function getManagerName(ContainerBuilder $container): string
201201
}
202202
}
203203

204-
throw new InvalidArgumentException(sprintf('Could not find the manager name parameter in the container. Tried the following parameter names: "%s".', implode('", "', $this->managerParameters)));
204+
throw new InvalidArgumentException(\sprintf('Could not find the manager name parameter in the container. Tried the following parameter names: "%s".', implode('", "', $this->managerParameters)));
205205
}
206206

207207
/**

src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(
4141
private readonly ?EntityLoaderInterface $objectLoader = null,
4242
) {
4343
if ($idReader && !$idReader->isSingleId()) {
44-
throw new \InvalidArgumentException(sprintf('The "$idReader" argument of "%s" must be null when the query cannot be optimized because of composite id fields.', __METHOD__));
44+
throw new \InvalidArgumentException(\sprintf('The "$idReader" argument of "%s" must be null when the query cannot be optimized because of composite id fields.', __METHOD__));
4545
}
4646

4747
$this->class = $manager->getClassMetadata($class)->getName();

src/Symfony/Bridge/Doctrine/Form/ChoiceList/IdReader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function getIdValue(?object $object = null): string
8383
}
8484

8585
if (!$this->om->contains($object)) {
86-
throw new RuntimeException(sprintf('Entity of type "%s" passed to the choice field must be managed. Maybe you forget to persist it in the entity manager?', get_debug_type($object)));
86+
throw new RuntimeException(\sprintf('Entity of type "%s" passed to the choice field must be managed. Maybe you forget to persist it in the entity manager?', get_debug_type($object)));
8787
}
8888

8989
$this->om->initializeObject($object);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy