Skip to content

Commit a49d799

Browse files
committed
Merge branch '3.4' into 4.4
* 3.4: Fix quotes in exception messages
2 parents 94ae6e0 + baab66b commit a49d799

7 files changed

+10
-10
lines changed

Authentication/SimpleAuthenticationHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function onAuthenticationSuccess(Request $request, TokenInterface $token)
6262
}
6363

6464
if (null !== $response) {
65-
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)));
65+
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)));
6666
}
6767
}
6868

@@ -89,7 +89,7 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio
8989
}
9090

9191
if (null !== $response) {
92-
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)));
92+
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)));
9393
}
9494
}
9595

Firewall/ExceptionListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ private function startAuthentication(Request $request, AuthenticationException $
216216
if (!$response instanceof Response) {
217217
$given = \is_object($response) ? \get_class($response) : \gettype($response);
218218

219-
throw new \LogicException(sprintf('The %s::start() method must return a Response object (%s returned).', \get_class($this->authenticationEntryPoint), $given));
219+
throw new \LogicException(sprintf('The "%s::start()" method must return a Response object ("%s" returned).', \get_class($this->authenticationEntryPoint), $given));
220220
}
221221

222222
return $response;

Firewall/RemoteUserAuthenticationListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(TokenStorageInterface $tokenStorage, AuthenticationM
4141
protected function getPreAuthenticatedData(Request $request)
4242
{
4343
if (!$request->server->has($this->userKey)) {
44-
throw new BadCredentialsException(sprintf('User key was not found: %s.', $this->userKey));
44+
throw new BadCredentialsException(sprintf('User key was not found: "%s".', $this->userKey));
4545
}
4646

4747
return [$request->server->get($this->userKey), null];

Firewall/SimplePreAuthenticationListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public function authenticate(RequestEvent $event)
146146
if ($response instanceof Response) {
147147
$event->setResponse($response);
148148
} elseif (null !== $response) {
149-
throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationFailure method must return null or a Response object.', \get_class($this->simpleAuthenticator)));
149+
throw new \UnexpectedValueException(sprintf('The "%s::onAuthenticationFailure()" method must return null or a Response object.', \get_class($this->simpleAuthenticator)));
150150
}
151151
}
152152

@@ -158,7 +158,7 @@ public function authenticate(RequestEvent $event)
158158
if ($response instanceof Response) {
159159
$event->setResponse($response);
160160
} elseif (null !== $response) {
161-
throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationSuccess method must return null or a Response object.', \get_class($this->simpleAuthenticator)));
161+
throw new \UnexpectedValueException(sprintf('The "%s::onAuthenticationSuccess()" method must return null or a Response object.', \get_class($this->simpleAuthenticator)));
162162
}
163163
}
164164
}

Firewall/X509AuthenticationListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ protected function getPreAuthenticatedData(Request $request)
5252
}
5353

5454
if (null === $user) {
55-
throw new BadCredentialsException(sprintf('SSL credentials not found: %s, %s.', $this->userKey, $this->credentialKey));
55+
throw new BadCredentialsException(sprintf('SSL credentials not found: "%s", "%s".', $this->userKey, $this->credentialKey));
5656
}
5757

5858
return [$user, $request->server->get($this->credentialKey, '')];

Tests/Authentication/SimpleAuthenticationHandlerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function testOnAuthenticationSuccessCallsSimpleAuthenticator()
8484
public function testOnAuthenticationSuccessThrowsAnExceptionIfNonResponseIsReturned()
8585
{
8686
$this->expectException('UnexpectedValueException');
87-
$this->expectExceptionMessage('onAuthenticationSuccess method must return null to use the default success handler, or a Response object');
87+
$this->expectExceptionMessage('onAuthenticationSuccess()" method must return null to use the default success handler, or a Response object');
8888
$this->successHandler->expects($this->never())
8989
->method('onAuthenticationSuccess');
9090

@@ -152,7 +152,7 @@ public function testOnAuthenticationFailureCallsSimpleAuthenticator()
152152
public function testOnAuthenticationFailureThrowsAnExceptionIfNonResponseIsReturned()
153153
{
154154
$this->expectException('UnexpectedValueException');
155-
$this->expectExceptionMessage('onAuthenticationFailure method must return null to use the default failure handler, or a Response object');
155+
$this->expectExceptionMessage('onAuthenticationFailure()" method must return null to use the default failure handler, or a Response object');
156156
$this->failureHandler->expects($this->never())
157157
->method('onAuthenticationFailure');
158158

Tests/Firewall/ExceptionListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function testExceptionWhenEntryPointReturnsBadValue()
8383
$listener->onKernelException($event);
8484
// the exception has been replaced by our LogicException
8585
$this->assertInstanceOf('LogicException', $event->getThrowable());
86-
$this->assertStringEndsWith('start() method must return a Response object (string returned).', $event->getThrowable()->getMessage());
86+
$this->assertStringEndsWith('start()" method must return a Response object ("string" returned).', $event->getThrowable()->getMessage());
8787
}
8888

8989
/**

0 commit comments

Comments
 (0)