Skip to content

Commit 0ee5733

Browse files
authored
Bump php-cs-fixer to version 3.60 (#1743)
1 parent cbd7012 commit 0ee5733

26 files changed

+54
-50
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## NOT RELEASED
44

5+
### Changed
6+
7+
- Enable compiler optimization for the `sprintf` function.
8+
59
## 1.22.0
610

711
### Added

src/AbstractApi.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function __construct($configuration = [], ?CredentialProvider $credential
7575
if (\is_array($configuration)) {
7676
$configuration = Configuration::create($configuration);
7777
} elseif (!$configuration instanceof Configuration) {
78-
throw new InvalidArgument(sprintf('First argument to "%s::__construct()" must be an array or an instance of "%s"', static::class, Configuration::class));
78+
throw new InvalidArgument(\sprintf('First argument to "%s::__construct()" must be an array or an instance of "%s"', static::class, Configuration::class));
7979
}
8080

8181
$this->logger = $logger ?? new NullLogger();
@@ -120,23 +120,23 @@ final public function presign(Input $input, ?\DateTimeImmutable $expires = null)
120120
*/
121121
protected function getServiceCode(): string
122122
{
123-
throw new LogicException(sprintf('The method "%s" should not be called. The Client "%s" must implement the "%s" method.', __FUNCTION__, \get_class($this), 'getEndpointMetadata'));
123+
throw new LogicException(\sprintf('The method "%s" should not be called. The Client "%s" must implement the "%s" method.', __FUNCTION__, \get_class($this), 'getEndpointMetadata'));
124124
}
125125

126126
/**
127127
* @deprecated
128128
*/
129129
protected function getSignatureVersion(): string
130130
{
131-
throw new LogicException(sprintf('The method "%s" should not be called. The Client "%s" must implement the "%s" method.', __FUNCTION__, \get_class($this), 'getEndpointMetadata'));
131+
throw new LogicException(\sprintf('The method "%s" should not be called. The Client "%s" must implement the "%s" method.', __FUNCTION__, \get_class($this), 'getEndpointMetadata'));
132132
}
133133

134134
/**
135135
* @deprecated
136136
*/
137137
protected function getSignatureScopeName(): string
138138
{
139-
throw new LogicException(sprintf('The method "%s" should not be called. The Client "%s" must implement the "%s" method.', __FUNCTION__, \get_class($this), 'getEndpointMetadata'));
139+
throw new LogicException(\sprintf('The method "%s" should not be called. The Client "%s" must implement the "%s" method.', __FUNCTION__, \get_class($this), 'getEndpointMetadata'));
140140
}
141141

142142
final protected function getResponse(Request $request, ?RequestContext $context = null): Response
@@ -268,7 +268,7 @@ protected function getEndpoint(string $uri, array $query, ?string $region): stri
268268
*/
269269
protected function discoverEndpoints(?string $region): array
270270
{
271-
throw new LogicException(sprintf('The Client "%s" must implement the "%s" method.', \get_class($this), 'discoverEndpoints'));
271+
throw new LogicException(\sprintf('The Client "%s" must implement the "%s" method.', \get_class($this), 'discoverEndpoints'));
272272
}
273273

274274
/**
@@ -304,7 +304,7 @@ private function getDiscoveredEndpoint(string $uri, array $query, ?string $regio
304304
// 4. if endpoint is still null, fallback to expired endpoint
305305
if (null === $endpoint && null === $endpoint = $this->endpointCache->getExpiredEndpoint($region)) {
306306
if ($requiresEndpointDiscovery) {
307-
throw new RuntimeException(sprintf('The Client "%s" failed to fetch the endpoint.', \get_class($this)), 0, $previous);
307+
throw new RuntimeException(\sprintf('The Client "%s" failed to fetch the endpoint.', \get_class($this)), 0, $previous);
308308
}
309309

310310
return $this->getEndpoint($uri, $query, $region);
@@ -346,7 +346,7 @@ private function getSigner(?string $region): Signer
346346
}
347347

348348
if (null === $factory) {
349-
throw new InvalidArgument(sprintf('None of the signatures "%s" is implemented.', implode(', ', $metadata['signVersions'])));
349+
throw new InvalidArgument(\sprintf('None of the signatures "%s" is implemented.', implode(', ', $metadata['signVersions'])));
350350
}
351351

352352
$this->signers[$region] = $factory($metadata['signService'], $metadata['signRegion']);

src/AwsClientFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function __construct($configuration = [], ?CredentialProvider $credential
9595
if (\is_array($configuration)) {
9696
$configuration = Configuration::create($configuration);
9797
} elseif (!$configuration instanceof Configuration) {
98-
throw new InvalidArgument(sprintf('Second argument to "%s::__construct()" must be an array or an instance of "%s"', __CLASS__, Configuration::class));
98+
throw new InvalidArgument(\sprintf('Second argument to "%s::__construct()" must be an array or an instance of "%s"', __CLASS__, Configuration::class));
9999
}
100100

101101
$this->httpClient = $httpClient ?? HttpClient::create();

src/Configuration.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ final class Configuration
105105
public static function create(array $options): self
106106
{
107107
if (0 < \count($invalidOptions = array_diff_key($options, self::AVAILABLE_OPTIONS))) {
108-
throw new InvalidArgument(sprintf('Invalid option(s) "%s" passed to "%s::%s". ', implode('", "', array_keys($invalidOptions)), __CLASS__, __METHOD__));
108+
throw new InvalidArgument(\sprintf('Invalid option(s) "%s" passed to "%s::%s". ', implode('", "', array_keys($invalidOptions)), __CLASS__, __METHOD__));
109109
}
110110

111111
// Force each option to be string or null
@@ -147,7 +147,7 @@ public static function optionExists(string $optionName): bool
147147
public function get(string $name): ?string
148148
{
149149
if (!isset(self::AVAILABLE_OPTIONS[$name])) {
150-
throw new InvalidArgument(sprintf('Invalid option "%s" passed to "%s::%s". ', $name, __CLASS__, __METHOD__));
150+
throw new InvalidArgument(\sprintf('Invalid option "%s" passed to "%s::%s". ', $name, __CLASS__, __METHOD__));
151151
}
152152

153153
return $this->data[$name] ?? null;
@@ -159,7 +159,7 @@ public function get(string $name): ?string
159159
public function has(string $name): bool
160160
{
161161
if (!isset(self::AVAILABLE_OPTIONS[$name])) {
162-
throw new InvalidArgument(sprintf('Invalid option "%s" passed to "%s::%s". ', $name, __CLASS__, __METHOD__));
162+
throw new InvalidArgument(\sprintf('Invalid option "%s" passed to "%s::%s". ', $name, __CLASS__, __METHOD__));
163163
}
164164

165165
return isset($this->data[$name]);
@@ -171,7 +171,7 @@ public function has(string $name): bool
171171
public function isDefault(string $name): bool
172172
{
173173
if (!isset(self::AVAILABLE_OPTIONS[$name])) {
174-
throw new InvalidArgument(sprintf('Invalid option "%s" passed to "%s::%s". ', $name, __CLASS__, __METHOD__));
174+
throw new InvalidArgument(\sprintf('Invalid option "%s" passed to "%s::%s". ', $name, __CLASS__, __METHOD__));
175175
}
176176

177177
return empty($this->userData[$name]);

src/Credentials/Credentials.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,6 @@ public static function adjustExpireDate(\DateTimeImmutable $expireDate, ?\DateTi
8383
$expireDate = (new \DateTimeImmutable())->add($reference->diff($expireDate));
8484
}
8585

86-
return $expireDate->sub(new \DateInterval(sprintf('PT%dS', self::EXPIRATION_DRIFT)));
86+
return $expireDate->sub(new \DateInterval(\sprintf('PT%dS', self::EXPIRATION_DRIFT)));
8787
}
8888
}

src/Credentials/InstanceProvider.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,17 @@ private function toArray(ResponseInterface $response): array
122122
$content = json_decode($content, true, 512, \JSON_BIGINT_AS_STRING | (\PHP_VERSION_ID >= 70300 ? \JSON_THROW_ON_ERROR : 0));
123123
} catch (\JsonException $e) {
124124
/** @psalm-suppress all */
125-
throw new JsonException(sprintf('%s for "%s".', $e->getMessage(), $response->getInfo('url')), $e->getCode());
125+
throw new JsonException(\sprintf('%s for "%s".', $e->getMessage(), $response->getInfo('url')), $e->getCode());
126126
}
127127

128128
if (\PHP_VERSION_ID < 70300 && \JSON_ERROR_NONE !== json_last_error()) {
129129
/** @psalm-suppress InvalidArgument */
130-
throw new JsonException(sprintf('%s for "%s".', json_last_error_msg(), $response->getInfo('url')), json_last_error());
130+
throw new JsonException(\sprintf('%s for "%s".', json_last_error_msg(), $response->getInfo('url')), json_last_error());
131131
}
132132

133133
if (!\is_array($content)) {
134134
/** @psalm-suppress InvalidArgument */
135-
throw new JsonException(sprintf('JSON content was expected to decode to an array, %s returned for "%s".', \gettype($content), $response->getInfo('url')));
135+
throw new JsonException(\sprintf('JSON content was expected to decode to an array, %s returned for "%s".', \gettype($content), $response->getInfo('url')));
136136
}
137137

138138
return $content;

src/Credentials/SsoCacheFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __construct(?LoggerInterface $logger = null)
3131
*/
3232
public function loadSsoCacheFile(string $ssoStartUrl): array
3333
{
34-
$filepath = sprintf('%s/.aws/sso/cache/%s.json', $this->getHomeDir(), sha1($ssoStartUrl));
34+
$filepath = \sprintf('%s/.aws/sso/cache/%s.json', $this->getHomeDir(), sha1($ssoStartUrl));
3535

3636
if (false === ($contents = @file_get_contents($filepath))) {
3737
$this->logger->warning('The sso cache file {path} is not readable.', ['path' => $filepath]);

src/EndpointDiscovery/EndpointCache.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ private function sanitizeEndpoint(string $address): string
9595

9696
// parse_url() will correctly parse full URIs with schemes
9797
if (isset($parsed['host'])) {
98-
return rtrim(sprintf(
98+
return rtrim(\sprintf(
9999
'%s://%s/%s',
100100
$parsed['scheme'] ?? 'https',
101101
$parsed['host'],
@@ -113,14 +113,14 @@ private function sanitizeEndpoint(string $address): string
113113
$parsed['path'] = '';
114114
}
115115

116-
return rtrim(sprintf(
116+
return rtrim(\sprintf(
117117
'%s://%s/%s',
118118
$parsed['scheme'] ?? 'https',
119119
$parsed['host'],
120120
ltrim($parsed['path'], '/')
121121
), '/');
122122
}
123123

124-
throw new LogicException(sprintf('The supplied endpoint "%s" is invalid.', $address));
124+
throw new LogicException(\sprintf('The supplied endpoint "%s" is invalid.', $address));
125125
}
126126
}

src/Exception/Http/HttpExceptionTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(ResponseInterface $response, ?AwsError $awsError = n
3232
/** @var string $url */
3333
$url = $response->getInfo('url');
3434

35-
$message = sprintf('HTTP %d returned for "%s".', $code, $url);
35+
$message = \sprintf('HTTP %d returned for "%s".', $code, $url);
3636
if (null !== $this->awsError = $awsError) {
3737
$message .= <<<TEXT
3838

src/Exception/MissingDependency.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ class MissingDependency extends \RuntimeException implements Exception
1111
*/
1212
public static function create(string $package, string $name)
1313
{
14-
return new self(sprintf('In order to use "%s" you need to install "%s". Run "composer require %s" and all your problems are solved.', $name, $package, $package));
14+
return new self(\sprintf('In order to use "%s" you need to install "%s". Run "composer require %s" and all your problems are solved.', $name, $package, $package));
1515
}
1616
}

0 commit comments

Comments
 (0)