Skip to content

Commit 3b1b64a

Browse files
CS fixes
1 parent 3db1460 commit 3b1b64a

30 files changed

+77
-76
lines changed

Command/DebugFirewallCommand.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ protected function configure(): void
7575
EOF
7676
)
7777
->setDefinition([
78-
new InputArgument('name', InputArgument::OPTIONAL, sprintf('A firewall name (for example "%s")', $exampleName)),
78+
new InputArgument('name', InputArgument::OPTIONAL, \sprintf('A firewall name (for example "%s")', $exampleName)),
7979
new InputOption('events', null, InputOption::VALUE_NONE, 'Include a list of event listeners (only available in combination with the "name" argument)'),
8080
]);
8181
}
@@ -92,18 +92,18 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9292
return 0;
9393
}
9494

95-
$serviceId = sprintf('security.firewall.map.context.%s', $name);
95+
$serviceId = \sprintf('security.firewall.map.context.%s', $name);
9696

9797
if (!$this->contexts->has($serviceId)) {
98-
$io->error(sprintf('Firewall %s was not found. Available firewalls are: %s', $name, implode(', ', $this->firewallNames)));
98+
$io->error(\sprintf('Firewall %s was not found. Available firewalls are: %s', $name, implode(', ', $this->firewallNames)));
9999

100100
return 1;
101101
}
102102

103103
/** @var FirewallContext $context */
104104
$context = $this->contexts->get($serviceId);
105105

106-
$io->title(sprintf('Firewall "%s"', $name));
106+
$io->title(\sprintf('Firewall "%s"', $name));
107107

108108
$this->displayFirewallSummary($name, $context, $io);
109109

@@ -125,7 +125,7 @@ protected function displayFirewallList(SymfonyStyle $io): void
125125

126126
$io->listing($this->firewallNames);
127127

128-
$io->comment(sprintf('To view details of a specific firewall, re-run this command with a firewall name. (e.g. <comment>debug:firewall %s</comment>)', $this->getExampleName()));
128+
$io->comment(\sprintf('To view details of a specific firewall, re-run this command with a firewall name. (e.g. <comment>debug:firewall %s</comment>)', $this->getExampleName()));
129129
}
130130

131131
protected function displayFirewallSummary(string $name, FirewallContext $context, SymfonyStyle $io): void
@@ -169,9 +169,9 @@ private function displaySwitchUser(FirewallContext $context, SymfonyStyle $io):
169169

