Skip to content

Commit e7ba0ec

Browse files
authored
minor #1582 [ci] php-cs-fixer it up
1 parent e8e4417 commit e7ba0ec

File tree

68 files changed

+297
-297
lines changed

Some content is hidden

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

68 files changed

+297
-297
lines changed

src/Command/MakerCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ protected function interact(InputInterface $input, OutputInterface $output): voi
7272
{
7373
if (!$this->fileManager->isNamespaceConfiguredToAutoload($this->generator->getRootNamespace())) {
7474
$this->io->note([
75-
sprintf('It looks like your app may be using a namespace other than "%s".', $this->generator->getRootNamespace()),
75+
\sprintf('It looks like your app may be using a namespace other than "%s".', $this->generator->getRootNamespace()),
7676
'To configure this and make your life easier, see: https://symfony.com/doc/current/bundles/SymfonyMakerBundle/index.html#configuration',
7777
]);
7878
}

src/DependencyBuilder.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,18 @@ public function getMissingPackagesMessage(string $commandName, $message = null):
9191

9292
$packagesCount = \count($packages) + \count($packagesDev);
9393

94-
$message = sprintf(
94+
$message = \sprintf(
9595
"Missing package%s: %s, run:\n",
9696
$packagesCount > 1 ? 's' : '',
97-
$message ?: sprintf('to use the %s command', $commandName)
97+
$message ?: \sprintf('to use the %s command', $commandName)
9898
);
9999

100100
if (!empty($packages)) {
101-
$message .= sprintf("\ncomposer require %s", implode(' ', $packages));
101+
$message .= \sprintf("\ncomposer require %s", implode(' ', $packages));
102102
}
103103

104104
if (!empty($packagesDev)) {
105-
$message .= sprintf("\ncomposer require %s --dev", implode(' ', $packagesDev));
105+
$message .= \sprintf("\ncomposer require %s --dev", implode(' ', $packagesDev));
106106
}
107107

108108
return $message;

src/DependencyInjection/CompilerPass/MakeCommandRegistrationPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function process(ContainerBuilder $container): void
3535

3636
$class = $container->getParameterBag()->resolveValue($def->getClass());
3737
if (!is_subclass_of($class, MakerInterface::class)) {
38-
throw new InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $id, MakerInterface::class));
38+
throw new InvalidArgumentException(\sprintf('Service "%s" must implement interface "%s".', $id, MakerInterface::class));
3939
}
4040

4141
$commandDefinition = new ChildDefinition('maker.auto_command.abstract');
@@ -71,7 +71,7 @@ public function process(ContainerBuilder $container): void
7171
$commandDefinition->addTag('console.command', ['command' => $alias, 'description' => 'Deprecated alias of "make:listener"']);
7272
}
7373

74-
$container->setDefinition(sprintf('maker.auto_command.%s', Str::asTwigVariable($class::getCommandName())), $commandDefinition);
74+
$container->setDefinition(\sprintf('maker.auto_command.%s', Str::asTwigVariable($class::getCommandName())), $commandDefinition);
7575
}
7676
}
7777
}

