Skip to content

Commit baab66b

Browse files
committed
Fix quotes in exception messages
1 parent b7df8ff commit baab66b

7 files changed

+10
-10
lines changed

Authentication/SimpleAuthenticationHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

@@ -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/ExceptionListener.php

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

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

218218
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
@@ -120,7 +120,7 @@ public function handle(GetResponseEvent $event)
120120
if ($response instanceof Response) {
121121
$event->setResponse($response);
122122
} elseif (null !== $response) {
123-
throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationFailure method must return null or a Response object.', \get_class($this->simpleAuthenticator)));
123+
throw new \UnexpectedValueException(sprintf('The "%s::onAuthenticationFailure()" method must return null or a Response object.', \get_class($this->simpleAuthenticator)));
124124
}
125125
}
126126

@@ -132,7 +132,7 @@ public function handle(GetResponseEvent $event)
132132
if ($response instanceof Response) {
133133
$event->setResponse($response);
134134
} elseif (null !== $response) {
135-
throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationSuccess method must return null or a Response object.', \get_class($this->simpleAuthenticator)));
135+
throw new \UnexpectedValueException(sprintf('The "%s::onAuthenticationSuccess()" method must return null or a Response object.', \get_class($this->simpleAuthenticator)));
136136
}
137137
}
138138
}

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
@@ -81,7 +81,7 @@ public function testOnAuthenticationSuccessCallsSimpleAuthenticator()
8181
public function testOnAuthenticationSuccessThrowsAnExceptionIfNonResponseIsReturned()
8282
{
8383
$this->expectException('UnexpectedValueException');
84-
$this->expectExceptionMessage('onAuthenticationSuccess method must return null to use the default success handler, or a Response object');
84+
$this->expectExceptionMessage('onAuthenticationSuccess()" method must return null to use the default success handler, or a Response object');
8585
$this->successHandler->expects($this->never())
8686
->method('onAuthenticationSuccess');
8787

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

Tests/Firewall/ExceptionListenerTest.php

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

9292
/**

0 commit comments

Comments
 (0)