Skip to content

Commit 8ace9c9

Browse files
Merge branch '4.0' into 4.1
* 4.0: Fix Clidumper tests Enable the fixer enforcing fully-qualified calls for compiler-optimized functions Apply fixers Disable the native_constant_invocation fixer until it can be scoped Update the list of excluded files for the CS fixer
2 parents 30d31b4 + d686eb7 commit 8ace9c9

11 files changed

+29
-29
lines changed

Authentication/SimpleAuthenticationHandler.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function onAuthenticationSuccess(Request $request, TokenInterface $token)
5555
{
5656
if ($this->simpleAuthenticator instanceof AuthenticationSuccessHandlerInterface) {
5757
if ($this->logger) {
58-
$this->logger->debug('Selected an authentication success handler.', array('handler' => get_class($this->simpleAuthenticator)));
58+
$this->logger->debug('Selected an authentication success handler.', array('handler' => \get_class($this->simpleAuthenticator)));
5959
}
6060

6161
$response = $this->simpleAuthenticator->onAuthenticationSuccess($request, $token);
@@ -64,7 +64,7 @@ public function onAuthenticationSuccess(Request $request, TokenInterface $token)
6464
}
6565

6666
if (null !== $response) {
67-
throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationSuccess method must return null to use the default success handler, or a Response object', get_class($this->simpleAuthenticator)));
67+
throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationSuccess method must return null to use the default success handler, or a Response object', \get_class($this->simpleAuthenticator)));
6868
}
6969
}
7070

@@ -82,7 +82,7 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio
8282
{
8383
if ($this->simpleAuthenticator instanceof AuthenticationFailureHandlerInterface) {
8484
if ($this->logger) {
85-
$this->logger->debug('Selected an authentication failure handler.', array('handler' => get_class($this->simpleAuthenticator)));
85+
$this->logger->debug('Selected an authentication failure handler.', array('handler' => \get_class($this->simpleAuthenticator)));
8686
}
8787

8888
$response = $this->simpleAuthenticator->onAuthenticationFailure($request, $exception);
@@ -91,7 +91,7 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio
9191
}
9292

9393
if (null !== $response) {
94-
throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationFailure method must return null to use the default failure handler, or a Response object', get_class($this->simpleAuthenticator)));
94+
throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationFailure method must return null to use the default failure handler, or a Response object', \get_class($this->simpleAuthenticator)));
9595
}
9696
}
9797

Firewall/ContextListener.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function handle(GetResponseEvent $event)
9797
if (null !== $this->logger) {
9898
$this->logger->debug('Read existing security token from the session.', array(
9999
'key' => $this->sessionKey,
100-
'token_class' => is_object($token) ? get_class($token) : null,
100+
'token_class' => \is_object($token) ? \get_class($token) : null,
101101
));
102102
}
103103

@@ -164,7 +164,7 @@ protected function refreshUser(TokenInterface $token)
164164