src/DependencyInjection/CompilerPass/SetDoctrineAnnotatedPrefixesPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function process(ContainerBuilder $container): void
4646
if ($arguments[0] instanceof Definition) {
4747
$class = $arguments[0]->getClass();
4848

49-
$id = sprintf('.%d_doctrine_metadata_driver~%s', $i, ContainerBuilder::hash($arguments));
49+
$id = \sprintf('.%d_doctrine_metadata_driver~%s', $i, ContainerBuilder::hash($arguments));
5050
$container->setDefinition($id, $arguments[0]);
5151
$arguments[0] = new Reference($id);
5252
$methodCalls[$i] = [$method, $arguments];

src/Docker/DockerDatabaseServices.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,23 @@ public static function getDatabaseSkeleton(string $name, string $version): array
2828
switch ($name) {
2929
case 'mariadb':
3030
return [
31-
'image' => sprintf('mariadb:%s', $version),
31+
'image' => \sprintf('mariadb:%s', $version),
3232
'environment' => [
3333
'MYSQL_ROOT_PASSWORD' => 'password',
3434
'MYSQL_DATABASE' => 'main',
3535
],
3636
];
3737
case 'mysql':
3838
return [
39-
'image' => sprintf('mysql:%s', $version),
39+
'image' => \sprintf('mysql:%s', $version),
4040
'environment' => [
4141
'MYSQL_ROOT_PASSWORD' => 'password',
4242
'MYSQL_DATABASE' => 'main',
4343
],
4444
];
4545
case 'postgres':
4646
return [
47-
'image' => sprintf('postgres:%s', $version),
47+
'image' => \sprintf('postgres:%s', $version),
4848
'environment' => [
4949
'POSTGRES_PASSWORD' => 'main',
5050
'POSTGRES_USER' => 'main',
@@ -101,6 +101,6 @@ public static function getMissingExtensionName(string $name): ?string
101101
*/
102102
private static function throwInvalidDatabase(string $name): never
103103
{
104-
throw new RuntimeCommandException(sprintf('%s is not a valid / supported docker database type.', $name));
104+
throw new RuntimeCommandException(\sprintf('%s is not a valid / supported docker database type.', $name));
105105
}
106106
}

src/Doctrine/DoctrineHelper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function doesClassUseDriver(string $className, string $driverClass): bool
8989
}
9090

9191
if (null === $em) {
92-
throw new \InvalidArgumentException(sprintf('Cannot find the entity manager for class "%s". Ensure entity uses attribute mapping.', $className));
92+
throw new \InvalidArgumentException(\sprintf('Cannot find the entity manager for class "%s". Ensure entity uses attribute mapping.', $className));
9393
}
9494

9595
if (null === $this->mappingDriversByPrefix) {
@@ -306,7 +306,7 @@ public static function getTypeConstant(string $columnType): ?string
306306
return null;
307307
}
308308

309-
return sprintf('Types::%s', $constants[$columnType]);
309+
return \sprintf('Types::%s', $constants[$columnType]);
310310
}
311311

312312
private function isInstanceOf($object, string $class): bool

src/Doctrine/EntityDetails.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function getFormFields(): array
7777
}
7878
$fieldsWithTypes[$fieldName] = [
7979
'type' => EntityType::class,
80-
'options_code' => sprintf('\'class\' => %s::class,', $relation['targetEntity']).\PHP_EOL.'\'choice_label\' => \'id\',',
80+
'options_code' => \sprintf('\'class\' => %s::class,', $relation['targetEntity']).\PHP_EOL.'\'choice_label\' => \'id\',',
8181
'extra_use_classes' => [$relation['targetEntity']],
8282
];
8383
if (\Doctrine\ORM\Mapping\ClassMetadata::MANY_TO_MANY === $relation['type']) {

src/Doctrine/EntityRegenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ public function regenerateEntities(string $classOrNamespace): void
4646
if ($metadata instanceof ClassMetadata) {
4747
$metadata = [$metadata];
4848
} elseif (class_exists($classOrNamespace)) {
49-
throw new RuntimeCommandException(sprintf('Could not find Doctrine metadata for "%s". Is it mapped as an entity?', $classOrNamespace));
49+
throw new RuntimeCommandException(\sprintf('Could not find Doctrine metadata for "%s". Is it mapped as an entity?', $classOrNamespace));
5050
} elseif (empty($metadata)) {
51-
throw new RuntimeCommandException(sprintf('No entities were found in the "%s" namespace.', $classOrNamespace));
51+
throw new RuntimeCommandException(\sprintf('No entities were found in the "%s" namespace.', $classOrNamespace));
5252
}
5353

5454
/** @var ClassSourceManipulator[] $operations */

src/Doctrine/EntityRelation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct(
3434
private string $inverseClass,
3535
) {
3636
if (!\in_array($type, self::getValidRelationTypes())) {
37-
throw new \Exception(sprintf('Invalid relation type "%s"', $type));
37+
throw new \Exception(\sprintf('Invalid relation type "%s"', $type));
3838
}
3939

4040
if (self::ONE_TO_MANY === $type) {

src/EventRegistry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public function getEventClassName(string $event): ?string
116116
public function listActiveEvents(array $events): array
117117
{
118118
foreach ($events as $key => $event) {
119-
$events[$key] = sprintf('%s (<fg=yellow>%s</>)', $event, self::$eventsMap[$event]);
119+
$events[$key] = \sprintf('%s (<fg=yellow>%s</>)', $event, self::$eventsMap[$event]);
120120
}
121121

122122
return $events;

src/FileManager.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function dumpFile(string $filename, string $content): void
6565
$this->fs->dumpFile($absolutePath, $content);
6666
$relativePath = $this->relativizePath($filename);
6767

68-
$this->io?->comment(sprintf(
68+
$this->io?->comment(\sprintf(
6969
'%s: %s',
7070
$comment,
7171
$this->makerFileLinkFormatter->makeLinkedPath($absolutePath, $relativePath)
@@ -105,7 +105,7 @@ public function relativizePath(string $absolutePath): string
105105
public function getFileContents(string $path): string
106106
{
107107
if (!$this->fileExists($path)) {
108-
throw new \InvalidArgumentException(sprintf('Cannot find file "%s"', $path));
108+
throw new \InvalidArgumentException(\sprintf('Cannot find file "%s"', $path));
109109
}
110110

111111
return file_get_contents($this->absolutizePath($path));
@@ -130,7 +130,7 @@ public function absolutizePath($path): string
130130
return $path;
131131
}
132132

133-
return sprintf('%s/%s', $this->rootDirectory, $path);
133+
return \sprintf('%s/%s', $this->rootDirectory, $path);
134134
}
135135

136136
/**
@@ -180,7 +180,7 @@ private function realPath(string $absolutePath): string
180180
if ('..' === $pathPart) {
181181
// we need to remove the previous entry
182182
if (-1 === $currentIndex) {
183-
throw new \Exception(sprintf('Problem making path relative - is the path "%s" absolute?', $absolutePath));
183+
throw new \Exception(\sprintf('Problem making path relative - is the path "%s" absolute?', $absolutePath));
184184
}
185185

186186
unset($finalParts[$currentIndex]);

src/Generator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function generateClass(string $className, string $templateName, array $va
5757
$targetPath = $this->fileManager->getRelativePathForFutureClass($className);
5858

5959
if (null === $targetPath) {
60-
throw new \LogicException(sprintf('Could not determine where to locate the new class "%s", maybe try with a full namespace like "\\My\\Full\\Namespace\\%s"', $className, Str::getShortClassName($className)));
60+
throw new \LogicException(\sprintf('Could not determine where to locate the new class "%s", maybe try with a full namespace like "\\My\\Full\\Namespace\\%s"', $className, Str::getShortClassName($className)));
6161
}
6262

6363
$variables = array_merge($variables, [
@@ -97,7 +97,7 @@ public function dumpFile(string $targetPath, string $contents)
9797
public function getFileContentsForPendingOperation(string $targetPath): string
9898
{
9999
if (!isset($this->pendingOperations[$targetPath])) {
100-
throw new RuntimeCommandException(sprintf('File "%s" is not in the Generator\'s pending operations', $targetPath));
100+
throw new RuntimeCommandException(\sprintf('File "%s" is not in the Generator\'s pending operations', $targetPath));
101101
}
102102

103103
$templatePath = $this->pendingOperations[$targetPath]['template'];
@@ -251,7 +251,7 @@ public static function getControllerBaseClass(): ClassNameDetails
251251
private function addOperation(string $targetPath, string $templateName, array $variables): void
252252
{
253253
if ($this->fileManager->fileExists($targetPath)) {
254-
throw new RuntimeCommandException(sprintf('The file "%s" can\'t be generated because it already exists.', $this->fileManager->relativizePath($targetPath)));
254+
throw new RuntimeCommandException(\sprintf('The file "%s" can\'t be generated because it already exists.', $this->fileManager->relativizePath($targetPath)));
255255
}
256256

257257
$variables['relative_path'] = $this->fileManager->relativizePath($targetPath);
@@ -261,7 +261,7 @@ private function addOperation(string $targetPath, string $templateName, array $v
261261
$templatePath = __DIR__.'/Resources/skeleton/'.$templateName;
262262

263263
if (!file_exists($templatePath)) {
264-
throw new \Exception(sprintf('Cannot find template "%s"', $templateName));
264+
throw new \Exception(\sprintf('Cannot find template "%s"', $templateName));
265265
}
266266
}
267267

src/Maker/Common/InstallDependencyTrait.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ public function installDependencyIfNeeded(ConsoleStyle $io, string $expectedClas
3030
return $io;
3131
}
3232

33-
$io->writeln(sprintf('Running: composer require %s', $composerPackage));
33+
$io->writeln(\sprintf('Running: composer require %s', $composerPackage));
3434

35-
Process::fromShellCommandline(sprintf('composer require %s', $composerPackage))->run();
35+
Process::fromShellCommandline(\sprintf('composer require %s', $composerPackage))->run();
3636

37-
$io->writeln(sprintf('%s successfully installed!', $composerPackage));
37+
$io->writeln(\sprintf('%s successfully installed!', $composerPackage));
3838
$io->newLine();
3939

4040
return $io;

src/Maker/MakeAuthenticator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ private function generateFormLoginFiles(string $controllerClass, string $userNam
377377
}
378378

379379
if (method_exists($controllerClassNameDetails->getFullName(), 'login')) {
380-
throw new RuntimeCommandException(sprintf('Method "login" already exists on class %s', $controllerClassNameDetails->getFullName()));
380+
throw new RuntimeCommandException(\sprintf('Method "login" already exists on class %s', $controllerClassNameDetails->getFullName()));
381381
}
382382

383383
$manipulator = new ClassSourceManipulator(
@@ -428,10 +428,10 @@ private function generateNextMessage(bool $securityYamlUpdated, string $authenti
428428
}
429429

430430
if (self::AUTH_TYPE_FORM_LOGIN === $authenticatorType) {
431-
$nextTexts[] = sprintf('- Finish the redirect "TODO" in the <info>%s::onAuthenticationSuccess()</info> method.', $authenticatorClass);
431+
$nextTexts[] = \sprintf('- Finish the redirect "TODO" in the <info>%s::onAuthenticationSuccess()</info> method.', $authenticatorClass);
432432

433433
if (!$this->doctrineHelper->isClassAMappedEntity($userClass)) {
434-
$nextTexts[] = sprintf('- Review <info>%s::getUser()</info> to make sure it matches your needs.', $authenticatorClass);
434+
$nextTexts[] = \sprintf('- Review <info>%s::getUser()</info> to make sure it matches your needs.', $authenticatorClass);
435435
}
436436

437437
$nextTexts[] = '- Review & adapt the login template: <info>'.$this->fileManager->getPathForTemplate('security/login.html.twig').'</info>.';

src/Maker/MakeCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function __construct(private ?PhpCompatUtil $phpCompatUtil = null)
3939
@trigger_deprecation(
4040
'symfony/maker-bundle',
4141
'1.55.0',
42-
sprintf('Initializing MakeCommand while providing an instance of "%s" is deprecated. The $phpCompatUtil param will be removed in a future version.', PhpCompatUtil::class),
42+
\sprintf('Initializing MakeCommand while providing an instance of "%s" is deprecated. The $phpCompatUtil param will be removed in a future version.', PhpCompatUtil::class),
4343
);
4444
}
4545
}
@@ -57,7 +57,7 @@ public static function getCommandDescription(): string
5757
public function configureCommand(Command $command, InputConfiguration $inputConfig): void
5858
{
5959
$command
60-
->addArgument('name', InputArgument::OPTIONAL, sprintf('Choose a command name (e.g. <fg=yellow>app:%s</>)', Str::asCommand(Str::getRandomTerm())))
60+
->addArgument('name', InputArgument::OPTIONAL, \sprintf('Choose a command name (e.g. <fg=yellow>app:%s</>)', Str::asCommand(Str::getRandomTerm())))
6161
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeCommand.txt'))
6262
;
6363
}
@@ -71,7 +71,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
7171
$commandNameHasAppPrefix ? substr($commandName, 4) : $commandName,
7272
'Command\\',
7373
'Command',
74-
sprintf('The "%s" command name is not valid because it would be implemented by "%s" class, which is not valid as a PHP class name (it must start with a letter or underscore, followed by any number of letters, numbers, or underscores).', $commandName, Str::asClassName($commandName, 'Command'))
74+
\sprintf('The "%s" command name is not valid because it would be implemented by "%s" class, which is not valid as a PHP class name (it must start with a letter or underscore, followed by any number of letters, numbers, or underscores).', $commandName, Str::asClassName($commandName, 'Command'))
7575
);
7676

7777
$useStatements = new UseStatementGenerator([

src/Maker/MakeController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(private ?PhpCompatUtil $phpCompatUtil = null)
4040
@trigger_deprecation(
4141
'symfony/maker-bundle',
4242
'1.55.0',
43-
sprintf('Initializing MakeCommand while providing an instance of "%s" is deprecated. The $phpCompatUtil param will be removed in a future version.', PhpCompatUtil::class)
43+
\sprintf('Initializing MakeCommand while providing an instance of "%s" is deprecated. The $phpCompatUtil param will be removed in a future version.', PhpCompatUtil::class)
4444
);
4545
}
4646
}
@@ -58,7 +58,7 @@ public static function getCommandDescription(): string
5858
public function configureCommand(Command $command, InputConfiguration $inputConfig): void
5959
{
6060
$command
61-
->addArgument('controller-class', InputArgument::OPTIONAL, sprintf('Choose a name for your controller class (e.g. <fg=yellow>%sController</>)', Str::asClassName(Str::getRandomTerm())))
61+
->addArgument('controller-class', InputArgument::OPTIONAL, \sprintf('Choose a name for your controller class (e.g. <fg=yellow>%sController</>)', Str::asClassName(Str::getRandomTerm())))
6262
->addOption('no-template', null, InputOption::VALUE_NONE, 'Use this option to disable template generation')
6363
->addOption('invokable', 'i', InputOption::VALUE_NONE, 'Use this option to create an invokable controller')
6464
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeController.txt'))

src/Maker/MakeCrud.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public static function getCommandDescription(): string
7070
public function configureCommand(Command $command, InputConfiguration $inputConfig): void
7171
{
7272
$command
73-
->addArgument('entity-class', InputArgument::OPTIONAL, sprintf('The class name of the entity to create CRUD (e.g. <fg=yellow>%s</>)', Str::asClassName(Str::getRandomTerm())))
73+
->addArgument('entity-class', InputArgument::OPTIONAL, \sprintf('The class name of the entity to create CRUD (e.g. <fg=yellow>%s</>)', Str::asClassName(Str::getRandomTerm())))
7474
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeCrud.txt'))
7575
;
7676

@@ -93,10 +93,10 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma
9393
$input->setArgument('entity-class', $value);
9494
}
9595

96-
$defaultControllerClass = Str::asClassName(sprintf('%s Controller', $input->getArgument('entity-class')));
96+
$defaultControllerClass = Str::asClassName(\sprintf('%s Controller', $input->getArgument('entity-class')));
9797

9898
$this->controllerClassName = $io->ask(
99-
sprintf('Choose a name for your controller class (e.g. <fg=yellow>%s</>)', $defaultControllerClass),
99+
\sprintf('Choose a name for your controller class (e.g. <fg=yellow>%s</>)', $defaultControllerClass),
100100
$defaultControllerClass
101101
);
102102

@@ -288,7 +288,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
288288

289289
$this->writeSuccessMessage($io);
290290

291-
$io->text(sprintf('Next: Check your new CRUD by going to <fg=yellow>%s/</>', Str::asRoutePath($controllerClassDetails->getRelativeNameWithoutSuffix())));
291+
$io->text(\sprintf('Next: Check your new CRUD by going to <fg=yellow>%s/</>', Str::asRoutePath($controllerClassDetails->getRelativeNameWithoutSuffix())));
292292
}
293293

294294
public function configureDependencies(DependencyBuilder $dependencies): void

0 commit comments

Comments
 (0)