From 2c77f9917cdfe86a9a46e844786793cad1940932 Mon Sep 17 00:00:00 2001
From: FilipHoracek
Date: Fri, 30 Oct 2026 12:13:18 +0100
Subject: [PATCH] SLS-183: Imgproxy: Symfony 8 support
---
.circleci/config.yml | 81 ------------
.docker/php/Dockerfile | 2 +-
.github/workflows/ci.yml | 120 ++++++++++++++++++
CHANGELOG.md | 23 ++++
Makefile | 6 +-
README.md | 60 +++++----
composer.json | 29 +++--
ecs.php | 30 ++---
phpstan.neon | 7 +
phpunit.xml.dist | 9 +-
rector.php | 7 +-
.../Cache/Resolver/ImgproxyCacheResolver.php | 2 +-
src/Imagine/Filter/FilterConfigConverter.php | 2 +-
src/Imagine/ImgproxyUrlBuilder.php | 10 +-
.../config/packages/three_brs_imgproxy.yaml | 2 +-
tests/Integration/App/TestKernel.php | 12 +-
.../BundleIntegrationTest.php | 7 +-
tests/Integration/FullFlowIntegrationTest.php | 1 -
tests/Integration/IntegrationTestCase.php | 6 +
.../LiipImagineIntegrationTest.php | 1 -
.../Resolver/ImgproxyCacheResolverTest.php | 10 +-
.../Filter/FilterConfigConverterTest.php | 8 +-
22 files changed, 259 insertions(+), 176 deletions(-)
delete mode 100644 .circleci/config.yml
create mode 100644 .github/workflows/ci.yml
diff --git a/.circleci/config.yml b/.circleci/config.yml
deleted file mode 100644
index 1da2c25..0000000
--- a/.circleci/config.yml
+++ /dev/null
@@ -1,81 +0,0 @@
-version: 2.1
-
-workflows:
- symfony-php8.0+:
- jobs:
- - build:
- name: php-<>-symfony-<< matrix.symfony_version >>
- matrix:
- parameters:
- php_version: [ "8.0", "8.1", "8.2", "8.3", "8.4" ]
- symfony_version: [ "5.4", "6.4", "7.1" ]
- exclude:
- # Symfony 6.4 requires PHP 8.1+
- - php_version: "8.0"
- symfony_version: "6.4"
- # Symfony 7.x requires PHP 8.2+
- - php_version: "8.0"
- symfony_version: "7.1"
- - php_version: "8.1"
- symfony_version: "7.1"
-
-jobs:
- build:
- parameters:
- symfony_version:
- type: string
- php_version:
- type: string
- docker:
- - image: cimg/php:<< parameters.php_version >>
-
- steps:
- - checkout
-
- # Install specific Symfony version
- - run: |
- grep -o -E '"(symfony/[^"]+)"' composer.json | \
- grep -v -E '(symfony/flex|symfony/translation-contracts)' | \
- xargs printf '%s:<< parameters.symfony_version >>.* ' | \
- xargs composer require --no-interaction --no-update || true
-
- # Adjust dependencies based on PHP version
- - run: |
- # Remove deptrac on PHP 8.0 (requires PHP 8.1+)
- if [ "<< parameters.php_version >>" = "8.0" ]; then
- composer remove deptrac/deptrac --dev --no-update --no-interaction
- fi
-
- # On PHP 8.4: Upgrade PHPStan to 2.x and remove Rector (PHPStan 1.x doesn't support PHP 8.4)
- if [ "<< parameters.php_version >>" = "8.4" ]; then
- composer remove rector/rector --dev --no-update --no-interaction
- composer require phpstan/phpstan:"^2.0" phpstan/phpstan-symfony:"^2.0" --dev --no-update --no-interaction
- fi
-
- # Test with prefer-lowest (oldest compatible dependencies)
- - run: composer update --no-interaction --prefer-lowest --prefer-stable
- - run: vendor/bin/phpunit --no-coverage
- - run: composer ecs
- - run: composer phpstan
- - run: |
- if [ -f vendor/bin/deptrac ]; then
- composer deptrac
- fi
- - run: |
- if [ -f vendor/bin/rector ]; then
- composer rector
- fi
-
- # Test with prefer-stable (latest compatible dependencies)
- - run: composer update --no-interaction --prefer-stable
- - run: vendor/bin/phpunit --no-coverage
- - run: composer ecs
- - run: composer phpstan
- - run: |
- if [ -f vendor/bin/deptrac ]; then
- composer deptrac
- fi
- - run: |
- if [ -f vendor/bin/rector ]; then
- composer rector
- fi
diff --git a/.docker/php/Dockerfile b/.docker/php/Dockerfile
index 6366597..4e0a74e 100644
--- a/.docker/php/Dockerfile
+++ b/.docker/php/Dockerfile
@@ -1,6 +1,6 @@
FROM node:20-alpine AS node
-FROM ghcr.io/sylius/sylius-php:8.3-xdebug-alpine
+FROM ghcr.io/sylius/sylius-php:8.5-xdebug-alpine
RUN apk add --no-cache \
bash \
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..68ab3ff
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,120 @@
+name: CI
+
+on:
+ push:
+ branches: [ main ]
+ pull_request:
+ branches: [ main ]
+ # Tests the latest releases of the dependencies also without a push.
+ schedule:
+ - cron: "0 6 * * 1"
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+defaults:
+ run:
+ # An explicit bash shell runs with -o pipefail, the default one does not.
+ shell: bash
+
+jobs:
+ test:
+ name: PHP ${{ matrix.php }} / Symfony ${{ matrix.symfony }}
+ runs-on: ubuntu-latest
+
+ strategy:
+ fail-fast: false
+ matrix:
+ php: [ "8.1", "8.2", "8.3", "8.4", "8.5" ]
+ # "8" is pinned as 8.*: the lowest run installs 8.0, the stable run the latest 8.x
+ symfony: [ "5.4", "6.4", "7.4", "8" ]
+ exclude:
+ # Symfony 7.x requires PHP 8.2+
+ - php: "8.1"
+ symfony: "7.4"
+ # Symfony 8.x requires PHP 8.4+
+ - php: "8.1"
+ symfony: "8"
+ - php: "8.2"
+ symfony: "8"
+ - php: "8.3"
+ symfony: "8"
+
+ env:
+ # Symfony Flex restricts all Symfony components, including indirect dependencies, to this version
+ SYMFONY_REQUIRE: ${{ matrix.symfony }}.*
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v7
+
+ - name: Setup PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: ${{ matrix.php }}
+ extensions: gd
+ coverage: none
+
+ - name: Validate composer.json
+ if: matrix.php == '8.5' && matrix.symfony == '8'
+ run: composer validate --strict
+
+ - name: Install Symfony Flex
+ run: |
+ composer global config --no-plugins allow-plugins.symfony/flex true
+ composer global require --no-interaction --no-progress --no-scripts --no-plugins symfony/flex
+
+ - name: Get the Composer cache directory
+ id: composer-cache
+ run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
+
+ - name: Cache Composer packages
+ uses: actions/cache@v6
+ with:
+ path: ${{ steps.composer-cache.outputs.dir }}
+ key: composer-php${{ matrix.php }}-symfony${{ matrix.symfony }}-${{ hashFiles('composer.json') }}
+ restore-keys: composer-php${{ matrix.php }}-symfony${{ matrix.symfony }}-
+
+ # Lowest compatible dependencies
+ - name: Install the lowest dependencies
+ env:
+ # Composer 2.9+ leaves out versions with security advisories, which would raise the lowest versions.
+ # Composer 2.10+ reads COMPOSER_NO_BLOCKING, 2.9.2+ reads COMPOSER_NO_SECURITY_BLOCKING.
+ COMPOSER_NO_BLOCKING: "1"
+ COMPOSER_NO_SECURITY_BLOCKING: "1"
+ run: composer update --no-interaction --no-progress --prefer-lowest --prefer-stable
+
+ - name: PHPUnit (lowest)
+ run: vendor/bin/phpunit --no-coverage
+
+ - name: ECS (lowest)
+ run: composer ecs
+
+ - name: PHPStan (lowest)
+ run: composer phpstan
+
+ - name: Deptrac (lowest)
+ run: composer deptrac
+
+ - name: Rector (lowest)
+ run: composer rector
+
+ # Latest compatible dependencies
+ - name: Install the latest dependencies
+ run: composer update --no-interaction --no-progress --prefer-stable
+
+ - name: PHPUnit (stable)
+ run: vendor/bin/phpunit --no-coverage
+
+ - name: ECS (stable)
+ run: composer ecs
+
+ - name: PHPStan (stable)
+ run: composer phpstan
+
+ - name: Deptrac (stable)
+ run: composer deptrac
+
+ - name: Rector (stable)
+ run: composer rector
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 10b98f5..1baba49 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,28 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [1.1.0] - 2026-10-30
+
+### Added
+- Symfony 8 support (requires PHP 8.4+ and Liip Imagine Bundle 2.16+)
+- PHP 8.5 support
+
+### Changed
+- CI moved from CircleCI to GitHub Actions
+- CI tests PHP 8.1–8.5 with Symfony 5.4, 6.4, 7.4 and 8.x; Symfony 7.4 replaces 7.1 in the matrix
+- CI restricts all Symfony components to the tested Symfony version with Symfony Flex (`SYMFONY_REQUIRE`)
+- Development tools: PHPStan 2, Rector 2, ECS 13, Deptrac 2–4, PHPUnit 10.5+
+- `phpunit.xml.dist` uses the PHPUnit 10.5 schema and tests declare data providers with attributes
+- Docker development image uses PHP 8.5
+
+### Removed
+- PHP 8.0 support: PHP 8.0 reached end of life in November 2023, and Twig releases without security advisories require PHP 8.1. PHP 8.0 is supported by the 1.0.x releases.
+
+### Technical Requirements
+- PHP 8.1, 8.2, 8.3, 8.4, or 8.5
+- Symfony 5.4, 6.x, 7.x, or 8.x
+- Liip Imagine Bundle ^2.0
+
## [1.0.0] - 2024-10-29
### Added
@@ -66,4 +88,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Docker Compose setup for local development
- Integration test examples
+[1.1.0]: https://github.com/3brs/imgproxy-bundle/compare/v1.0.0...v1.1.0
[1.0.0]: https://github.com/3brs/imgproxy-bundle/releases/tag/v1.0.0
diff --git a/Makefile b/Makefile
index ffc2809..5297528 100644
--- a/Makefile
+++ b/Makefile
@@ -27,7 +27,7 @@ test: ## Run all tests (PHPUnit + ECS + PHPStan + Deptrac)
docker compose exec php vendor/bin/phpunit --no-coverage
docker compose exec php composer ecs
docker compose exec php composer phpstan
- @docker compose exec php bash -c 'if [ -f vendor/bin/deptrac ]; then composer deptrac; else echo "Deptrac skipped (requires PHP 8.1+)"; fi'
+ docker compose exec php composer deptrac
phpunit: ## Run PHPUnit tests
docker compose exec php vendor/bin/phpunit --no-coverage
@@ -56,7 +56,7 @@ phpstan: ## Run PHPStan static analysis
phpstan-baseline: ## Generate PHPStan baseline
docker compose exec php composer phpstan-baseline
-deptrac: ## Run Deptrac architecture analysis (requires PHP 8.1+)
+deptrac: ## Run Deptrac architecture analysis
docker compose exec php composer deptrac
rector: ## Check code for automated refactoring opportunities
@@ -65,7 +65,7 @@ rector: ## Check code for automated refactoring opportunities
rector-fix: ## Apply automated refactorings
docker compose exec php composer rector-fix
-infection: ## Run mutation testing (requires PHP 8.1+ and infection package)
+infection: ## Run mutation testing (requires the infection package)
docker compose exec -e XDEBUG_MODE=coverage php vendor/bin/infection --threads=4
build: ## Rebuild Docker images
diff --git a/README.md b/README.md
index a4302ee..8a69679 100644
--- a/README.md
+++ b/README.md
@@ -13,8 +13,8 @@
-
-
+
+
@@ -31,9 +31,9 @@
## Requirements
-- PHP 8.0, 8.1, 8.2, 8.3, or 8.4
-- Symfony 5.4, 6.4, or 7.1
-- Liip Imagine Bundle 2.x
+- PHP 8.1, 8.2, 8.3, 8.4, or 8.5 (PHP 8.0 is supported by the 1.0.x releases: `composer require 3brs/imgproxy-bundle:~1.0.0`)
+- Symfony 5.4, 6.x, 7.x, or 8.x (Symfony 8 requires PHP 8.4+)
+- Liip Imagine Bundle 2.x (Symfony 8 requires 2.16+)
- Running imgproxy server
## Installation
@@ -221,14 +221,10 @@ git clone https://github.com/3BRS/imgproxy-bundle.git
cd imgproxy-bundle
```
-2. Install dependencies:
-```bash
-composer install
-```
-
-3. Start Docker environment:
+2. Start the Docker environment (PHP 8.5) and install dependencies:
```bash
make up
+make install
```
### Available Make Commands
@@ -243,7 +239,7 @@ make phpunit-coverage # Run tests with coverage report
make ecs # Check code style
make ecs-fix # Fix code style issues
make phpstan # Run static analysis
-make deptrac # Run architecture analysis (requires PHP 8.1+)
+make deptrac # Run architecture analysis
make rector # Check for automated refactoring opportunities
make rector-fix # Apply automated refactorings
make audit # Check for security vulnerabilities (optional)
@@ -259,10 +255,10 @@ Run the complete test suite:
make test
# Or run individually
-make phpunit # Unit tests
+make phpunit # Unit and integration tests
make ecs # Code style check
make phpstan # Static analysis
-make deptrac # Architecture analysis (PHP 8.1+)
+make deptrac # Architecture analysis
```
### Test Suite
@@ -311,9 +307,7 @@ make rector-fix
- ✅ Symfony/PHPUnit best practices
**Notes:**
-- Rector maintains PHP 8.0 compatibility while using modern syntax
-- Rector requires PHPStan 1.x, which doesn't support PHP 8.4
-- On PHP 8.4, use PHPStan 2.x instead (Rector will be unavailable)
+- Rector keeps the code compatible with PHP 8.1, the lowest supported version
### Security Audit
@@ -339,19 +333,27 @@ The audit checks dependencies against the [PHP Security Advisories Database](htt
### Continuous Integration
-The project uses CircleCI to test against multiple PHP and Symfony versions:
+GitHub Actions (`.github/workflows/ci.yml`) runs on pushes and pull requests to `main`, every Monday at 06:00 UTC (so that a new release of a dependency that breaks the bundle shows up without a change in the repository), and manually via `workflow_dispatch`.
+
+The matrix has one job for every combination of:
+
+- **PHP versions**: 8.1, 8.2, 8.3, 8.4, 8.5
+- **Symfony versions**: 5.4, 6.4, 7.4, 8.x (Symfony 7.4 on PHP 8.2+, 8.x on PHP 8.4+)
-- **PHP versions**: 8.0, 8.1, 8.2, 8.3, 8.4
-- **Symfony versions**: 5.4, 6.4, 7.1
-- **Dependency strategies**: `--prefer-lowest` and `--prefer-stable`
+Each job installs the dependencies with `--prefer-lowest` and runs the checks, then installs them with `--prefer-stable` and runs the checks again.
-Each CI build runs:
-1. **PHPUnit** - 106 tests with 381 assertions (unit + integration)
+Symfony Flex (`SYMFONY_REQUIRE`) restricts all Symfony components, including indirect dependencies, to the tested version. For Symfony 8.x, `--prefer-lowest` installs 8.0 and `--prefer-stable` the latest 8.x release.
+
+The `--prefer-lowest` install sets `COMPOSER_NO_BLOCKING=1` and `COMPOSER_NO_SECURITY_BLOCKING=1`: Composer 2.9+ leaves out versions with security advisories, which would raise the lowest versions.
+
+The job with PHP 8.5 and Symfony 8.x also runs `composer validate --strict`.
+
+The checks are:
+1. **PHPUnit** - 106 tests (unit + integration)
2. **ECS** - Code style checks (PSR-12)
3. **PHPStan** - Static analysis (level 8)
-4. **Deptrac** - Architecture validation (PHP 8.1+ only)
-5. **Rector** - Code modernization checks (PHP 8.0-8.3)
-6. **Infection** - Mutation testing for code quality
+4. **Deptrac** - Architecture validation
+5. **Rector** - Code modernization checks
**Architecture Layers:**
@@ -360,10 +362,6 @@ The project uses Deptrac to enforce clean architecture:
- **DependencyInjection** - Service configuration (can depend on Imagine)
- **Imagine** - Core business logic (independent, no external dependencies)
-**Version-specific tools:**
-- **PHP 8.0**: Deptrac skipped (requires PHP 8.1+)
-- **PHP 8.4**: Rector skipped (PHPStan 2.x required for PHP 8.4, which conflicts with Rector 1.x)
-
## Contributing
We welcome contributions! Please follow these guidelines:
@@ -382,7 +380,7 @@ All contributions must pass our quality gates:
- **PSR-12** coding standards (enforced by ECS)
- **PHPStan level 8** static analysis
-- **Deptrac** architecture validation (PHP 8.1+)
+- **Deptrac** architecture validation
- **Rector** code modernization (optional but recommended)
- Write meaningful commit messages
- Add tests for new features
diff --git a/composer.json b/composer.json
index 12e649d..df5fd25 100644
--- a/composer.json
+++ b/composer.json
@@ -17,23 +17,24 @@
}
],
"require": {
- "php": "^8",
- "symfony/config": "^5.4 || ^6.0 || ^7.0",
- "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0",
- "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0",
- "symfony/string": "^5.4 || ^6.0 || ^7.0",
+ "php": "^8.1",
+ "symfony/config": "^5.4 || ^6.0 || ^7.0 || ^8.0",
+ "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0 || ^8.0",
+ "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0 || ^8.0",
+ "symfony/string": "^5.4 || ^6.0 || ^7.0 || ^8.0",
"symfony/translation-contracts": "^2.5 || ^3.0",
"liip/imagine-bundle": "^2.0"
},
"require-dev": {
- "symplify/easy-coding-standard": "^12.1",
- "phpstan/phpstan": "^1.10|^2.0",
+ "symplify/easy-coding-standard": "^13.0",
+ "phpstan/phpstan": "^2.1.13",
"phpstan/extension-installer": "^1.4",
- "phpstan/phpstan-symfony": "^1.3|^2.0",
- "phpunit/phpunit": "^9.6|^10.0|^11.0",
- "deptrac/deptrac": "^2.0",
- "rector/rector": "^1.0",
- "symfony/yaml": "^5.4 || ^6.0 || ^7.0"
+ "phpstan/phpstan-symfony": "^2.0.9",
+ "phpunit/phpunit": "^10.5 || ^11.0",
+ "deptrac/deptrac": "^2.0 || ^3.0 || ^4.0",
+ "rector/rector": "^2.6",
+ "symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0 || ^8.0",
+ "symfony/yaml": "^5.4 || ^6.0 || ^7.0 || ^8.0"
},
"autoload": {
"psr-4": {
@@ -59,11 +60,11 @@
"rector-fix": "rector process"
},
"suggest": {
- "infection/infection": "Mutation testing framework (requires PHP 8.1+)"
+ "infection/infection": "Mutation testing framework"
},
"extra": {
"branch-alias": {
- "dev-main": "1.0-dev"
+ "dev-main": "1.1-dev"
}
},
"config": {
diff --git a/ecs.php b/ecs.php
index 4a0e906..532ebad 100644
--- a/ecs.php
+++ b/ecs.php
@@ -12,20 +12,20 @@
use PhpCsFixer\Fixer\Whitespace\MethodChainingIndentationFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;
-return static function (ECSConfig $ecsConfig): void {
- $ecsConfig->paths([
+return ECSConfig::configure()
+ ->withPaths([
__DIR__ . '/src',
- ]);
-
- // PSR-12 rules
- $ecsConfig->rule(ClassInstantiationSniff::class);
+ ])
+ ->withRules([
+ // PSR-12 rules
+ ClassInstantiationSniff::class,
- // Clean code rules
- $ecsConfig->rule(ArraySyntaxFixer::class);
- $ecsConfig->rule(NoUnusedImportsFixer::class);
- $ecsConfig->rule(OrderedClassElementsFixer::class);
- $ecsConfig->rule(NoEmptyPhpdocFixer::class);
- $ecsConfig->rule(NoSuperfluousPhpdocTagsFixer::class);
- $ecsConfig->rule(MethodChainingIndentationFixer::class);
- $ecsConfig->rule(NotOperatorWithSuccessorSpaceFixer::class);
-};
+ // Clean code rules
+ ArraySyntaxFixer::class,
+ NoUnusedImportsFixer::class,
+ OrderedClassElementsFixer::class,
+ NoEmptyPhpdocFixer::class,
+ NoSuperfluousPhpdocTagsFixer::class,
+ MethodChainingIndentationFixer::class,
+ NotOperatorWithSuccessorSpaceFixer::class,
+ ]);
diff --git a/phpstan.neon b/phpstan.neon
index 0768e88..c90c3cd 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -9,3 +9,10 @@ parameters:
# Type coverage
reportUnmatchedIgnoredErrors: false
+
+ ignoreErrors:
+ # Symfony 7.4.0 and 8.0.0 declare the TreeBuilder template without a default type
+ -
+ message: '#generic class Symfony\\Component\\Config\\Definition\\Builder\\TreeBuilder does not specify its types: T$#'
+ identifier: missingType.generics
+ path: src/DependencyInjection/Configuration.php
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 0171703..335986d 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -1,9 +1,9 @@
@@ -17,10 +17,13 @@
-
+
src
+
+
+
diff --git a/rector.php b/rector.php
index 86aa18f..c77f836 100644
--- a/rector.php
+++ b/rector.php
@@ -18,16 +18,15 @@
__DIR__ . '/var',
__DIR__ . '/vendor',
])
- // PHP 8.0 as baseline (maintain backward compatibility)
- ->withPhpSets(php80: true)
+ // PHP 8.1 as baseline (lowest supported PHP version)
+ ->withPhpSets(php81: true)
// Symfony sets
->withSets([
- LevelSetList::UP_TO_PHP_80,
+ LevelSetList::UP_TO_PHP_81,
SetList::CODE_QUALITY,
SetList::DEAD_CODE,
SetList::TYPE_DECLARATION,
SetList::EARLY_RETURN,
- SymfonySetList::SYMFONY_54,
SymfonySetList::SYMFONY_CODE_QUALITY,
SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
diff --git a/src/Imagine/Cache/Resolver/ImgproxyCacheResolver.php b/src/Imagine/Cache/Resolver/ImgproxyCacheResolver.php
index 5b8674a..172ce71 100644
--- a/src/Imagine/Cache/Resolver/ImgproxyCacheResolver.php
+++ b/src/Imagine/Cache/Resolver/ImgproxyCacheResolver.php
@@ -14,7 +14,7 @@
*/
class ImgproxyCacheResolver implements ResolverInterface
{
- public function __construct(private ImgproxyUrlBuilderInterface $urlBuilder, private FilterConfigConverterInterface $configConverter)
+ public function __construct(private readonly ImgproxyUrlBuilderInterface $urlBuilder, private readonly FilterConfigConverterInterface $configConverter)
{
}
diff --git a/src/Imagine/Filter/FilterConfigConverter.php b/src/Imagine/Filter/FilterConfigConverter.php
index 37b0cc5..4e757c1 100644
--- a/src/Imagine/Filter/FilterConfigConverter.php
+++ b/src/Imagine/Filter/FilterConfigConverter.php
@@ -11,7 +11,7 @@
*/
class FilterConfigConverter implements FilterConfigConverterInterface
{
- public function __construct(private FilterConfiguration $filterConfig)
+ public function __construct(private readonly FilterConfiguration $filterConfig)
{
}
diff --git a/src/Imagine/ImgproxyUrlBuilder.php b/src/Imagine/ImgproxyUrlBuilder.php
index badf269..80dd6c0 100644
--- a/src/Imagine/ImgproxyUrlBuilder.php
+++ b/src/Imagine/ImgproxyUrlBuilder.php
@@ -9,18 +9,18 @@
*/
class ImgproxyUrlBuilder implements ImgproxyUrlBuilderInterface
{
- private string $baseUrl;
+ private readonly string $baseUrl;
- private string $sourceBaseUrl;
+ private readonly string $sourceBaseUrl;
- private string $sourcePrefix;
+ private readonly string $sourcePrefix;
public function __construct(
string $baseUrl,
string $sourceBaseUrl,
string $sourcePrefix = '',
- private ?string $key = null,
- private ?string $salt = null,
+ private readonly ?string $key = null,
+ private readonly ?string $salt = null,
) {
$this->baseUrl = rtrim($baseUrl, '/');
$this->sourceBaseUrl = rtrim($sourceBaseUrl, '/');
diff --git a/src/Resources/config/packages/three_brs_imgproxy.yaml b/src/Resources/config/packages/three_brs_imgproxy.yaml
index 4d21ad4..a34e9fe 100644
--- a/src/Resources/config/packages/three_brs_imgproxy.yaml
+++ b/src/Resources/config/packages/three_brs_imgproxy.yaml
@@ -2,7 +2,7 @@
# Copy this file to your project's config/packages/ directory
#
# Installation:
-# cp vendor/3brs/imgproxy-bundle/config/packages/three_brs_imgproxy.yaml config/packages/
+# cp vendor/3brs/imgproxy-bundle/src/Resources/config/packages/three_brs_imgproxy.yaml config/packages/
#
# Then edit the values below to match your environment
diff --git a/tests/Integration/App/TestKernel.php b/tests/Integration/App/TestKernel.php
index 3fa2513..ad3a6b6 100644
--- a/tests/Integration/App/TestKernel.php
+++ b/tests/Integration/App/TestKernel.php
@@ -5,6 +5,7 @@
namespace ThreeBRS\ImgproxyBundle\Tests\Integration\App;
use Liip\ImagineBundle\LiipImagineBundle;
+use Liip\ImagineBundle\Templating\LazyFilterRuntime;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Loader\LoaderInterface;
@@ -84,7 +85,7 @@ protected function configureContainer(ContainerBuilder $container, LoaderInterfa
]);
// Liip Imagine Bundle configuration
- $container->loadFromExtension('liip_imagine', [
+ $liipConfig = [
'resolvers' => [
'default' => [
'web_path' => [],
@@ -121,7 +122,14 @@ protected function configureContainer(ContainerBuilder $container, LoaderInterfa
],
],
],
- ]);
+ ];
+
+ // Liip Imagine 2.7+ deprecates the default "legacy" Twig mode
+ if (class_exists(LazyFilterRuntime::class)) {
+ $liipConfig['twig'] = ['mode' => 'none'];
+ }
+
+ $container->loadFromExtension('liip_imagine', $liipConfig);
// Imgproxy Bundle configuration
if ($this->bundleConfig !== []) {
diff --git a/tests/Integration/DependencyInjection/BundleIntegrationTest.php b/tests/Integration/DependencyInjection/BundleIntegrationTest.php
index 17eb335..3e3b113 100644
--- a/tests/Integration/DependencyInjection/BundleIntegrationTest.php
+++ b/tests/Integration/DependencyInjection/BundleIntegrationTest.php
@@ -5,12 +5,13 @@
namespace ThreeBRS\ImgproxyBundle\Tests\Integration\DependencyInjection;
use Liip\ImagineBundle\Imagine\Cache\Resolver\ResolverInterface;
-use Liip\ImagineBundle\Imagine\Filter\FilterConfiguration;
+use Symfony\Component\DependencyInjection\ContainerInterface;
use ThreeBRS\ImgproxyBundle\Imagine\Cache\Resolver\ImgproxyCacheResolver;
use ThreeBRS\ImgproxyBundle\Imagine\Filter\FilterConfigConverter;
use ThreeBRS\ImgproxyBundle\Imagine\Filter\FilterConfigConverterInterface;
use ThreeBRS\ImgproxyBundle\Imagine\ImgproxyUrlBuilder;
use ThreeBRS\ImgproxyBundle\Imagine\ImgproxyUrlBuilderInterface;
+use ThreeBRS\ImgproxyBundle\Tests\Integration\App\TestKernel;
use ThreeBRS\ImgproxyBundle\Tests\Integration\IntegrationTestCase;
/**
@@ -27,8 +28,8 @@ public function testBundleBootsSuccessfully(): void
$this->bootKernel($config);
- $this->assertNotNull($this->kernel);
- $this->assertNotNull($this->container);
+ $this->assertInstanceOf(TestKernel::class, $this->kernel);
+ $this->assertInstanceOf(ContainerInterface::class, $this->container);
}
public function testBundleRegistersAllServices(): void
diff --git a/tests/Integration/FullFlowIntegrationTest.php b/tests/Integration/FullFlowIntegrationTest.php
index 5d1da57..b8ec539 100644
--- a/tests/Integration/FullFlowIntegrationTest.php
+++ b/tests/Integration/FullFlowIntegrationTest.php
@@ -4,7 +4,6 @@
namespace ThreeBRS\ImgproxyBundle\Tests\Integration;
-use Liip\ImagineBundle\Binary\BinaryInterface;
use ThreeBRS\ImgproxyBundle\Imagine\Cache\Resolver\ImgproxyCacheResolver;
use ThreeBRS\ImgproxyBundle\Imagine\Filter\FilterConfigConverterInterface;
use ThreeBRS\ImgproxyBundle\Imagine\ImgproxyUrlBuilderInterface;
diff --git a/tests/Integration/IntegrationTestCase.php b/tests/Integration/IntegrationTestCase.php
index cdc137f..44e693c 100644
--- a/tests/Integration/IntegrationTestCase.php
+++ b/tests/Integration/IntegrationTestCase.php
@@ -101,6 +101,12 @@ protected function bootKernel(array $bundleConfig = []): void
/**
* Get service from container
+ *
+ * @template T of object
+ *
+ * @param class-string|string $id
+ *
+ * @return ($id is class-string ? T : object|null)
*/
protected function getService(string $id): ?object
{
diff --git a/tests/Integration/LiipImagineIntegrationTest.php b/tests/Integration/LiipImagineIntegrationTest.php
index ce479a9..52a98b6 100644
--- a/tests/Integration/LiipImagineIntegrationTest.php
+++ b/tests/Integration/LiipImagineIntegrationTest.php
@@ -4,7 +4,6 @@
namespace ThreeBRS\ImgproxyBundle\Tests\Integration;
-use Liip\ImagineBundle\Imagine\Cache\CacheManager;
use Liip\ImagineBundle\Imagine\Cache\Resolver\ResolverInterface;
use Liip\ImagineBundle\Imagine\Filter\FilterConfiguration;
use ThreeBRS\ImgproxyBundle\Imagine\Cache\Resolver\ImgproxyCacheResolver;
diff --git a/tests/Unit/Imagine/Cache/Resolver/ImgproxyCacheResolverTest.php b/tests/Unit/Imagine/Cache/Resolver/ImgproxyCacheResolverTest.php
index 02acce6..8523229 100644
--- a/tests/Unit/Imagine/Cache/Resolver/ImgproxyCacheResolverTest.php
+++ b/tests/Unit/Imagine/Cache/Resolver/ImgproxyCacheResolverTest.php
@@ -6,6 +6,8 @@
use Liip\ImagineBundle\Binary\BinaryInterface;
use Liip\ImagineBundle\Imagine\Cache\Resolver\ResolverInterface;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use ThreeBRS\ImgproxyBundle\Imagine\Cache\Resolver\ImgproxyCacheResolver;
use ThreeBRS\ImgproxyBundle\Imagine\Filter\FilterConfigConverterInterface;
@@ -13,8 +15,8 @@
final class ImgproxyCacheResolverTest extends TestCase
{
- private ImgproxyUrlBuilderInterface $urlBuilder;
- private FilterConfigConverterInterface $configConverter;
+ private ImgproxyUrlBuilderInterface&MockObject $urlBuilder;
+ private FilterConfigConverterInterface&MockObject $configConverter;
private ImgproxyCacheResolver $resolver;
protected function setUp(): void
@@ -77,9 +79,7 @@ public function testResolveReturnsPathAsIsForStaticAssets(): void
$this->assertSame($path, $result);
}
- /**
- * @dataProvider staticAssetPathsProvider
- */
+ #[DataProvider('staticAssetPathsProvider')]
public function testResolveSkipsStaticAssets(string $path): void
{
$filter = 'thumbnail';
diff --git a/tests/Unit/Imagine/Filter/FilterConfigConverterTest.php b/tests/Unit/Imagine/Filter/FilterConfigConverterTest.php
index 21d5fac..fbe1c71 100644
--- a/tests/Unit/Imagine/Filter/FilterConfigConverterTest.php
+++ b/tests/Unit/Imagine/Filter/FilterConfigConverterTest.php
@@ -5,13 +5,15 @@
namespace ThreeBRS\ImgproxyBundle\Tests\Unit\Imagine\Filter;
use Liip\ImagineBundle\Imagine\Filter\FilterConfiguration;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use ThreeBRS\ImgproxyBundle\Imagine\Filter\FilterConfigConverter;
use ThreeBRS\ImgproxyBundle\Imagine\Filter\FilterConfigConverterInterface;
final class FilterConfigConverterTest extends TestCase
{
- private FilterConfiguration $filterConfig;
+ private FilterConfiguration&MockObject $filterConfig;
private FilterConfigConverter $converter;
protected function setUp(): void
@@ -496,9 +498,7 @@ public function testConvertWatermarkWithDefaultValues(): void
$this->assertSame('ce', $result['watermark_position']);
}
- /**
- * @dataProvider watermarkPositionProvider
- */
+ #[DataProvider('watermarkPositionProvider')]
public function testConvertWatermarkPosition(string $liipPosition, string $expectedImgproxyPosition): void
{
$this->filterConfig