Skip to content

Commit 6224361

Browse files
authored
Bump php-cs-fixer (#1001)
1 parent a9133be commit 6224361

40 files changed

+136
-137
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
/vendor/
2-
.php_cs.cache
3-
.phpunit.result.cache
2+
*.cache
43
composer.lock

src/AbstractApi.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function __construct($configuration = [], ?CredentialProvider $credential
7474
$this->awsErrorFactory = $this->getAwsErrorFactory();
7575
if (!isset($httpClient)) {
7676
$httpClient = HttpClient::create();
77-
if (\class_exists(RetryableHttpClient::class)) {
77+
if (class_exists(RetryableHttpClient::class)) {
7878
/** @psalm-suppress MissingDependency */
7979
$httpClient = new RetryableHttpClient(
8080
$httpClient,
@@ -111,23 +111,23 @@ final public function presign(Input $input, ?\DateTimeImmutable $expires = null)
111111
*/
112112
protected function getServiceCode(): string
113113
{
114-
throw new LogicException(\sprintf('The method "%s" should not be called. The Client "%s" must implement the "%s" method.', __FUNCTION__, \get_class($this), 'getEndpointMetadata'));
114+
throw new LogicException(sprintf('The method "%s" should not be called. The Client "%s" must implement the "%s" method.', __FUNCTION__, \get_class($this), 'getEndpointMetadata'));
115115
}
116116

117117
/**
118118
* @deprecated
119119
*/
120120
protected function getSignatureVersion(): string
121121
{
122-
throw new LogicException(\sprintf('The method "%s" should not be called. The Client "%s" must implement the "%s" method.', __FUNCTION__, \get_class($this), 'getEndpointMetadata'));
122+
throw new LogicException(sprintf('The method "%s" should not be called. The Client "%s" must implement the "%s" method.', __FUNCTION__, \get_class($this), 'getEndpointMetadata'));
123123
}
124124

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

133133
final protected function getResponse(Request $request, ?RequestContext $context = null): Response
@@ -158,7 +158,7 @@ final protected function getResponse(Request $request, ?RequestContext $context
158158
]
159159
);
160160

161-
if ($debug = \filter_var($this->configuration->get('debug'), \FILTER_VALIDATE_BOOLEAN)) {
161+
if ($debug = filter_var($this->configuration->get('debug'), \FILTER_VALIDATE_BOOLEAN)) {
162162
$this->logger->debug('AsyncAws HTTP request sent: {method} {endpoint}', [
163163
'method' => $request->getMethod(),
164164
'endpoint' => $request->getEndpoint(),
@@ -200,7 +200,7 @@ protected function getAwsErrorFactory(): AwsErrorFactoryInterface
200200
*/
201201
protected function getEndpointMetadata(?string $region): array
202202
{
203-
\trigger_deprecation('async-aws/core', '1.2', 'Extending "%s"" without overriding "%s" is deprecated. This method will be abstract in version 2.0.', __CLASS__, __FUNCTION__);
203+
trigger_deprecation('async-aws/core', '1.2', 'Extending "%s"" without overriding "%s" is deprecated. This method will be abstract in version 2.0.', __CLASS__, __FUNCTION__);
204204

205205
/** @var string $endpoint */
206206
$endpoint = $this->configuration->get('endpoint');
@@ -237,8 +237,8 @@ protected function getEndpoint(string $uri, array $query, ?string $region): stri
237237
$endpoint = $metadata['endpoint'];
238238
}
239239

240-
if (false !== \strpos($endpoint, '%region%') || false !== \strpos($endpoint, '%service%')) {
241-
\trigger_deprecation('async-aws/core', '1.2', 'providing an endpoint with placeholder is deprecated and will be ignored in version 2.0. Provide full endpoint instead.');
240+
if (false !== strpos($endpoint, '%region%') || false !== strpos($endpoint, '%service%')) {
241+
trigger_deprecation('async-aws/core', '1.2', 'providing an endpoint with placeholder is deprecated and will be ignored in version 2.0. Provide full endpoint instead.');
242242

243243
$endpoint = strtr($endpoint, [
244244
'%region%' => $region ?? $this->configuration->get('region'),
@@ -251,7 +251,7 @@ protected function getEndpoint(string $uri, array $query, ?string $region): stri
251251
return $endpoint;
252252
}
253253

254-
return $endpoint . (false === \strpos($endpoint, '?') ? '?' : '&') . http_build_query($query);
254+
return $endpoint . (false === strpos($endpoint, '?') ? '?' : '&') . http_build_query($query);
255255
}
256256

257257
/**
@@ -281,7 +281,7 @@ private function getSigner(?string $region)
281281
}
282282

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

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

src/AwsError/JsonRestAwsErrorFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ private static function parseJson(array $body, array $headers): AwsError
2828
$code = null;
2929
$type = $body['type'] ?? $body['Type'] ?? null;
3030
if ($type) {
31-
$type = \strtolower($type);
31+
$type = strtolower($type);
3232
}
3333
$message = $body['message'] ?? $body['Message'] ?? null;
3434
if (isset($headers['x-amzn-errortype'][0])) {

src/Configuration.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ final class Configuration
9090

9191
public static function create(array $options)
9292
{
93-
if (0 < \count($invalidOptions = \array_diff_key($options, self::AVAILABLE_OPTIONS))) {
94-
throw new InvalidArgument(\sprintf('Invalid option(s) "%s" passed to "%s::%s". ', \implode('", "', \array_keys($invalidOptions)), __CLASS__, __METHOD__));
93+
if (0 < \count($invalidOptions = array_diff_key($options, self::AVAILABLE_OPTIONS))) {
94+
throw new InvalidArgument(sprintf('Invalid option(s) "%s" passed to "%s::%s". ', implode('", "', array_keys($invalidOptions)), __CLASS__, __METHOD__));
9595
}
9696

9797
// Force each option to be string or null
98-
$options = \array_map(static function ($value) {
98+
$options = array_map(static function ($value) {
9999
return null !== $value ? (string) $value : $value;
100100
}, $options);
101101

@@ -131,7 +131,7 @@ public static function optionExists(string $optionName): bool
131131
public function get(string $name): ?string
132132
{
133133
if (!isset(self::AVAILABLE_OPTIONS[$name])) {
134-
throw new InvalidArgument(\sprintf('Invalid option "%s" passed to "%s::%s". ', $name, __CLASS__, __METHOD__));
134+
throw new InvalidArgument(sprintf('Invalid option "%s" passed to "%s::%s". ', $name, __CLASS__, __METHOD__));
135135
}
136136

137137
return $this->data[$name] ?? null;
@@ -140,7 +140,7 @@ public function get(string $name): ?string
140140
public function has(string $name): bool
141141
{
142142
if (!isset(self::AVAILABLE_OPTIONS[$name])) {
143-
throw new InvalidArgument(\sprintf('Invalid option "%s" passed to "%s::%s". ', $name, __CLASS__, __METHOD__));
143+
throw new InvalidArgument(sprintf('Invalid option "%s" passed to "%s::%s". ', $name, __CLASS__, __METHOD__));
144144
}
145145

146146
return isset($this->data[$name]);
@@ -149,7 +149,7 @@ public function has(string $name): bool
149149
public function isDefault(string $name): bool
150150
{
151151
if (!isset(self::AVAILABLE_OPTIONS[$name])) {
152-
throw new InvalidArgument(\sprintf('Invalid option "%s" passed to "%s::%s". ', $name, __CLASS__, __METHOD__));
152+
throw new InvalidArgument(sprintf('Invalid option "%s" passed to "%s::%s". ', $name, __CLASS__, __METHOD__));
153153
}
154154

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

src/Credentials/CacheProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct(CredentialProvider $decorated)
3030

3131
public function getCredentials(Configuration $configuration): ?Credentials
3232
{
33-
$key = \spl_object_hash($configuration);
33+
$key = spl_object_hash($configuration);
3434
if (!\array_key_exists($key, $this->cache) || (null !== $this->cache[$key] && $this->cache[$key]->isExpired())) {
3535
$this->cache[$key] = $this->decorated->getCredentials($configuration);
3636
}

src/Credentials/ChainProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct(iterable $providers)
3838

3939
public function getCredentials(Configuration $configuration): ?Credentials
4040
{
41-
$key = \spl_object_hash($configuration);
41+
$key = spl_object_hash($configuration);
4242
if (\array_key_exists($key, $this->lastSuccessfulProvider)) {
4343
if (null === $provider = $this->lastSuccessfulProvider[$key]) {
4444
return null;

src/Credentials/ConfigurationProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function getCredentials(Configuration $configuration): ?Credentials
5959

6060
private function getCredentialsFromRole(Credentials $credentials, string $region, string $roleArn, string $roleSessionName = null): ?Credentials
6161
{
62-
$roleSessionName = $roleSessionName ?? \uniqid('async-aws-', true);
62+
$roleSessionName = $roleSessionName ?? uniqid('async-aws-', true);
6363
$stsClient = new StsClient(['region' => $region], $credentials, $this->httpClient);
6464
$result = $stsClient->assumeRole([
6565
'RoleArn' => $roleArn,

src/Credentials/IniFileLoader.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ public function loadProfiles(array $filepaths): array
4646
}
4747
if ('~' === $filepath[0]) {
4848
$homeDir = $homeDir ?? $this->getHomeDir();
49-
$filepath = $homeDir . \substr($filepath, 1);
49+
$filepath = $homeDir . substr($filepath, 1);
5050
}
51-
if (!\is_readable($filepath) || !\is_file($filepath)) {
51+
if (!is_readable($filepath) || !is_file($filepath)) {
5252
continue;
5353
}
5454

5555
foreach ($this->parseIniFile($filepath) as $name => $profile) {
56-
$name = \preg_replace('/^profile /', '', (string) $name);
56+
$name = preg_replace('/^profile /', '', (string) $name);
5757
if (!isset($profilesData[$name])) {
58-
$profilesData[$name] = \array_map('trim', $profile);
58+
$profilesData[$name] = array_map('trim', $profile);
5959
} else {
6060
foreach ($profile as $k => $v) {
6161
if (!isset($profilesData[$name][$k])) {
@@ -85,8 +85,8 @@ private function getHomeDir(): string
8585

8686
private function parseIniFile(string $filepath): array
8787
{
88-
if (false === $data = \parse_ini_string(
89-
\preg_replace('/^#/m', ';', \file_get_contents($filepath)),
88+
if (false === $data = parse_ini_string(
89+
preg_replace('/^#/m', ';', file_get_contents($filepath)),
9090
true,
9191
\INI_SCANNER_RAW
9292
)) {

src/Credentials/IniFileProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function getCredentials(Configuration $configuration): ?Credentials
5454
private function getCredentialsFromProfile(array $profilesData, string $profile, array $circularCollector = []): ?Credentials
5555
{
5656
if (isset($circularCollector[$profile])) {
57-
$this->logger->warning('Circular reference detected when loading "{profile}". Already loaded {previous_profiles}', ['profile' => $profile, 'previous_profiles' => \array_keys($circularCollector)]);
57+
$this->logger->warning('Circular reference detected when loading "{profile}". Already loaded {previous_profiles}', ['profile' => $profile, 'previous_profiles' => array_keys($circularCollector)]);
5858

5959
return null;
6060
}
@@ -87,7 +87,7 @@ private function getCredentialsFromProfile(array $profilesData, string $profile,
8787
private function getCredentialsFromRole(array $profilesData, array $profileData, string $profile, array $circularCollector = []): ?Credentials
8888
{
8989
$roleArn = (string) ($profileData[IniFileLoader::KEY_ROLE_ARN] ?? '');
90-
$roleSessionName = (string) ($profileData[IniFileLoader::KEY_ROLE_SESSION_NAME] ?? \uniqid('async-aws-', true));
90+
$roleSessionName = (string) ($profileData[IniFileLoader::KEY_ROLE_SESSION_NAME] ?? uniqid('async-aws-', true));
9191
if (null === $sourceProfileName = $profileData[IniFileLoader::KEY_SOURCE_PROFILE] ?? null) {
9292
$this->logger->warning('The source profile is not defined in Role "{profile}".', ['profile' => $profile]);
9393

src/Credentials/PsrCacheProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function getCredentials(Configuration $configuration): ?Credentials
4949
*/
5050
private function getFromCache(Configuration $configuration): ?Credentials
5151
{
52-
$item = $this->cache->getItem('AsyncAws.Credentials.' . sha1(\serialize([$configuration, \get_class($this->decorated)])));
52+
$item = $this->cache->getItem('AsyncAws.Credentials.' . sha1(serialize([$configuration, \get_class($this->decorated)])));
5353
if (!$item->isHit()) {
5454
$item->set($credential = $this->decorated->getCredentials($configuration));
5555

0 commit comments

Comments
 (0)