Skip to content

Commit afe2e88

Browse files
Leverage symfony-tools/fabbot
1 parent 304cf84 commit afe2e88

File tree

14 files changed

+31
-22
lines changed

14 files changed

+31
-22
lines changed

.github/workflows/fabbot.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: CS
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
call-fabbot:
11+
name: Fabbot
12+
uses: symfony-tools/fabbot/.github/workflows/fabbot.yml@main
13+
with:
14+
package: Mercure

src/Authorization.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function createCookie(Request $request, $subscribe = [], $publish = [], a
7979
$hubInstance = $this->registry->getHub($hub);
8080
$tokenFactory = $hubInstance->getFactory();
8181
if (null === $tokenFactory) {
82-
$message = sprintf('The %s hub does not contain a token factory.', $hub ? "\"$hub\"" : 'default');
82+
$message = \sprintf('The %s hub does not contain a token factory.', $hub ? "\"$hub\"" : 'default');
8383
throw new InvalidArgumentException($message);
8484
}
8585

@@ -170,14 +170,14 @@ private function getCookieDomain(Request $request, array $urlComponents): ?strin
170170
}
171171
}
172172

173-
throw new RuntimeException(sprintf('Unable to create authorization cookie for a hub on the different second-level domain "%s".', $cookieDomain));
173+
throw new RuntimeException(\sprintf('Unable to create authorization cookie for a hub on the different second-level domain "%s".', $cookieDomain));
174174
}
175175

176176
private function updateCookies(Request $request, ?string $hub, Cookie $cookie): void
177177
{
178178
$cookies = $request->attributes->get('_mercure_authorization_cookies', []);
179179
if (\array_key_exists($hub, $cookies)) {
180-
$message = sprintf('The "mercureAuthorization" cookie for the "%s" has already been set. You cannot set it two times during the same request.', $hub ? "\"$hub\" hub" : 'default hub');
180+
$message = \sprintf('The "mercureAuthorization" cookie for the "%s" has already been set. You cannot set it two times during the same request.', $hub ? "\"$hub\" hub" : 'default hub');
181181
throw new RuntimeException($message);
182182
}
183183

src/Debug/TraceablePublisher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*
2828
* @experimental
2929
*
30-
* @deprecated
30+
* @deprecated since Mercure 0.5
3131
*/
3232
final class TraceablePublisher implements PublisherInterface, ResetInterface
3333
{

src/EventSubscriber/SetCookieSubscriber.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ public function onKernelResponse(ResponseEvent $event): void
2828
{
2929
$mainRequest = method_exists($event, 'isMainRequest') ? $event->isMainRequest() : $event->isMasterRequest(); /* @phpstan-ignore-line */
3030
if (
31-
!($mainRequest) ||
32-
null === $cookies = ($request = $event->getRequest())->attributes->get('_mercure_authorization_cookies')) {
31+
!$mainRequest
32+
|| null === $cookies = ($request = $event->getRequest())->attributes->get('_mercure_authorization_cookies')
33+
) {
3334
return;
3435
}
3536

@@ -41,9 +42,6 @@ public function onKernelResponse(ResponseEvent $event): void
4142
}
4243
}
4344

44-
/**
45-
* {@inheritdoc}
46-
*/
4745
public static function getSubscribedEvents(): array
4846
{
4947
return [KernelEvents::RESPONSE => 'onKernelResponse'];

src/Exception/InvalidArgumentException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ final class InvalidArgumentException extends \InvalidArgumentException implement
2525
*/
2626
public static function forInvalidAlgorithm(string $algorithm, array $supportedAlgorithms): self
2727
{
28-
return new self(sprintf('Unsupported algorithm "%s", expected one of "%s".', $algorithm, implode('", "', $supportedAlgorithms)));
28+
return new self(\sprintf('Unsupported algorithm "%s", expected one of "%s".', $algorithm, implode('", "', $supportedAlgorithms)));
2929
}
3030
}

src/Hub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct(
3737
TokenProviderInterface $jwtProvider,
3838
?TokenFactoryInterface $jwtFactory = null,
3939
?string $publicUrl = null,
40-
?HttpClientInterface $httpClient = null
40+
?HttpClientInterface $httpClient = null,
4141
) {
4242
$this->url = $url;
4343
$this->jwtProvider = $jwtProvider;

src/Internal/QueryBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ public static function build(array $data): string
4545
private static function encode($key, $value): string
4646
{
4747
// All Mercure's keys are safe, so don't need to be encoded, but it's not a generic solution
48-
return sprintf('%s=%s', $key, urlencode((string) $value));
48+
return \sprintf('%s=%s', $key, urlencode((string) $value));
4949
}
5050
}

src/Jwt/LcobucciFactory.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ public function __construct(string $secret, string $algorithm = 'hmac.sha256', ?
6464
$this->jwtLifetime = 0 === $jwtLifetime ? ((int) \ini_get('session.cookie_lifetime') ?: 3600) : $jwtLifetime;
6565
}
6666

67-
/**
68-
* {@inheritdoc}
69-
*/
7067
public function create(?array $subscribe = [], ?array $publish = [], array $additionalClaims = []): string
7168
{
7269
$builder = $this->configurations->builder();

src/Jwt/StaticJwtProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*
2323
* @experimental
2424
*
25-
* @deprecated
25+
* @deprecated since Mercure 0.5
2626
*/
2727
final class StaticJwtProvider
2828
{

src/MockHub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(
3232
TokenProviderInterface $jwtProvider,
3333
callable $publisher,
3434
?TokenFactoryInterface $jwtFactory = null,
35-
?string $publicUrl = null
35+
?string $publicUrl = null,
3636
) {
3737
$this->url = $url;
3838
$this->jwtProvider = $jwtProvider;

0 commit comments

Comments
 (0)