Skip to content

Commit a2452d7

Browse files
deguiffabpot
authored andcommitted
Replace get_class() calls by ::class
1 parent 5f1c360 commit a2452d7

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

Command/DebugFirewallCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ private function displayAuthenticators(string $name, SymfonyStyle $io): void
218218
array_map(
219219
static function ($authenticator) {
220220
return [
221-
\get_class($authenticator),
221+
$authenticator::class,
222222
];
223223
},
224224
$authenticators
@@ -253,7 +253,7 @@ private function formatCallable(mixed $callable): string
253253
}
254254

255255
if (method_exists($callable, '__invoke')) {
256-
return sprintf('%s::__invoke()', \get_class($callable));
256+
return sprintf('%s::__invoke()', $callable::class);
257257
}
258258

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

DataCollector/SecurityDataCollector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function collect(Request $request, Response $response, \Throwable $except
119119
'impersonator_user' => $impersonatorUser,
120120
'impersonation_exit_path' => null,
121121
'token' => $token,
122-
'token_class' => $this->hasVarDumper ? new ClassStub(\get_class($token)) : \get_class($token),
122+
'token_class' => $this->hasVarDumper ? new ClassStub($token::class) : $token::class,
123123
'logout_url' => $logoutUrl,
124124
'user' => $token->getUserIdentifier(),
125125
'roles' => $assignedRoles,
@@ -137,7 +137,7 @@ public function collect(Request $request, Response $response, \Throwable $except
137137
$voter = $voter->getDecoratedVoter();
138138
}
139139

140-
$this->data['voters'][] = $this->hasVarDumper ? new ClassStub(\get_class($voter)) : \get_class($voter);
140+
$this->data['voters'][] = $this->hasVarDumper ? new ClassStub($voter::class) : $voter::class;
141141
}
142142

143143
// collect voter details

Tests/DataCollector/SecurityDataCollectorTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -239,14 +239,14 @@ public function providerCollectDecisionLog(): \Generator
239239
],
240240
]],
241241
[$decoratedVoter1, $decoratedVoter1],
242-
[\get_class($voter1), \get_class($voter2)],
242+
[$voter1::class, $voter2::class],
243243
[[
244244
'attributes' => ['view'],
245245
'object' => new \stdClass(),
246246
'result' => true,
247247
'voter_details' => [
248-
['class' => \get_class($voter1), 'attributes' => ['view'], 'vote' => VoterInterface::ACCESS_ABSTAIN],
249-
['class' => \get_class($voter2), 'attributes' => ['view'], 'vote' => VoterInterface::ACCESS_ABSTAIN],
248+
['class' => $voter1::class, 'attributes' => ['view'], 'vote' => VoterInterface::ACCESS_ABSTAIN],
249+
['class' => $voter2::class, 'attributes' => ['view'], 'vote' => VoterInterface::ACCESS_ABSTAIN],
250250
],
251251
]],
252252
];
@@ -276,26 +276,26 @@ public function providerCollectDecisionLog(): \Generator
276276
],
277277
],
278278
[$decoratedVoter1, $decoratedVoter1],
279-
[\get_class($voter1), \get_class($voter2)],
279+
[$voter1::class, $voter2::class],
280280
[
281281
[
282282
'attributes' => ['view', 'edit'],
283283
'object' => new \stdClass(),
284284
'result' => false,
285285
'voter_details' => [
286-
['class' => \get_class($voter1), 'attributes' => ['view'], 'vote' => VoterInterface::ACCESS_DENIED],
287-
['class' => \get_class($voter1), 'attributes' => ['edit'], 'vote' => VoterInterface::ACCESS_DENIED],
288-
['class' => \get_class($voter2), 'attributes' => ['view'], 'vote' => VoterInterface::ACCESS_GRANTED],
289-
['class' => \get_class($voter2), 'attributes' => ['edit'], 'vote' => VoterInterface::ACCESS_GRANTED],
286+
['class' => $voter1::class, 'attributes' => ['view'], 'vote' => VoterInterface::ACCESS_DENIED],
287+
['class' => $voter1::class, 'attributes' => ['edit'], 'vote' => VoterInterface::ACCESS_DENIED],
288+
['class' => $voter2::class, 'attributes' => ['view'], 'vote' => VoterInterface::ACCESS_GRANTED],
289+
['class' => $voter2::class, 'attributes' => ['edit'], 'vote' => VoterInterface::ACCESS_GRANTED],
290290
],
291291
],
292292
[
293293
'attributes' => ['update'],
294294
'object' => new \stdClass(),
295295
'result' => true,
296296
'voter_details' => [
297-
['class' => \get_class($voter1), 'attributes' => ['update'], 'vote' => VoterInterface::ACCESS_GRANTED],
298-
['class' => \get_class($voter2), 'attributes' => ['update'], 'vote' => VoterInterface::ACCESS_GRANTED],
297+
['class' => $voter1::class, 'attributes' => ['update'], 'vote' => VoterInterface::ACCESS_GRANTED],
298+
['class' => $voter2::class, 'attributes' => ['update'], 'vote' => VoterInterface::ACCESS_GRANTED],
299299
],
300300
],
301301
],

Tests/Functional/Bundle/RememberMeBundle/Security/StaticTokenProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ class StaticTokenProvider implements TokenProviderInterface
2323
public function __construct($kernel)
2424
{
2525
// only reset the "internal db" for new tests
26-
if (self::$kernelClass !== \get_class($kernel)) {
27-
self::$kernelClass = \get_class($kernel);
26+
if (self::$kernelClass !== $kernel::class) {
27+
self::$kernelClass = $kernel::class;
2828
self::$db = [];
2929
}
3030
}

Tests/Functional/Bundle/SecuredPageBundle/Security/Core/User/ArrayUserProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function refreshUser(UserInterface $user): UserInterface
6464
}
6565

6666
$storedUser = $this->getUser($user->getUserIdentifier());
67-
$class = \get_class($storedUser);
67+
$class = $storedUser::class;
6868

6969
return new $class($storedUser->getUserIdentifier(), $storedUser->getPassword(), $storedUser->getRoles(), $storedUser->isEnabled());
7070
}

0 commit comments

Comments
 (0)