170170
protected function displayEventListeners(string $name, FirewallContext $context, SymfonyStyle $io): void
171171
{
172-
$io->title(sprintf('Event listeners for firewall "%s"', $name));
172+
$io->title(\sprintf('Event listeners for firewall "%s"', $name));
173173

174-
$dispatcherId = sprintf('security.event_dispatcher.%s', $name);
174+
$dispatcherId = \sprintf('security.event_dispatcher.%s', $name);
175175

176176
if (!$this->eventDispatchers->has($dispatcherId)) {
177177
$io->text('No event dispatcher has been registered for this firewall.');
@@ -183,12 +183,12 @@ protected function displayEventListeners(string $name, FirewallContext $context,
183183
$dispatcher = $this->eventDispatchers->get($dispatcherId);
184184

185185
foreach ($dispatcher->getListeners() as $event => $listeners) {
186-
$io->section(sprintf('"%s" event', $event));
186+
$io->section(\sprintf('"%s" event', $event));
187187

188188
$rows = [];
189189
foreach ($listeners as $order => $listener) {
190190
$rows[] = [
191-
sprintf('#%d', $order + 1),
191+
\sprintf('#%d', $order + 1),
192192
$this->formatCallable($listener),
193193
$dispatcher->getListenerPriority($event, $listener),
194194
];
@@ -203,7 +203,7 @@ protected function displayEventListeners(string $name, FirewallContext $context,
203203

204204
private function displayAuthenticators(string $name, SymfonyStyle $io): void
205205
{
206-
$io->title(sprintf('Authenticators for firewall "%s"', $name));
206+
$io->title(\sprintf('Authenticators for firewall "%s"', $name));
207207

208208
$authenticators = $this->authenticators[$name] ?? [];
209209

@@ -226,14 +226,14 @@ private function formatCallable(mixed $callable): string
226226
{
227227
if (\is_array($callable)) {
228228
if (\is_object($callable[0])) {
229-
return sprintf('%s::%s()', $callable[0]::class, $callable[1]);
229+
return \sprintf('%s::%s()', $callable[0]::class, $callable[1]);
230230
}
231231

232-
return sprintf('%s::%s()', $callable[0], $callable[1]);
232+
return \sprintf('%s::%s()', $callable[0], $callable[1]);
233233
}
234234

235235
if (\is_string($callable)) {
236-
return sprintf('%s()', $callable);
236+
return \sprintf('%s()', $callable);
237237
}
238238

239239
if ($callable instanceof \Closure) {
@@ -242,14 +242,14 @@ private function formatCallable(mixed $callable): string
242242
return 'Closure()';
243243
}
244244
if ($class = \PHP_VERSION_ID >= 80111 ? $r->getClosureCalledClass() : $r->getClosureScopeClass()) {
245-
return sprintf('%s::%s()', $class->name, $r->name);
245+
return \sprintf('%s::%s()', $class->name, $r->name);
246246
}
247247

248248
return $r->name.'()';
249249
}
250250

251251
if (method_exists($callable, '__invoke')) {
252-
return sprintf('%s::__invoke()', $callable::class);
252+
return \sprintf('%s::__invoke()', $callable::class);
253253
}
254254

255255
throw new \InvalidArgumentException('Callable is not describable.');

DataCollector/SecurityDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public function collect(Request $request, Response $response, ?\Throwable $excep
187187
if ($this->data['impersonated'] && null !== $switchUserConfig = $firewallConfig->getSwitchUser()) {
188188
$exitPath = $request->getRequestUri();
189189
$exitPath .= null === $request->getQueryString() ? '?' : '&';
190-
$exitPath .= sprintf('%s=%s', urlencode($switchUserConfig['parameter']), SwitchUserListener::EXIT_VALUE);
190+
$exitPath .= \sprintf('%s=%s', urlencode($switchUserConfig['parameter']), SwitchUserListener::EXIT_VALUE);
191191

192192
$this->data['impersonation_exit_path'] = $exitPath;
193193
}

DependencyInjection/Compiler/AddSecurityVotersPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function process(ContainerBuilder $container)
5252
$class = $container->getParameterBag()->resolveValue($definition->getClass());
5353

5454
if (!is_a($class, VoterInterface::class, true)) {
55-
throw new LogicException(sprintf('"%s" must implement the "%s" when used as a voter.', $class, VoterInterface::class));
55+
throw new LogicException(\sprintf('"%s" must implement the "%s" when used as a voter.', $class, VoterInterface::class));
5656
}
5757

5858
if ($debug) {

DependencyInjection/Compiler/AddSessionDomainConstraintPass.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,18 @@ public function process(ContainerBuilder $container)
3131
}
3232

3333
$sessionOptions = $container->getParameter('session.storage.options');
34-
$domainRegexp = empty($sessionOptions['cookie_domain']) ? '%%s' : sprintf('(?:%%%%s|(?:.+\.)?%s)', preg_quote(trim($sessionOptions['cookie_domain'], '.')));
34+
$domainRegexp = empty($sessionOptions['cookie_domain']) ? '%%s' : \sprintf('(?:%%%%s|(?:.+\.)?%s)', preg_quote(trim($sessionOptions['cookie_domain'], '.')));
3535

3636
if ('auto' === ($sessionOptions['cookie_secure'] ?? null)) {
37-
$secureDomainRegexp = sprintf('{^https://%s$}i', $domainRegexp);
37+
$secureDomainRegexp = \sprintf('{^https://%s$}i', $domainRegexp);
3838
$domainRegexp = 'https?://'.$domainRegexp;
3939
} else {
4040
$secureDomainRegexp = null;
4141
$domainRegexp = (empty($sessionOptions['cookie_secure']) ? 'https?://' : 'https://').$domainRegexp;
4242
}
4343

4444
$container->findDefinition('security.http_utils')
45-
->addArgument(sprintf('{^%s$}i', $domainRegexp))
45+
->addArgument(\sprintf('{^%s$}i', $domainRegexp))
4646
->addArgument($secureDomainRegexp);
4747
}
4848
}

DependencyInjection/Compiler/RegisterEntryPointPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function process(ContainerBuilder $container)
7676
$entryPointNames[] = is_numeric($key) ? $serviceId : $key;
7777
}
7878

79-
throw new InvalidConfigurationException(sprintf('Because you have multiple authenticators in firewall "%s", you need to set the "entry_point" key to one of your authenticators ("%s") or a service ID implementing "%s". The "entry_point" determines what should happen (e.g. redirect to "/login") when an anonymous user tries to access a protected page.', $firewallName, implode('", "', $entryPointNames), AuthenticationEntryPointInterface::class));
79+
throw new InvalidConfigurationException(\sprintf('Because you have multiple authenticators in firewall "%s", you need to set the "entry_point" key to one of your authenticators ("%s") or a service ID implementing "%s". The "entry_point" determines what should happen (e.g. redirect to "/login") when an anonymous user tries to access a protected page.', $firewallName, implode('", "', $entryPointNames), AuthenticationEntryPointInterface::class));
8080
}
8181

8282
$config->replaceArgument(7, $entryPoint);

DependencyInjection/Compiler/ReplaceDecoratedRememberMeHandlerPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function process(ContainerBuilder $container): void
3838
// get the actual custom remember me handler definition (passed to the decorator)
3939
$realRememberMeHandler = $container->findDefinition((string) $definition->getArgument(0));
4040
if (null === $realRememberMeHandler) {
41-
throw new \LogicException(sprintf('Invalid service definition for custom remember me handler; no service found with ID "%s".', (string) $definition->getArgument(0)));
41+
throw new \LogicException(\sprintf('Invalid service definition for custom remember me handler; no service found with ID "%s".', (string) $definition->getArgument(0)));
4242
}
4343

4444
foreach ($rememberMeHandlerTags as $rememberMeHandlerTag) {

DependencyInjection/Compiler/SortFirewallListenersPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ private function getListenerPriorities(IteratorArgument $listeners, ContainerBui
6262
$class = $def->getClass();
6363

6464
if (!$r = $container->getReflectionClass($class)) {
65-
throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
65+
throw new InvalidArgumentException(\sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
6666
}
6767

6868
$priority = 0;

DependencyInjection/MainConfiguration.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ private function addFirewallsSection(ArrayNodeDefinition $rootNode, array $facto
194194
->scalarNode('pattern')
195195
->beforeNormalization()
196196
->ifArray()
197-
->then(fn ($v) => sprintf('(?:%s)', implode('|', $v)))
197+
->then(fn ($v) => \sprintf('(?:%s)', implode('|', $v)))
198198
->end()
199199
->end()
200200
->scalarNode('host')->end()
@@ -212,7 +212,7 @@ private function addFirewallsSection(ArrayNodeDefinition $rootNode, array $facto
212212
->scalarNode('access_denied_url')->end()
213213
->scalarNode('access_denied_handler')->end()
214214
->scalarNode('entry_point')
215-
->info(sprintf('An enabled authenticator name or a service id that implements "%s"', AuthenticationEntryPointInterface::class))
215+
->info(\sprintf('An enabled authenticator name or a service id that implements "%s"', AuthenticationEntryPointInterface::class))
216216
->end()
217217
->scalarNode('provider')->end()
218218
->booleanNode('stateless')->defaultFalse()->end()
@@ -313,7 +313,7 @@ private function addFirewallsSection(ArrayNodeDefinition $rootNode, array $facto
313313
}
314314
}
315315

316-
throw new InvalidConfigurationException(sprintf('Undefined security Badge class "%s" set in "security.firewall.required_badges".', $requiredBadge));
316+
throw new InvalidConfigurationException(\sprintf('Undefined security Badge class "%s" set in "security.firewall.required_badges".', $requiredBadge));
317317
}, $requiredBadges);
318318
})
319319
->end()
@@ -347,7 +347,7 @@ private function addFirewallsSection(ArrayNodeDefinition $rootNode, array $facto
347347
}
348348

349349
if (str_contains($firewall[$k]['check_path'], '/') && !preg_match('#'.$firewall['pattern'].'#', $firewall[$k]['check_path'])) {
350-
throw new \LogicException(sprintf('The check_path "%s" for login method "%s" is not matched by the firewall pattern "%s".', $firewall[$k]['check_path'], $k, $firewall['pattern']));
350+
throw new \LogicException(\sprintf('The check_path "%s" for login method "%s" is not matched by the firewall pattern "%s".', $firewall[$k]['check_path'], $k, $firewall['pattern']));
351351
}
352352
}
353353

DependencyInjection/Security/Factory/AccessTokenFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function createAuthenticator(ContainerBuilder $container, string $firewal
107107
{
108108
$successHandler = isset($config['success_handler']) ? new Reference($this->createAuthenticationSuccessHandler($container, $firewallName, $config)) : null;
109109
$failureHandler = isset($config['failure_handler']) ? new Reference($this->createAuthenticationFailureHandler($container, $firewallName, $config)) : null;
110-
$authenticatorId = sprintf('security.authenticator.access_token.%s', $firewallName);
110+
$authenticatorId = \sprintf('security.authenticator.access_token.%s', $firewallName);
111111
$extractorId = $this->createExtractor($container, $firewallName, $config['token_extractors']);
112112
$tokenHandlerId = $this->createTokenHandler($container, $firewallName, $config['token_handler'], $userProviderId);
113113

@@ -139,7 +139,7 @@ private function createExtractor(ContainerBuilder $container, string $firewallNa
139139
if (1 === \count($extractors)) {
140140
return current($extractors);
141141
}
142-
$extractorId = sprintf('security.authenticator.access_token.chain_extractor.%s', $firewallName);
142+
$extractorId = \sprintf('security.authenticator.access_token.chain_extractor.%s', $firewallName);
143143
$container
144144
->setDefinition($extractorId, new ChildDefinition('security.authenticator.access_token.chain_extractor'))
145145
->replaceArgument(0, array_map(fn (string $extractorId): Reference => new Reference($extractorId), $extractors))
@@ -151,7 +151,7 @@ private function createExtractor(ContainerBuilder $container, string $firewallNa
151151
private function createTokenHandler(ContainerBuilder $container, string $firewallName, array $config, ?string $userProviderId): string
152152
{
153153
$key = array_keys($config)[0];
154-
$id = sprintf('security.access_token_handler.%s', $firewallName);
154+
$id = \sprintf('security.access_token_handler.%s', $firewallName);
155155

156156
foreach ($this->tokenHandlerFactories as $factory) {
157157
if ($key !== $factory->getKey()) {

DependencyInjection/Security/Factory/LoginLinkFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ public function addConfiguration(NodeDefinition $node): void
6161
->info('Cache service id used to expired links of max_uses is set.')
6262
->end()
6363
->scalarNode('success_handler')
64-
->info(sprintf('A service id that implements %s.', AuthenticationSuccessHandlerInterface::class))
64+
->info(\sprintf('A service id that implements %s.', AuthenticationSuccessHandlerInterface::class))
6565
->end()
6666
->scalarNode('failure_handler')
67-
->info(sprintf('A service id that implements %s.', AuthenticationFailureHandlerInterface::class))
67+
->info(\sprintf('A service id that implements %s.', AuthenticationFailureHandlerInterface::class))
6868
->end()
6969
->scalarNode('provider')
7070
->info('The user provider to load users from.')

0 commit comments

Comments
 (0)