From d13a5d05a460b36fa18776c337724240c9ba3837 Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Thu, 15 Feb 2024 18:29:07 +0100 Subject: [PATCH] [TASK] Switch the code style checks on CI to PHP 8.3 There is no such thing as a free lunch, but at least there's a free performance gain here. Also format the code according to the latest PHP-CS-Fixer version. --- .github/workflows/tests.yml | 2 +- src/Exception/ExtensionKeyMissingException.php | 4 +--- src/Exception/FormDataProcessingException.php | 4 +--- src/Exception/InvalidComposerJsonException.php | 4 +--- src/Exception/RequiredConfigurationMissing.php | 4 +--- src/Filesystem/VersionReplacer.php | 2 +- src/Service/VersionService.php | 4 ++-- 7 files changed, 8 insertions(+), 16 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6cf24ff..dc16245 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -40,7 +40,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - php: ["8.1"] + php: ["8.3"] steps: - name: Checkout repository uses: actions/checkout@v3 diff --git a/src/Exception/ExtensionKeyMissingException.php b/src/Exception/ExtensionKeyMissingException.php index 80907be..2bb3370 100644 --- a/src/Exception/ExtensionKeyMissingException.php +++ b/src/Exception/ExtensionKeyMissingException.php @@ -12,6 +12,4 @@ namespace TYPO3\Tailor\Exception; -class ExtensionKeyMissingException extends \InvalidArgumentException -{ -} +class ExtensionKeyMissingException extends \InvalidArgumentException {} diff --git a/src/Exception/FormDataProcessingException.php b/src/Exception/FormDataProcessingException.php index c6003e8..8167e60 100644 --- a/src/Exception/FormDataProcessingException.php +++ b/src/Exception/FormDataProcessingException.php @@ -12,6 +12,4 @@ namespace TYPO3\Tailor\Exception; -class FormDataProcessingException extends \RuntimeException -{ -} +class FormDataProcessingException extends \RuntimeException {} diff --git a/src/Exception/InvalidComposerJsonException.php b/src/Exception/InvalidComposerJsonException.php index 46e1ed9..c1b2631 100644 --- a/src/Exception/InvalidComposerJsonException.php +++ b/src/Exception/InvalidComposerJsonException.php @@ -12,6 +12,4 @@ namespace TYPO3\Tailor\Exception; -class InvalidComposerJsonException extends \InvalidArgumentException -{ -} +class InvalidComposerJsonException extends \InvalidArgumentException {} diff --git a/src/Exception/RequiredConfigurationMissing.php b/src/Exception/RequiredConfigurationMissing.php index ceecaf4..c8f7f34 100644 --- a/src/Exception/RequiredConfigurationMissing.php +++ b/src/Exception/RequiredConfigurationMissing.php @@ -12,6 +12,4 @@ namespace TYPO3\Tailor\Exception; -class RequiredConfigurationMissing extends \InvalidArgumentException -{ -} +class RequiredConfigurationMissing extends \InvalidArgumentException {} diff --git a/src/Filesystem/VersionReplacer.php b/src/Filesystem/VersionReplacer.php index fd64263..6c2b009 100644 --- a/src/Filesystem/VersionReplacer.php +++ b/src/Filesystem/VersionReplacer.php @@ -43,7 +43,7 @@ public function setVersion(string $filePath, string $pattern, int $versionPartsT if ($fileContents === false) { throw new \InvalidArgumentException('The file ' . $filePath . ' could not be opened', 1605741968); } - $updatedFileContents = preg_replace_callback('/' . $pattern . '/u', static function ($matches) use ($newVersion) { + $updatedFileContents = preg_replace_callback('/' . $pattern . '/u', static function($matches) use ($newVersion) { return str_replace($matches[1], $newVersion, $matches[0]); }, $fileContents); file_put_contents($filePath, $updatedFileContents); diff --git a/src/Service/VersionService.php b/src/Service/VersionService.php index ca48fc0..69d7316 100644 --- a/src/Service/VersionService.php +++ b/src/Service/VersionService.php @@ -71,7 +71,7 @@ public function createZipArchiveFromPath(string $path): string $iterator = new RecursiveDirectoryIterator($fullPath, FilesystemIterator::SKIP_DOTS); $files = new RecursiveIteratorIterator( - new RecursiveCallbackFilterIterator($iterator, function ($current) use ($fullPath) { + new RecursiveCallbackFilterIterator($iterator, function($current) use ($fullPath) { // @todo Find a more performant way for filtering $filepath = $current->getRealPath(); @@ -204,7 +204,7 @@ protected function getVersionFilename(bool $hash = false): string { $filename = sprintf('%s/%s_%s.zip', $this->transactionPath, $this->extension, $this->version); - return $hash ? md5($filename): $filename; + return $hash ? md5($filename) : $filename; } /**