165165
foreach ($this->userProviders as $provider) {
166166
if (!$provider instanceof UserProviderInterface) {
167-
throw new \InvalidArgumentException(sprintf('User provider "%s" must implement "%s".', get_class($provider), UserProviderInterface::class));
167+
throw new \InvalidArgumentException(sprintf('User provider "%s" must implement "%s".', \get_class($provider), UserProviderInterface::class));
168168
}
169169

170170
try {
@@ -174,14 +174,14 @@ protected function refreshUser(TokenInterface $token)
174174
// tokens can be deauthenticated if the user has been changed.
175175
if (!$token->isAuthenticated()) {
176176
if (null !== $this->logger) {
177-
$this->logger->debug('Token was deauthenticated after trying to refresh it.', array('username' => $refreshedUser->getUsername(), 'provider' => get_class($provider)));
177+
$this->logger->debug('Token was deauthenticated after trying to refresh it.', array('username' => $refreshedUser->getUsername(), 'provider' => \get_class($provider)));
178178
}
179179

180180
return null;
181181
}
182182

183183
if (null !== $this->logger) {
184-
$context = array('provider' => get_class($provider), 'username' => $refreshedUser->getUsername());
184+
$context = array('provider' => \get_class($provider), 'username' => $refreshedUser->getUsername());
185185

186186
foreach ($token->getRoles() as $role) {
187187
if ($role instanceof SwitchUserRole) {
@@ -198,7 +198,7 @@ protected function refreshUser(TokenInterface $token)
198198
// let's try the next user provider
199199
} catch (UsernameNotFoundException $e) {
200200
if (null !== $this->logger) {
201-
$this->logger->warning('Username could not be found in the selected user provider.', array('username' => $e->getUsername(), 'provider' => get_class($provider)));
201+
$this->logger->warning('Username could not be found in the selected user provider.', array('username' => $e->getUsername(), 'provider' => \get_class($provider)));
202202
}
203203

204204
$userNotFoundByProvider = true;
@@ -209,7 +209,7 @@ protected function refreshUser(TokenInterface $token)
209209
return null;
210210
}
211211

212-
throw new \RuntimeException(sprintf('There is no user provider for user "%s".', get_class($user)));
212+
throw new \RuntimeException(sprintf('There is no user provider for user "%s".', \get_class($user)));
213213
}
214214

215215
private function safelyUnserialize($serializedToken)

Firewall/ExceptionListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ private function startAuthentication(Request $request, AuthenticationException $
194194
$response = $this->authenticationEntryPoint->start($request, $authException);
195195

196196
if (!$response instanceof Response) {
197-
$given = is_object($response) ? get_class($response) : gettype($response);
197+
$given = \is_object($response) ? \get_class($response) : \gettype($response);
198198

199-
throw new \LogicException(sprintf('The %s::start() method must return a Response object (%s returned)', get_class($this->authenticationEntryPoint), $given));
199+
throw new \LogicException(sprintf('The %s::start() method must return a Response object (%s returned)', \get_class($this->authenticationEntryPoint), $given));
200200
}
201201

202202
return $response;

Firewall/SimplePreAuthenticationListener.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function handle(GetResponseEvent $event)
7575
$request = $event->getRequest();
7676

7777
if (null !== $this->logger) {
78-
$this->logger->info('Attempting SimplePreAuthentication.', array('key' => $this->providerKey, 'authenticator' => get_class($this->simpleAuthenticator)));
78+
$this->logger->info('Attempting SimplePreAuthentication.', array('key' => $this->providerKey, 'authenticator' => \get_class($this->simpleAuthenticator)));
7979
}
8080

8181
if (null !== $this->tokenStorage->getToken() && !$this->tokenStorage->getToken() instanceof AnonymousToken) {
@@ -104,15 +104,15 @@ public function handle(GetResponseEvent $event)
104104
$this->tokenStorage->setToken(null);
105105

106106
if (null !== $this->logger) {
107-
$this->logger->info('SimplePreAuthentication request failed.', array('exception' => $e, 'authenticator' => get_class($this->simpleAuthenticator)));
107+
$this->logger->info('SimplePreAuthentication request failed.', array('exception' => $e, 'authenticator' => \get_class($this->simpleAuthenticator)));
108108
}
109109

110110
if ($this->simpleAuthenticator instanceof AuthenticationFailureHandlerInterface) {
111111
$response = $this->simpleAuthenticator->onAuthenticationFailure($request, $e);
112112
if ($response instanceof Response) {
113113
$event->setResponse($response);
114114
} elseif (null !== $response) {
115-
throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationFailure method must return null or a Response object', get_class($this->simpleAuthenticator)));
115+
throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationFailure method must return null or a Response object', \get_class($this->simpleAuthenticator)));
116116
}
117117
}
118118

@@ -124,7 +124,7 @@ public function handle(GetResponseEvent $event)
124124
if ($response instanceof Response) {
125125
$event->setResponse($response);
126126
} elseif (null !== $response) {
127-
throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationSuccess method must return null or a Response object', get_class($this->simpleAuthenticator)));
127+
throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationSuccess method must return null or a Response object', \get_class($this->simpleAuthenticator)));
128128
}
129129
}
130130
}

Firewall/UsernamePasswordFormAuthenticationListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ protected function attemptAuthentication(Request $request)
9191

9292
$username = trim($username);
9393

94-
if (strlen($username) > Security::MAX_USERNAME_LENGTH) {
94+
if (\strlen($username) > Security::MAX_USERNAME_LENGTH) {
9595
throw new BadCredentialsException('Invalid username.');
9696
}
9797

Firewall/UsernamePasswordJsonAuthenticationListener.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@ public function handle(GetResponseEvent $event)
104104
throw new BadRequestHttpException(sprintf('The key "%s" must be provided.', $this->options['password_path']), $e);
105105
}
106106

107-
if (!is_string($username)) {
107+
if (!\is_string($username)) {
108108
throw new BadRequestHttpException(sprintf('The key "%s" must be a string.', $this->options['username_path']));
109109
}
110110

111-
if (strlen($username) > Security::MAX_USERNAME_LENGTH) {
111+
if (\strlen($username) > Security::MAX_USERNAME_LENGTH) {
112112
throw new BadCredentialsException('Invalid username.');
113113
}
114114

115-
if (!is_string($password)) {
115+
if (!\is_string($password)) {
116116
throw new BadRequestHttpException(sprintf('The key "%s" must be a string.', $this->options['password_path']));
117117
}
118118

RememberMe/AbstractRememberMeServices.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function __construct(array $userProviders, string $secret, string $provid
5454
if (empty($providerKey)) {
5555
throw new \InvalidArgumentException('$providerKey must not be empty.');
5656
}
57-
if (0 === count($userProviders)) {
57+
if (0 === \count($userProviders)) {
5858
throw new \InvalidArgumentException('You must provide at least one user provider.');
5959
}
6060

RememberMe/PersistentTokenBasedRememberMeServices.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ protected function cancelCookie(Request $request)
4747

4848
// Delete cookie from the tokenProvider
4949
if (null !== ($cookie = $request->cookies->get($this->options['name']))
50-
&& 2 === count($parts = $this->decodeCookie($cookie))
50+
&& 2 === \count($parts = $this->decodeCookie($cookie))
5151
) {
5252
list($series) = $parts;
5353
$this->tokenProvider->deleteTokenBySeries($series);
@@ -59,7 +59,7 @@ protected function cancelCookie(Request $request)
5959
*/
6060
protected function processAutoLoginCookie(array $cookieParts, Request $request)
6161
{
62-
if (2 !== count($cookieParts)) {
62+
if (2 !== \count($cookieParts)) {
6363
throw new AuthenticationException('The cookie is invalid.');
6464
}
6565

@@ -101,7 +101,7 @@ protected function onLoginSuccess(Request $request, Response $response, TokenInt
101101

102102
$this->tokenProvider->createNewToken(
103103
new PersistentToken(
104-
get_class($user = $token->getUser()),
104+
\get_class($user = $token->getUser()),
105105
$user->getUsername(),
106106
$series,
107107
$tokenValue,

RememberMe/TokenBasedRememberMeServices.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class TokenBasedRememberMeServices extends AbstractRememberMeServices
3131
*/
3232
protected function processAutoLoginCookie(array $cookieParts, Request $request)
3333
{
34-
if (4 !== count($cookieParts)) {
34+
if (4 !== \count($cookieParts)) {
3535
throw new AuthenticationException('The cookie is invalid.');
3636
}
3737

@@ -50,7 +50,7 @@ protected function processAutoLoginCookie(array $cookieParts, Request $request)
5050
}
5151

5252
if (!$user instanceof UserInterface) {
53-
throw new \RuntimeException(sprintf('The UserProviderInterface implementation must return an instance of UserInterface, but returned "%s".', get_class($user)));
53+
throw new \RuntimeException(sprintf('The UserProviderInterface implementation must return an instance of UserInterface, but returned "%s".', \get_class($user)));
5454
}
5555

5656
if (true !== hash_equals($this->generateCookieHash($class, $username, $expires, $user->getPassword()), $hash)) {
@@ -71,7 +71,7 @@ protected function onLoginSuccess(Request $request, Response $response, TokenInt
7171
{
7272
$user = $token->getUser();
7373
$expires = time() + $this->options['lifetime'];
74-
$value = $this->generateCookieValue(get_class($user), $user->getUsername(), $expires, $user->getPassword());
74+
$value = $this->generateCookieValue(\get_class($user), $user->getUsername(), $expires, $user->getPassword());
7575

7676
$response->headers->setCookie(
7777
new Cookie(

Tests/Controller/UserValueResolverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function testResolveNoUser()
4040
$tokenStorage->setToken($token);
4141

4242
$resolver = new UserValueResolver($tokenStorage);
43-
$metadata = new ArgumentMetadata('foo', get_class($mock), false, false, null);
43+
$metadata = new ArgumentMetadata('foo', \get_class($mock), false, false, null);
4444

4545
$this->assertFalse($resolver->supports(Request::create('/'), $metadata));
4646
}

0 commit comments

Comments
 (0)