Skip to content
This repository was archived by the owner on Dec 2, 2021. It is now read-only.

Commit 134b247

Browse files
committed
Enable php-cs-fixer native_function_invocation
1 parent f3c4cf6 commit 134b247

File tree

14 files changed

+17
-16
lines changed

14 files changed

+17
-16
lines changed

.php_cs.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
$rules = [
44
'@Symfony' => true,
5+
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced'],
56
];
67

78
$finder = PhpCsFixer\Finder::create()

Controller/FormController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ protected function getTemplateVars(Request $request, TwoFactorTokenInterface $to
9696
{
9797
$config = $this->twoFactorFirewallContext->getFirewallConfig($token->getProviderKey());
9898
$pendingTwoFactorProviders = $token->getTwoFactorProviders();
99-
$displayTrustedOption = $this->trustedFeatureEnabled && (!$config->isMultiFactor() || 1 === count($pendingTwoFactorProviders));
99+
$displayTrustedOption = $this->trustedFeatureEnabled && (!$config->isMultiFactor() || 1 === \count($pendingTwoFactorProviders));
100100
$authenticationException = $this->getLastAuthenticationException($request->getSession());
101101
$checkPath = $config->getCheckPath();
102102
$isRoute = false === strpos($checkPath, '/');

DependencyInjection/Compiler/RememberMeServicesDecoratorCompilerPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class RememberMeServicesDecoratorCompilerPass implements CompilerPassInterface
2121
public function process(ContainerBuilder $container)
2222
{
2323
// Find all remember-me listener definitions
24-
$prefixLength = strlen(self::REMEMBER_ME_LISTENER_ID_PREFIX);
24+
$prefixLength = \strlen(self::REMEMBER_ME_LISTENER_ID_PREFIX);
2525
foreach ($container->getDefinitions() as $definitionId => $definition) {
2626
if (self::REMEMBER_ME_LISTENER_ID_PREFIX === substr($definitionId, 0, $prefixLength)) {
2727
$this->decorateRememberMeServices($container, $definition);

Model/Totp/TotpConfiguration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function __construct(string $secret, string $algorithm, int $period, int
5151

5252
private static function isValidAlgorithm(string $algorithm): bool
5353
{
54-
return in_array(
54+
return \in_array(
5555
$algorithm,
5656
[
5757
self::ALGORITHM_MD5,

Security/Authentication/Provider/AuthenticationProviderDecorator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function authenticate(TokenInterface $token)
8181
$request = $this->requestStack->getMasterRequest();
8282
$firewallConfig = $this->firewallMap->getFirewallConfig($request);
8383

84-
if (!in_array(TwoFactorFactory::AUTHENTICATION_PROVIDER_KEY, $firewallConfig->getListeners())) {
84+
if (!\in_array(TwoFactorFactory::AUTHENTICATION_PROVIDER_KEY, $firewallConfig->getListeners())) {
8585
return $token; // This firewall doesn't support two-factor authentication
8686
}
8787

Security/Authentication/Token/TwoFactorToken.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ private function removeTwoFactorProvider(string $providerName): void
115115

116116
public function allTwoFactorProvidersAuthenticated(): bool
117117
{
118-
return 0 === count($this->twoFactorProviders);
118+
return 0 === \count($this->twoFactorProviders);
119119
}
120120

121121
public function getProviderKey(): string
@@ -167,12 +167,12 @@ public function setAttributes(array $attributes)
167167

168168
public function hasAttribute($name)
169169
{
170-
return array_key_exists($name, $this->attributes);
170+
return \array_key_exists($name, $this->attributes);
171171
}
172172

173173
public function getAttribute($name)
174174
{
175-
if (!array_key_exists($name, $this->attributes)) {
175+
if (!\array_key_exists($name, $this->attributes)) {
176176
throw new \InvalidArgumentException(sprintf('This token has no "%s" attribute.', $name));
177177
}
178178

Security/Authorization/TwoFactorAccessDecider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ public function isAccessible(Request $request, TokenInterface $token): bool
6565
private function makeRelativeToBaseUrl(string $logoutPath, Request $request): string
6666
{
6767
$baseUrl = $request->getBaseUrl();
68-
if (null === $baseUrl || 0 === strlen($baseUrl)) {
68+
if (null === $baseUrl || 0 === \strlen($baseUrl)) {
6969
return $logoutPath;
7070
}
7171

72-
$pathInfo = substr($logoutPath, strlen($baseUrl));
72+
$pathInfo = substr($logoutPath, \strlen($baseUrl));
7373
if (false === $pathInfo || '' === $pathInfo) {
7474
return '/';
7575
}

Security/TwoFactor/AuthenticationContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function getToken(): TokenInterface
3939

4040
public function getUser()
4141
{
42-
if (is_object($user = $this->token->getUser())) {
42+
if (\is_object($user = $this->token->getUser())) {
4343
return $user;
4444
}
4545

Security/TwoFactor/Handler/AuthenticatedTokenHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ public function beginTwoFactorAuthentication(AuthenticationContextInterface $con
3939

4040
private function isTwoFactorAuthenticationEnabledForToken(TokenInterface $token): bool
4141
{
42-
return in_array(get_class($token), $this->supportedTokens);
42+
return \in_array(\get_class($token), $this->supportedTokens);
4343
}
4444
}

Security/TwoFactor/Provider/TwoFactorProviderPreparationRecorder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function isProviderPrepared(string $firewallName, string $providerName):
2525
$calledProviders = $this->session->get(self::CALLED_PROVIDERS_SESSION_KEY, []);
2626
$firewallCalledProviders = $calledProviders[$firewallName] ?? [];
2727

28-
return in_array($providerName, $firewallCalledProviders, true);
28+
return \in_array($providerName, $firewallCalledProviders, true);
2929
}
3030

3131
public function recordProviderIsPrepared(string $firewallName, string $providerName): void

0 commit comments

Comments
 (0)