From fd09f5e4e102215a3ccd1dd111af3a24ed43355d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?= Date: Tue, 30 Jul 2024 13:36:17 +0200 Subject: [PATCH] Bump php-cs-fixer to version 3.60 (#1743) --- CHANGELOG.md | 4 ++++ src/Input/BatchGetBuildsInput.php | 2 +- src/Input/StartBuildInput.php | 10 +++++----- src/Input/StopBuildInput.php | 2 +- src/Result/BatchGetBuildsOutput.php | 8 ++++---- src/Result/StartBuildOutput.php | 8 ++++---- src/Result/StopBuildOutput.php | 8 ++++---- src/ValueObject/CloudWatchLogsConfig.php | 2 +- src/ValueObject/EnvironmentVariable.php | 2 +- src/ValueObject/ProjectArtifacts.php | 8 ++++---- src/ValueObject/ProjectCache.php | 4 ++-- src/ValueObject/ProjectSource.php | 2 +- src/ValueObject/RegistryCredential.php | 2 +- src/ValueObject/S3LogsConfig.php | 4 ++-- src/ValueObject/SourceAuth.php | 2 +- 15 files changed, 36 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8acf46..4b4891d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## NOT RELEASED +### Changed + +- Enable compiler optimization for the `sprintf` function. + ## 2.4.1 ### Changed diff --git a/src/Input/BatchGetBuildsInput.php b/src/Input/BatchGetBuildsInput.php index 7181988..66a7068 100644 --- a/src/Input/BatchGetBuildsInput.php +++ b/src/Input/BatchGetBuildsInput.php @@ -89,7 +89,7 @@ private function requestBody(): array { $payload = []; if (null === $v = $this->ids) { - throw new InvalidArgument(sprintf('Missing parameter "ids" for "%s". The value cannot be null.', __CLASS__)); + throw new InvalidArgument(\sprintf('Missing parameter "ids" for "%s". The value cannot be null.', __CLASS__)); } $index = -1; diff --git a/src/Input/StartBuildInput.php b/src/Input/StartBuildInput.php index 49de107..72877a9 100644 --- a/src/Input/StartBuildInput.php +++ b/src/Input/StartBuildInput.php @@ -913,7 +913,7 @@ private function requestBody(): array { $payload = []; if (null === $v = $this->projectName) { - throw new InvalidArgument(sprintf('Missing parameter "projectName" for "%s". The value cannot be null.', __CLASS__)); + throw new InvalidArgument(\sprintf('Missing parameter "projectName" for "%s". The value cannot be null.', __CLASS__)); } $payload['projectName'] = $v; if (null !== $v = $this->secondarySourcesOverride) { @@ -956,7 +956,7 @@ private function requestBody(): array } if (null !== $v = $this->sourceTypeOverride) { if (!SourceType::exists($v)) { - throw new InvalidArgument(sprintf('Invalid parameter "sourceTypeOverride" for "%s". The value "%s" is not a valid "SourceType".', __CLASS__, $v)); + throw new InvalidArgument(\sprintf('Invalid parameter "sourceTypeOverride" for "%s". The value "%s" is not a valid "SourceType".', __CLASS__, $v)); } $payload['sourceTypeOverride'] = $v; } @@ -986,7 +986,7 @@ private function requestBody(): array } if (null !== $v = $this->environmentTypeOverride) { if (!EnvironmentType::exists($v)) { - throw new InvalidArgument(sprintf('Invalid parameter "environmentTypeOverride" for "%s". The value "%s" is not a valid "EnvironmentType".', __CLASS__, $v)); + throw new InvalidArgument(\sprintf('Invalid parameter "environmentTypeOverride" for "%s". The value "%s" is not a valid "EnvironmentType".', __CLASS__, $v)); } $payload['environmentTypeOverride'] = $v; } @@ -995,7 +995,7 @@ private function requestBody(): array } if (null !== $v = $this->computeTypeOverride) { if (!ComputeType::exists($v)) { - throw new InvalidArgument(sprintf('Invalid parameter "computeTypeOverride" for "%s". The value "%s" is not a valid "ComputeType".', __CLASS__, $v)); + throw new InvalidArgument(\sprintf('Invalid parameter "computeTypeOverride" for "%s". The value "%s" is not a valid "ComputeType".', __CLASS__, $v)); } $payload['computeTypeOverride'] = $v; } @@ -1031,7 +1031,7 @@ private function requestBody(): array } if (null !== $v = $this->imagePullCredentialsTypeOverride) { if (!ImagePullCredentialsType::exists($v)) { - throw new InvalidArgument(sprintf('Invalid parameter "imagePullCredentialsTypeOverride" for "%s". The value "%s" is not a valid "ImagePullCredentialsType".', __CLASS__, $v)); + throw new InvalidArgument(\sprintf('Invalid parameter "imagePullCredentialsTypeOverride" for "%s". The value "%s" is not a valid "ImagePullCredentialsType".', __CLASS__, $v)); } $payload['imagePullCredentialsTypeOverride'] = $v; } diff --git a/src/Input/StopBuildInput.php b/src/Input/StopBuildInput.php index ca1b29d..4998b35 100644 --- a/src/Input/StopBuildInput.php +++ b/src/Input/StopBuildInput.php @@ -83,7 +83,7 @@ private function requestBody(): array { $payload = []; if (null === $v = $this->id) { - throw new InvalidArgument(sprintf('Missing parameter "id" for "%s". The value cannot be null.', __CLASS__)); + throw new InvalidArgument(\sprintf('Missing parameter "id" for "%s". The value cannot be null.', __CLASS__)); } $payload['id'] = $v; diff --git a/src/Result/BatchGetBuildsOutput.php b/src/Result/BatchGetBuildsOutput.php index 724525f..d51c873 100644 --- a/src/Result/BatchGetBuildsOutput.php +++ b/src/Result/BatchGetBuildsOutput.php @@ -78,8 +78,8 @@ private function populateResultBuild(array $json): Build 'id' => isset($json['id']) ? (string) $json['id'] : null, 'arn' => isset($json['arn']) ? (string) $json['arn'] : null, 'buildNumber' => isset($json['buildNumber']) ? (int) $json['buildNumber'] : null, - 'startTime' => (isset($json['startTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['startTime'])))) ? $d : null, - 'endTime' => (isset($json['endTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['endTime'])))) ? $d : null, + 'startTime' => (isset($json['startTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['startTime'])))) ? $d : null, + 'endTime' => (isset($json['endTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['endTime'])))) ? $d : null, 'currentPhase' => isset($json['currentPhase']) ? (string) $json['currentPhase'] : null, 'buildStatus' => isset($json['buildStatus']) ? (string) $json['buildStatus'] : null, 'sourceVersion' => isset($json['sourceVersion']) ? (string) $json['sourceVersion'] : null, @@ -157,8 +157,8 @@ private function populateResultBuildPhase(array $json): BuildPhase return new BuildPhase([ 'phaseType' => isset($json['phaseType']) ? (string) $json['phaseType'] : null, 'phaseStatus' => isset($json['phaseStatus']) ? (string) $json['phaseStatus'] : null, - 'startTime' => (isset($json['startTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['startTime'])))) ? $d : null, - 'endTime' => (isset($json['endTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['endTime'])))) ? $d : null, + 'startTime' => (isset($json['startTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['startTime'])))) ? $d : null, + 'endTime' => (isset($json['endTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['endTime'])))) ? $d : null, 'durationInSeconds' => isset($json['durationInSeconds']) ? (int) $json['durationInSeconds'] : null, 'contexts' => !isset($json['contexts']) ? null : $this->populateResultPhaseContexts($json['contexts']), ]); diff --git a/src/Result/StartBuildOutput.php b/src/Result/StartBuildOutput.php index 9497eaf..9d69a77 100644 --- a/src/Result/StartBuildOutput.php +++ b/src/Result/StartBuildOutput.php @@ -57,8 +57,8 @@ private function populateResultBuild(array $json): Build 'id' => isset($json['id']) ? (string) $json['id'] : null, 'arn' => isset($json['arn']) ? (string) $json['arn'] : null, 'buildNumber' => isset($json['buildNumber']) ? (int) $json['buildNumber'] : null, - 'startTime' => (isset($json['startTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['startTime'])))) ? $d : null, - 'endTime' => (isset($json['endTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['endTime'])))) ? $d : null, + 'startTime' => (isset($json['startTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['startTime'])))) ? $d : null, + 'endTime' => (isset($json['endTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['endTime'])))) ? $d : null, 'currentPhase' => isset($json['currentPhase']) ? (string) $json['currentPhase'] : null, 'buildStatus' => isset($json['buildStatus']) ? (string) $json['buildStatus'] : null, 'sourceVersion' => isset($json['sourceVersion']) ? (string) $json['sourceVersion'] : null, @@ -120,8 +120,8 @@ private function populateResultBuildPhase(array $json): BuildPhase return new BuildPhase([ 'phaseType' => isset($json['phaseType']) ? (string) $json['phaseType'] : null, 'phaseStatus' => isset($json['phaseStatus']) ? (string) $json['phaseStatus'] : null, - 'startTime' => (isset($json['startTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['startTime'])))) ? $d : null, - 'endTime' => (isset($json['endTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['endTime'])))) ? $d : null, + 'startTime' => (isset($json['startTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['startTime'])))) ? $d : null, + 'endTime' => (isset($json['endTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['endTime'])))) ? $d : null, 'durationInSeconds' => isset($json['durationInSeconds']) ? (int) $json['durationInSeconds'] : null, 'contexts' => !isset($json['contexts']) ? null : $this->populateResultPhaseContexts($json['contexts']), ]); diff --git a/src/Result/StopBuildOutput.php b/src/Result/StopBuildOutput.php index f7c3893..4ce4531 100644 --- a/src/Result/StopBuildOutput.php +++ b/src/Result/StopBuildOutput.php @@ -57,8 +57,8 @@ private function populateResultBuild(array $json): Build 'id' => isset($json['id']) ? (string) $json['id'] : null, 'arn' => isset($json['arn']) ? (string) $json['arn'] : null, 'buildNumber' => isset($json['buildNumber']) ? (int) $json['buildNumber'] : null, - 'startTime' => (isset($json['startTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['startTime'])))) ? $d : null, - 'endTime' => (isset($json['endTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['endTime'])))) ? $d : null, + 'startTime' => (isset($json['startTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['startTime'])))) ? $d : null, + 'endTime' => (isset($json['endTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['endTime'])))) ? $d : null, 'currentPhase' => isset($json['currentPhase']) ? (string) $json['currentPhase'] : null, 'buildStatus' => isset($json['buildStatus']) ? (string) $json['buildStatus'] : null, 'sourceVersion' => isset($json['sourceVersion']) ? (string) $json['sourceVersion'] : null, @@ -120,8 +120,8 @@ private function populateResultBuildPhase(array $json): BuildPhase return new BuildPhase([ 'phaseType' => isset($json['phaseType']) ? (string) $json['phaseType'] : null, 'phaseStatus' => isset($json['phaseStatus']) ? (string) $json['phaseStatus'] : null, - 'startTime' => (isset($json['startTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['startTime'])))) ? $d : null, - 'endTime' => (isset($json['endTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['endTime'])))) ? $d : null, + 'startTime' => (isset($json['startTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['startTime'])))) ? $d : null, + 'endTime' => (isset($json['endTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $json['endTime'])))) ? $d : null, 'durationInSeconds' => isset($json['durationInSeconds']) ? (int) $json['durationInSeconds'] : null, 'contexts' => !isset($json['contexts']) ? null : $this->populateResultPhaseContexts($json['contexts']), ]); diff --git a/src/ValueObject/CloudWatchLogsConfig.php b/src/ValueObject/CloudWatchLogsConfig.php index aa054c5..fd1a27a 100644 --- a/src/ValueObject/CloudWatchLogsConfig.php +++ b/src/ValueObject/CloudWatchLogsConfig.php @@ -92,7 +92,7 @@ public function requestBody(): array $payload = []; $v = $this->status; if (!LogsConfigStatusType::exists($v)) { - throw new InvalidArgument(sprintf('Invalid parameter "status" for "%s". The value "%s" is not a valid "LogsConfigStatusType".', __CLASS__, $v)); + throw new InvalidArgument(\sprintf('Invalid parameter "status" for "%s". The value "%s" is not a valid "LogsConfigStatusType".', __CLASS__, $v)); } $payload['status'] = $v; if (null !== $v = $this->groupName) { diff --git a/src/ValueObject/EnvironmentVariable.php b/src/ValueObject/EnvironmentVariable.php index dfbd300..4fff4e2 100644 --- a/src/ValueObject/EnvironmentVariable.php +++ b/src/ValueObject/EnvironmentVariable.php @@ -105,7 +105,7 @@ public function requestBody(): array $payload['value'] = $v; if (null !== $v = $this->type) { if (!EnvironmentVariableType::exists($v)) { - throw new InvalidArgument(sprintf('Invalid parameter "type" for "%s". The value "%s" is not a valid "EnvironmentVariableType".', __CLASS__, $v)); + throw new InvalidArgument(\sprintf('Invalid parameter "type" for "%s". The value "%s" is not a valid "EnvironmentVariableType".', __CLASS__, $v)); } $payload['type'] = $v; } diff --git a/src/ValueObject/ProjectArtifacts.php b/src/ValueObject/ProjectArtifacts.php index eae694e..35a27e3 100644 --- a/src/ValueObject/ProjectArtifacts.php +++ b/src/ValueObject/ProjectArtifacts.php @@ -258,7 +258,7 @@ public function requestBody(): array $payload = []; $v = $this->type; if (!ArtifactsType::exists($v)) { - throw new InvalidArgument(sprintf('Invalid parameter "type" for "%s". The value "%s" is not a valid "ArtifactsType".', __CLASS__, $v)); + throw new InvalidArgument(\sprintf('Invalid parameter "type" for "%s". The value "%s" is not a valid "ArtifactsType".', __CLASS__, $v)); } $payload['type'] = $v; if (null !== $v = $this->location) { @@ -269,7 +269,7 @@ public function requestBody(): array } if (null !== $v = $this->namespaceType) { if (!ArtifactNamespace::exists($v)) { - throw new InvalidArgument(sprintf('Invalid parameter "namespaceType" for "%s". The value "%s" is not a valid "ArtifactNamespace".', __CLASS__, $v)); + throw new InvalidArgument(\sprintf('Invalid parameter "namespaceType" for "%s". The value "%s" is not a valid "ArtifactNamespace".', __CLASS__, $v)); } $payload['namespaceType'] = $v; } @@ -278,7 +278,7 @@ public function requestBody(): array } if (null !== $v = $this->packaging) { if (!ArtifactPackaging::exists($v)) { - throw new InvalidArgument(sprintf('Invalid parameter "packaging" for "%s". The value "%s" is not a valid "ArtifactPackaging".', __CLASS__, $v)); + throw new InvalidArgument(\sprintf('Invalid parameter "packaging" for "%s". The value "%s" is not a valid "ArtifactPackaging".', __CLASS__, $v)); } $payload['packaging'] = $v; } @@ -293,7 +293,7 @@ public function requestBody(): array } if (null !== $v = $this->bucketOwnerAccess) { if (!BucketOwnerAccess::exists($v)) { - throw new InvalidArgument(sprintf('Invalid parameter "bucketOwnerAccess" for "%s". The value "%s" is not a valid "BucketOwnerAccess".', __CLASS__, $v)); + throw new InvalidArgument(\sprintf('Invalid parameter "bucketOwnerAccess" for "%s". The value "%s" is not a valid "BucketOwnerAccess".', __CLASS__, $v)); } $payload['bucketOwnerAccess'] = $v; } diff --git a/src/ValueObject/ProjectCache.php b/src/ValueObject/ProjectCache.php index 1e2b918..bfd29f4 100644 --- a/src/ValueObject/ProjectCache.php +++ b/src/ValueObject/ProjectCache.php @@ -123,7 +123,7 @@ public function requestBody(): array $payload = []; $v = $this->type; if (!CacheType::exists($v)) { - throw new InvalidArgument(sprintf('Invalid parameter "type" for "%s". The value "%s" is not a valid "CacheType".', __CLASS__, $v)); + throw new InvalidArgument(\sprintf('Invalid parameter "type" for "%s". The value "%s" is not a valid "CacheType".', __CLASS__, $v)); } $payload['type'] = $v; if (null !== $v = $this->location) { @@ -135,7 +135,7 @@ public function requestBody(): array foreach ($v as $listValue) { ++$index; if (!CacheMode::exists($listValue)) { - throw new InvalidArgument(sprintf('Invalid parameter "modes" for "%s". The value "%s" is not a valid "CacheMode".', __CLASS__, $listValue)); + throw new InvalidArgument(\sprintf('Invalid parameter "modes" for "%s". The value "%s" is not a valid "CacheMode".', __CLASS__, $listValue)); } $payload['modes'][$index] = $listValue; } diff --git a/src/ValueObject/ProjectSource.php b/src/ValueObject/ProjectSource.php index 6a1cae6..a3d5a4f 100644 --- a/src/ValueObject/ProjectSource.php +++ b/src/ValueObject/ProjectSource.php @@ -262,7 +262,7 @@ public function requestBody(): array $payload = []; $v = $this->type; if (!SourceType::exists($v)) { - throw new InvalidArgument(sprintf('Invalid parameter "type" for "%s". The value "%s" is not a valid "SourceType".', __CLASS__, $v)); + throw new InvalidArgument(\sprintf('Invalid parameter "type" for "%s". The value "%s" is not a valid "SourceType".', __CLASS__, $v)); } $payload['type'] = $v; if (null !== $v = $this->location) { diff --git a/src/ValueObject/RegistryCredential.php b/src/ValueObject/RegistryCredential.php index 2dec86d..56c611e 100644 --- a/src/ValueObject/RegistryCredential.php +++ b/src/ValueObject/RegistryCredential.php @@ -80,7 +80,7 @@ public function requestBody(): array $payload['credential'] = $v; $v = $this->credentialProvider; if (!CredentialProviderType::exists($v)) { - throw new InvalidArgument(sprintf('Invalid parameter "credentialProvider" for "%s". The value "%s" is not a valid "CredentialProviderType".', __CLASS__, $v)); + throw new InvalidArgument(\sprintf('Invalid parameter "credentialProvider" for "%s". The value "%s" is not a valid "CredentialProviderType".', __CLASS__, $v)); } $payload['credentialProvider'] = $v; diff --git a/src/ValueObject/S3LogsConfig.php b/src/ValueObject/S3LogsConfig.php index 54a6d31..67b06c2 100644 --- a/src/ValueObject/S3LogsConfig.php +++ b/src/ValueObject/S3LogsConfig.php @@ -104,7 +104,7 @@ public function requestBody(): array $payload = []; $v = $this->status; if (!LogsConfigStatusType::exists($v)) { - throw new InvalidArgument(sprintf('Invalid parameter "status" for "%s". The value "%s" is not a valid "LogsConfigStatusType".', __CLASS__, $v)); + throw new InvalidArgument(\sprintf('Invalid parameter "status" for "%s". The value "%s" is not a valid "LogsConfigStatusType".', __CLASS__, $v)); } $payload['status'] = $v; if (null !== $v = $this->location) { @@ -115,7 +115,7 @@ public function requestBody(): array } if (null !== $v = $this->bucketOwnerAccess) { if (!BucketOwnerAccess::exists($v)) { - throw new InvalidArgument(sprintf('Invalid parameter "bucketOwnerAccess" for "%s". The value "%s" is not a valid "BucketOwnerAccess".', __CLASS__, $v)); + throw new InvalidArgument(\sprintf('Invalid parameter "bucketOwnerAccess" for "%s". The value "%s" is not a valid "BucketOwnerAccess".', __CLASS__, $v)); } $payload['bucketOwnerAccess'] = $v; } diff --git a/src/ValueObject/SourceAuth.php b/src/ValueObject/SourceAuth.php index b60036f..c3a352b 100644 --- a/src/ValueObject/SourceAuth.php +++ b/src/ValueObject/SourceAuth.php @@ -70,7 +70,7 @@ public function requestBody(): array $payload = []; $v = $this->type; if (!SourceAuthType::exists($v)) { - throw new InvalidArgument(sprintf('Invalid parameter "type" for "%s". The value "%s" is not a valid "SourceAuthType".', __CLASS__, $v)); + throw new InvalidArgument(\sprintf('Invalid parameter "type" for "%s". The value "%s" is not a valid "SourceAuthType".', __CLASS__, $v)); } $payload['type'] = $v; if (null !== $v = $this->resource) {