From 19ef77eaac8faf4566b126b2e0196735757efec3 Mon Sep 17 00:00:00 2001 From: roadiz-ci Date: Fri, 19 Apr 2024 09:48:57 +0000 Subject: [PATCH] chore: Bumped --- .github/workflows/run-test.yml | 2 +- .travis.yml | 19 +++++++++++++++++++ composer.json | 8 ++++---- phpstan.neon | 2 -- src/AbstractDocumentFinder.php | 5 +---- src/DocumentArchiver.php | 14 +++----------- src/DownscaleImageManager.php | 2 +- src/Models/AdvancedDocumentInterface.php | 13 ++++++++++++- src/Models/DocumentInterface.php | 2 +- src/Viewers/SvgDocumentViewer.php | 2 +- 10 files changed, 43 insertions(+), 26 deletions(-) create mode 100644 .travis.yml diff --git a/.github/workflows/run-test.yml b/.github/workflows/run-test.yml index b33d114..01c564c 100644 --- a/.github/workflows/run-test.yml +++ b/.github/workflows/run-test.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-version: ['8.1', '8.2', '8.3'] + php-version: ['8.0', '8.1'] steps: - uses: shivammathur/setup-php@v2 with: diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..61a6d14 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,19 @@ +language: php +sudo: required +php: + - 7.4 + - 8.0 + - 8.1 + - nightly +env: + - XDEBUG_MODE=coverage +install: + - curl -s http://getcomposer.org/installer | php + - php composer.phar install --dev --no-interaction +script: + - vendor/bin/phpcs --report=full --report-file=./report.txt -p ./src + - vendor/bin/atoum -d tests + - vendor/bin/phpstan analyse -c phpstan.neon +jobs: + allow_failures: + - php: nightly diff --git a/composer.json b/composer.json index 3e27fae..a3378da 100644 --- a/composer.json +++ b/composer.json @@ -18,14 +18,14 @@ } ], "require": { - "php": ">=8.1", + "php": ">=8.0", "ext-json": "*", "ext-gd": "*", "ext-dom": "*", "ext-zip": "*", "ext-simplexml": "*", "ext-fileinfo": "*", - "doctrine/orm": "~2.17.0", + "doctrine/orm": "<2.17", "enshrined/svg-sanitize": "^0.15", "guzzlehttp/guzzle": "^7.2.0", "guzzlehttp/psr7": "^2.0", @@ -62,8 +62,8 @@ }, "extra": { "branch-alias": { - "dev-master": "2.2.x-dev", - "dev-develop": "2.3.x-dev" + "dev-master": "2.1.x-dev", + "dev-develop": "2.2.x-dev" } } } diff --git a/phpstan.neon b/phpstan.neon index f4a94cf..273466e 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -17,8 +17,6 @@ parameters: - '#Doctrine\\ORM\\Mapping\\GeneratedValue constructor expects#' - '#type mapping mismatch: property can contain Doctrine\\Common\\Collections\\Collection]+> but database expects Doctrine\\Common\\Collections\\Collection&iterable<[^\>]+>#' - '#should return Doctrine\\Common\\Collections\\Collection]+Interface> but returns Doctrine\\Common\\Collections\\Collection]+>#' - - '#but returns Doctrine\\Common\\Collections\\ReadableCollection]+>#' - - '#does not accept Doctrine\\Common\\Collections\\ReadableCollection]+>#' reportUnmatchedIgnoredErrors: false checkMissingIterableValueType: false checkGenericClassInNonGenericObjectType: false diff --git a/src/AbstractDocumentFinder.php b/src/AbstractDocumentFinder.php index ff42399..e16a500 100644 --- a/src/AbstractDocumentFinder.php +++ b/src/AbstractDocumentFinder.php @@ -53,10 +53,7 @@ public function findPicturesWithFilename(string $fileName): iterable { $pathInfo = pathinfo($fileName); $basename = $pathInfo['filename']; - $currentExtension = $pathInfo['extension'] ?? null; - if (null === $currentExtension) { - return []; - } + $currentExtension = $pathInfo['extension']; $extensionsList = [ 'jpg', 'gif', diff --git a/src/DocumentArchiver.php b/src/DocumentArchiver.php index 2ab4782..f89813f 100644 --- a/src/DocumentArchiver.php +++ b/src/DocumentArchiver.php @@ -24,13 +24,13 @@ public function __construct(FilesystemOperator $documentsStorage) } /** - * @param iterable $documents + * @param array $documents * @param string $name * @param bool $keepFolders * @return string Zip file path * @throws FilesystemException */ - public function archive(iterable $documents, string $name, bool $keepFolders = true): string + public function archive(array $documents, string $name, bool $keepFolders = true): string { $filename = (new AsciiSlugger())->slug($name . ' ' . date('YmdHis'), '_') . '.zip'; $tmpFileName = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $filename; @@ -60,16 +60,8 @@ public function archive(iterable $documents, string $name, bool $keepFolders = t return $tmpFileName; } - /** - * @param iterable $documents - * @param string $name - * @param bool $keepFolders - * @param bool $unlink - * @return BinaryFileResponse - * @throws FilesystemException - */ public function archiveAndServe( - iterable $documents, + array $documents, string $name, bool $keepFolders = true, bool $unlink = true diff --git a/src/DownscaleImageManager.php b/src/DownscaleImageManager.php index aea311c..2807840 100644 --- a/src/DownscaleImageManager.php +++ b/src/DownscaleImageManager.php @@ -97,7 +97,7 @@ public function processDocumentFromExistingRaw(?DocumentInterface $document = nu null !== $this->createDocumentFromImage($document, $processImage, true) && null !== $this->logger ) { - $this->logger->info('Document has been downscaled.', ['path' => $documentPath, 'entity' => $document]); + $this->logger->info('Document has been downscaled.', ['path' => $documentPath]); } } } diff --git a/src/Models/AdvancedDocumentInterface.php b/src/Models/AdvancedDocumentInterface.php index f86ca2b..6755df5 100644 --- a/src/Models/AdvancedDocumentInterface.php +++ b/src/Models/AdvancedDocumentInterface.php @@ -4,8 +4,19 @@ namespace RZ\Roadiz\Documents\Models; -interface AdvancedDocumentInterface extends DocumentInterface, SizeableInterface, DisplayableInterface +interface AdvancedDocumentInterface extends DocumentInterface, SizeableInterface { + /** + * @return string|null + */ + public function getImageAverageColor(): ?string; + + /** + * @param string|null $imageAverageColor + * @return $this + */ + public function setImageAverageColor(?string $imageAverageColor): static; + /** * @return int|null */ diff --git a/src/Models/DocumentInterface.php b/src/Models/DocumentInterface.php index 1f990bf..3936b4f 100644 --- a/src/Models/DocumentInterface.php +++ b/src/Models/DocumentInterface.php @@ -156,7 +156,7 @@ public function setRawDocument(?DocumentInterface $rawDocument = null): static; public function isRaw(): bool; /** - * @param bool $raw the raw + * @param boolean $raw the raw * @return $this */ public function setRaw(bool $raw): static; diff --git a/src/Viewers/SvgDocumentViewer.php b/src/Viewers/SvgDocumentViewer.php index 15746a0..8133ffd 100644 --- a/src/Viewers/SvgDocumentViewer.php +++ b/src/Viewers/SvgDocumentViewer.php @@ -32,7 +32,7 @@ class SvgDocumentViewer * @param FilesystemOperator $documentsStorage * @param DocumentInterface $document * @param array $attributes - * @param bool $asObject Default false + * @param boolean $asObject Default false * @param string $imageUrl Only needed if you set $asObject to true. */ public function __construct(