Skip to content

Commit 8ff659f

Browse files
CS fixes
1 parent 527780a commit 8ff659f

15 files changed

+22
-22
lines changed

Authentication/Token/AbstractToken.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function hasAttribute(string $name): bool
134134
public function getAttribute(string $name): mixed
135135
{
136136
if (!\array_key_exists($name, $this->attributes)) {
137-
throw new \InvalidArgumentException(sprintf('This token has no "%s" attribute.', $name));
137+
throw new \InvalidArgumentException(\sprintf('This token has no "%s" attribute.', $name));
138138
}
139139

140140
return $this->attributes[$name];
@@ -158,7 +158,7 @@ public function __toString(): string
158158
$roles[] = $role;
159159
}
160160

161-
return sprintf('%s(user="%s", roles="%s")', $class, $this->getUserIdentifier(), implode(', ', $roles));
161+
return \sprintf('%s(user="%s", roles="%s")', $class, $this->getUserIdentifier(), implode(', ', $roles));
162162
}
163163

164164
/**

Authorization/AccessDecisionManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function decide(TokenInterface $token, array $attributes, mixed $object =
5353
{
5454
// Special case for AccessListener, do not remove the right side of the condition before 6.0
5555
if (\count($attributes) > 1 && !$allowMultipleAttributes) {
56-
throw new InvalidArgumentException(sprintf('Passing more than one Security attribute to "%s()" is not supported.', __METHOD__));
56+
throw new InvalidArgumentException(\sprintf('Passing more than one Security attribute to "%s()" is not supported.', __METHOD__));
5757
}
5858

5959
return $this->strategy->decide(
@@ -69,7 +69,7 @@ private function collectResults(TokenInterface $token, array $attributes, mixed
6969
foreach ($this->getVoters($attributes, $object) as $voter) {
7070
$result = $voter->vote($token, $object, $attributes);
7171
if (!\is_int($result) || !(self::VALID_VOTES[$result] ?? false)) {
72-
throw new \LogicException(sprintf('"%s::vote()" must return one of "%s" constants ("ACCESS_GRANTED", "ACCESS_DENIED" or "ACCESS_ABSTAIN"), "%s" returned.', get_debug_type($voter), VoterInterface::class, var_export($result, true)));
72+
throw new \LogicException(\sprintf('"%s::vote()" must return one of "%s" constants ("ACCESS_GRANTED", "ACCESS_DENIED" or "ACCESS_ABSTAIN"), "%s" returned.', get_debug_type($voter), VoterInterface::class, var_export($result, true)));
7373
}
7474

7575
yield $result;

Authorization/AuthorizationChecker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class AuthorizationChecker implements AuthorizationCheckerInterface
3030
public function __construct(TokenStorageInterface $tokenStorage, AccessDecisionManagerInterface $accessDecisionManager, bool $exceptionOnNoToken = false)
3131
{
3232
if ($exceptionOnNoToken) {
33-
throw new \LogicException(sprintf('Argument $exceptionOnNoToken of "%s()" must be set to "false".', __METHOD__));
33+
throw new \LogicException(\sprintf('Argument $exceptionOnNoToken of "%s()" must be set to "false".', __METHOD__));
3434
}
3535

3636
$this->tokenStorage = $tokenStorage;

Authorization/ExpressionLanguage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Symfony\Component\ExpressionLanguage\ExpressionLanguage as BaseExpressionLanguage;
1616

1717
if (!class_exists(BaseExpressionLanguage::class)) {
18-
throw new \LogicException(sprintf('The "%s" class requires the "ExpressionLanguage" component. Try running "composer require symfony/expression-language".', ExpressionLanguage::class));
18+
throw new \LogicException(\sprintf('The "%s" class requires the "ExpressionLanguage" component. Try running "composer require symfony/expression-language".', ExpressionLanguage::class));
1919
} else {
2020
// Help opcache.preload discover always-needed symbols
2121
class_exists(ExpressionLanguageProvider::class);

Authorization/ExpressionLanguageProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function getFunctions(): array
2828

2929
new ExpressionFunction('is_fully_authenticated', fn () => '$token && $auth_checker->isGranted("IS_AUTHENTICATED_FULLY")', fn (array $variables) => $variables['token'] && $variables['auth_checker']->isGranted('IS_AUTHENTICATED_FULLY')),
3030

31-
new ExpressionFunction('is_granted', fn ($attributes, $object = 'null') => sprintf('$auth_checker->isGranted(%s, %s)', $attributes, $object), fn (array $variables, $attributes, $object = null) => $variables['auth_checker']->isGranted($attributes, $object)),
31+
new ExpressionFunction('is_granted', fn ($attributes, $object = 'null') => \sprintf('$auth_checker->isGranted(%s, %s)', $attributes, $object), fn (array $variables, $attributes, $object = null) => $variables['auth_checker']->isGranted($attributes, $object)),
3232

3333
new ExpressionFunction('is_remember_me', fn () => '$token && $auth_checker->isGranted("IS_REMEMBERED")', fn (array $variables) => $variables['token'] && $variables['auth_checker']->isGranted('IS_REMEMBERED')),
3434
];

Signature/SignatureHasher.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function verifySignatureHash(UserInterface $user, int $expires, string $h
9494

9595
if ($this->expiredSignaturesStorage && $this->maxUses) {
9696
if ($this->expiredSignaturesStorage->countUsages($hash) >= $this->maxUses) {
97-
throw new ExpiredSignatureException(sprintf('Signature can only be used "%d" times.', $this->maxUses));
97+
throw new ExpiredSignatureException(\sprintf('Signature can only be used "%d" times.', $this->maxUses));
9898
}
9999

100100
$this->expiredSignaturesStorage->incrementUsages($hash);
@@ -118,7 +118,7 @@ public function computeSignatureHash(UserInterface $user, int $expires): string
118118
}
119119

120120
if (!\is_scalar($value) && !$value instanceof \Stringable) {
121-
throw new \InvalidArgumentException(sprintf('The property path "%s" on the user object "%s" must return a value that can be cast to a string, but "%s" was returned.', $property, $user::class, get_debug_type($value)));
121+
throw new \InvalidArgumentException(\sprintf('The property path "%s" on the user object "%s" must return a value that can be cast to a string, but "%s" was returned.', $property, $user::class, get_debug_type($value)));
122122
}
123123
hash_update($fieldsHash, ':'.base64_encode($value));
124124
}

Tests/Authorization/AccessDecisionManagerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function testVoterCalls()
3939
$this->getUnexpectedVoter(),
4040
];
4141

42-
$strategy = new class() implements AccessDecisionStrategyInterface {
42+
$strategy = new class implements AccessDecisionStrategyInterface {
4343
public function decide(\Traversable $results): bool
4444
{
4545
$i = 0;

Tests/Authorization/Voter/AuthenticatedVoterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ protected function getToken($authenticated)
9090
$user = new InMemoryUser('wouter', '', ['ROLE_USER']);
9191

9292
if ('fully' === $authenticated) {
93-
$token = new class() extends AbstractToken {
93+
$token = new class extends AbstractToken {
9494
public function getCredentials()
9595
{
9696
}

Tests/Authorization/Voter/VoterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static function getTests(): array
4141

4242
[$voter, ['DELETE'], VoterInterface::ACCESS_ABSTAIN, new \stdClass(), 'ACCESS_ABSTAIN if no attribute is supported'],
4343

44-
[$voter, ['EDIT'], VoterInterface::ACCESS_ABSTAIN, new class() {}, 'ACCESS_ABSTAIN if class is not supported'],
44+
[$voter, ['EDIT'], VoterInterface::ACCESS_ABSTAIN, new class {}, 'ACCESS_ABSTAIN if class is not supported'],
4545

4646
[$voter, ['EDIT'], VoterInterface::ACCESS_ABSTAIN, null, 'ACCESS_ABSTAIN if object is null'],
4747

Tests/Resources/TranslationFilesTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function testTranslationFileIsValid($filePath)
2626

2727
$errors = XliffUtils::validateSchema($document);
2828

29-
$this->assertCount(0, $errors, sprintf('"%s" is invalid:%s', $filePath, \PHP_EOL.implode(\PHP_EOL, array_column($errors, 'message'))));
29+
$this->assertCount(0, $errors, \sprintf('"%s" is invalid:%s', $filePath, \PHP_EOL.implode(\PHP_EOL, array_column($errors, 'message'))));
3030
}
3131

3232
/**
@@ -39,7 +39,7 @@ public function testTranslationFileIsValidWithoutEntityLoader($filePath)
3939

4040
$errors = XliffUtils::validateSchema($document);
4141

42-
$this->assertCount(0, $errors, sprintf('"%s" is invalid:%s', $filePath, \PHP_EOL.implode(\PHP_EOL, array_column($errors, 'message'))));
42+
$this->assertCount(0, $errors, \sprintf('"%s" is invalid:%s', $filePath, \PHP_EOL.implode(\PHP_EOL, array_column($errors, 'message'))));
4343
}
4444

4545
public static function provideTranslationFiles()

0 commit comments

Comments
 (0)