diff --git a/.github/workflows/recipe.yaml b/.github/workflows/recipe.yaml index 741bdbb..4538bcd 100644 --- a/.github/workflows/recipe.yaml +++ b/.github/workflows/recipe.yaml @@ -14,15 +14,8 @@ jobs: strategy: fail-fast: false matrix: - php: ['8.0', '8.1', '8.2'] - sylius: ["~1.11.0", "~1.12.0", "~1.13.0"] - exclude: - - php: '8.2' - sylius: '~1.11.0' - - php: '8.0' - sylius: '~1.12.0' - - php: '8.0' - sylius: '~1.13.0' + php: ['8.1', '8.2', '8.3'] + sylius: ["~1.12.0", "~1.13.0", "1.14.0"] steps: - name: Setup PHP diff --git a/.github/workflows/security.yaml b/.github/workflows/security.yaml index c100cfa..df6525a 100644 --- a/.github/workflows/security.yaml +++ b/.github/workflows/security.yaml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - php: ['8.1', '8.2'] + php: ['8.1', '8.2', '8.3'] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 877ce6a..35e1014 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - php: ['8.1', '8.2'] + php: ['8.1', '8.2', '8.3'] env: SYMFONY_ARGS: --no-tls diff --git a/.php-version.dist b/.php-version.dist index 2983cad..cf02201 100644 --- a/.php-version.dist +++ b/.php-version.dist @@ -1 +1 @@ -8.2 +8.3 diff --git a/Makefile b/Makefile index 78c4374..addb6ac 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,13 @@ .DEFAULT_GOAL := help SHELL=/bin/bash APP_DIR=tests/Application -SYLIUS_VERSION=1.13.0 +SYLIUS_VERSION=1.14.0 SYMFONY=cd ${APP_DIR} && symfony COMPOSER=symfony composer CONSOLE=${SYMFONY} console export COMPOSE_PROJECT_NAME=media-manager PLUGIN_NAME=sylius-${COMPOSE_PROJECT_NAME}-plugin -COMPOSE=docker-compose +COMPOSE=docker compose YARN=yarn ### diff --git a/README.md b/README.md index 059c294..d83b7cd 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,11 @@ This plugin adds a media manager to your images, videos and other files type fie ## Compatibility -| Sylius Version | PHP Version | -|---|---| -| 1.11 | 8.0 - 8.1 | -| 1.12 | 8.1 - 8.2 | -| 1.13 | 8.1 - 8.2 | +| Sylius Version | PHP Version | +|----------------|-----------------| +| 1.12 | 8.1 - 8.2 - 8.3 | +| 1.13 | 8.1 - 8.2 - 8.3 | +| 1.14 | 8.1 - 8.2 - 8.3 | ## Installation diff --git a/composer.json b/composer.json index 14fd9b0..480313b 100644 --- a/composer.json +++ b/composer.json @@ -5,8 +5,8 @@ "description": "Add a media manager to your Sylius.", "license": "MIT", "require": { - "php": "^8.0", - "sylius/sylius": ">=1.11 <1.14" + "php": "^8.1", + "sylius/sylius": ">=1.11 <2.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.16", diff --git a/src/Exception/CannotReadCurrentFolderException.php b/src/Exception/CannotReadCurrentFolderException.php index 2228376..a2f63df 100644 --- a/src/Exception/CannotReadCurrentFolderException.php +++ b/src/Exception/CannotReadCurrentFolderException.php @@ -22,7 +22,7 @@ final class CannotReadCurrentFolderException extends Exception public function __construct(string $path) { $this->path = $path; - parent::__construct(sprintf('Current folder cannot be opened `%s`', $path)); + parent::__construct(\sprintf('Current folder cannot be opened `%s`', $path)); } public function getPath(): string diff --git a/src/Exception/CannotReadFolderException.php b/src/Exception/CannotReadFolderException.php index 6a8eefc..11b7964 100644 --- a/src/Exception/CannotReadFolderException.php +++ b/src/Exception/CannotReadFolderException.php @@ -22,7 +22,7 @@ final class CannotReadFolderException extends Exception public function __construct(string $path) { $this->path = $path; - parent::__construct(sprintf('Folder cannot be opened `%s`', $path)); + parent::__construct(\sprintf('Folder cannot be opened `%s`', $path)); } public function getPath(): string diff --git a/src/Exception/FileNotCreatedException.php b/src/Exception/FileNotCreatedException.php index d51fbdc..98c07d0 100644 --- a/src/Exception/FileNotCreatedException.php +++ b/src/Exception/FileNotCreatedException.php @@ -25,7 +25,7 @@ public function __construct(string $filename, string $errorMessage) { $this->filename = $filename; $this->errorMessage = $errorMessage; - parent::__construct(sprintf('File `%s` couldn\'t be created. Error : %s', $filename, $errorMessage)); + parent::__construct(\sprintf('File `%s` couldn\'t be created. Error : %s', $filename, $errorMessage)); } public function getFilename(): string diff --git a/src/Exception/FileNotDeletedException.php b/src/Exception/FileNotDeletedException.php index 5ec619e..69b746a 100644 --- a/src/Exception/FileNotDeletedException.php +++ b/src/Exception/FileNotDeletedException.php @@ -22,7 +22,7 @@ final class FileNotDeletedException extends Exception public function __construct(string $filename) { $this->filename = $filename; - parent::__construct(sprintf('File `%s` couldn\'t be deleted', $filename)); + parent::__construct(\sprintf('File `%s` couldn\'t be deleted', $filename)); } public function getFilename(): string diff --git a/src/Exception/FileNotFoundException.php b/src/Exception/FileNotFoundException.php index 8635451..930e7f8 100644 --- a/src/Exception/FileNotFoundException.php +++ b/src/Exception/FileNotFoundException.php @@ -22,7 +22,7 @@ final class FileNotFoundException extends Exception public function __construct(string $path) { $this->path = $path; - parent::__construct(sprintf('File not found `%s`', $path)); + parent::__construct(\sprintf('File not found `%s`', $path)); } public function getPath(): string diff --git a/src/Exception/FileTooBigException.php b/src/Exception/FileTooBigException.php index e7679ca..bdd7b69 100644 --- a/src/Exception/FileTooBigException.php +++ b/src/Exception/FileTooBigException.php @@ -32,7 +32,7 @@ public function __construct(string $filename, int $size, int $maxAllowedSizeByte $this->maxAllowedSizeBytes = $maxAllowedSizeBytes; $this->maxAllowedSize = $maxAllowedSize; parent::__construct( - sprintf( + \sprintf( 'File `%s` couldn\'t be created. File size %s is bigger than %s bytes. (%s)', $filename, $size, diff --git a/src/Exception/FolderNotCreatedException.php b/src/Exception/FolderNotCreatedException.php index 7d81e4f..5f6f77e 100644 --- a/src/Exception/FolderNotCreatedException.php +++ b/src/Exception/FolderNotCreatedException.php @@ -22,7 +22,7 @@ final class FolderNotCreatedException extends Exception public function __construct(string $folder) { $this->folder = $folder; - parent::__construct(sprintf('Folder `%s` couldn\'t be created', $folder)); + parent::__construct(\sprintf('Folder `%s` couldn\'t be created', $folder)); } public function getFolder(): string diff --git a/src/Exception/FolderNotDeletedException.php b/src/Exception/FolderNotDeletedException.php index 474bfe2..641b38f 100644 --- a/src/Exception/FolderNotDeletedException.php +++ b/src/Exception/FolderNotDeletedException.php @@ -22,7 +22,7 @@ final class FolderNotDeletedException extends Exception public function __construct(string $folder) { $this->folder = $folder; - parent::__construct(sprintf('Folder `%s` couldn\'t be deleted', $folder)); + parent::__construct(\sprintf('Folder `%s` couldn\'t be deleted', $folder)); } public function getFolder(): string diff --git a/src/Exception/FolderNotRenamedException.php b/src/Exception/FolderNotRenamedException.php index 9eac2a5..048be66 100644 --- a/src/Exception/FolderNotRenamedException.php +++ b/src/Exception/FolderNotRenamedException.php @@ -22,7 +22,7 @@ final class FolderNotRenamedException extends Exception public function __construct(string $folder) { $this->folder = $folder; - parent::__construct(sprintf('Folder `%s` couldn\'t be renamed', $folder)); + parent::__construct(\sprintf('Folder `%s` couldn\'t be renamed', $folder)); } public function getFolder(): string diff --git a/src/Exception/InvalidMimeTypeException.php b/src/Exception/InvalidMimeTypeException.php index aca0f86..cea8b12 100644 --- a/src/Exception/InvalidMimeTypeException.php +++ b/src/Exception/InvalidMimeTypeException.php @@ -26,7 +26,7 @@ public function __construct(array $allowedMimeTypes, string $mimeType) $this->allowedMimeTypes = $allowedMimeTypes; $this->mimeType = $mimeType; - parent::__construct(sprintf( + parent::__construct(\sprintf( 'Invalid mime type. Excepted one of %s, `%s` given', implode(', ', $allowedMimeTypes), $mimeType diff --git a/src/Exception/InvalidTypeException.php b/src/Exception/InvalidTypeException.php index 1c1a123..1e295e1 100644 --- a/src/Exception/InvalidTypeException.php +++ b/src/Exception/InvalidTypeException.php @@ -26,7 +26,7 @@ public function __construct(string $type, array $allowedTypes) $this->type = $type; $this->allowedTypes = $allowedTypes; - parent::__construct(sprintf('Invalid type `%s`, allowed types : %s', $type, implode(', ', $allowedTypes))); + parent::__construct(\sprintf('Invalid type `%s`, allowed types : %s', $type, implode(', ', $allowedTypes))); } public function getType(): string diff --git a/src/Helper/FileHelper.php b/src/Helper/FileHelper.php index 8b27788..134fd11 100644 --- a/src/Helper/FileHelper.php +++ b/src/Helper/FileHelper.php @@ -208,11 +208,11 @@ public function upload(UploadedFile $file, string $path, ?string $folder = null) $fileName = mb_strtolower($fileName, 'UTF-8'); // Build final path and loop if the file already exists - $finalName = sprintf('%s.%s', $fileName, $extension); + $finalName = \sprintf('%s.%s', $fileName, $extension); $filePath = $this->getFullPath($path) . '/' . $finalName; $count = 1; while (file_exists($filePath)) { - $finalName = sprintf('%s_%d.%s', $fileName, $count++, $extension); + $finalName = \sprintf('%s_%d.%s', $fileName, $count++, $extension); $filePath = $this->getFullPath($path) . '/' . $finalName; } diff --git a/src/Twig/Extension/FilterExtensionDecorator.php b/src/Twig/Extension/FilterExtensionDecorator.php index 6738a1c..16eef53 100644 --- a/src/Twig/Extension/FilterExtensionDecorator.php +++ b/src/Twig/Extension/FilterExtensionDecorator.php @@ -51,8 +51,8 @@ public function filter( $dataRoots = $this->loaders['default']['filesystem']['data_root'] ?? ['/media/image/']; foreach (array_unique($dataRoots) as $imagePath) { - if (!$this->canImageBeFiltered($path) && file_exists(sprintf('%s/%s', $imagePath, $path))) { - return str_replace($this->publicDir, '', sprintf('%s/%s', $imagePath, $path)); + if (!$this->canImageBeFiltered($path) && file_exists(\sprintf('%s/%s', $imagePath, $path))) { + return str_replace($this->publicDir, '', \sprintf('%s/%s', $imagePath, $path)); } }