From f481aeb17454a37e17fd81f10f1cbf3f66b2e1f8 Mon Sep 17 00:00:00 2001 From: Christopher Georg Date: Sun, 5 Feb 2023 13:56:11 +0100 Subject: [PATCH 1/2] feat: drop support of php 7.1, drop support of symfony < 4.4, improve ci, migrate phpunit config, fix for php 8.2 --- .github/workflows/build.yml | 14 +++++-------- composer.json | 14 ++++++------- phpunit.xml.dist | 20 +++++++++---------- src/DependencyInjection/Configuration.php | 11 +++------- .../EWZRecaptchaExtension.php | 2 -- .../Constraints/IsTrueValidatorV3.php | 5 +++++ 6 files changed, 30 insertions(+), 36 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f954f79..25825f3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,15 +14,11 @@ jobs: strategy: fail-fast: true matrix: - php: [7.1, 7.2, 7.3, 7.4, 8.0, 8.1] - symfony: [2.8, 3.4, 4.4, 5.2, 6.0] + php: [ 7.2, 7.3, 7.4, 8.0, 8.1, 8.2] + symfony: [4.4, 5.4, 6.0] exclude: - - php: 7.1 - symfony: 5.2 - php: 8.0 symfony: 3.4 - - php: 7.1 - symfony: 6.0 - php: 7.2 symfony: 6.0 - php: 7.3 @@ -31,7 +27,7 @@ jobs: symfony: 6.0 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install PHP uses: shivammathur/setup-php@v2 @@ -41,10 +37,10 @@ jobs: - name: Get composer cache directory id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache composer dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} diff --git a/composer.json b/composer.json index a45a77e..9d29891 100644 --- a/composer.json +++ b/composer.json @@ -15,17 +15,17 @@ } ], "require": { - "php": "^7.1 || ^8.0", + "php": "^7.2 || ^8.0", "google/recaptcha": "^1.1", - "symfony/form": "^2.8 || ^3.0 || ^4.0 || ^5.0 || ^6.0", - "symfony/framework-bundle": "^2.8 || ^3.0 || ^4.0 || ^5.0 || ^6.0", - "symfony/security-bundle": "^2.8 || ^3.0 || ^4.0 || ^5.0 || ^6.0", - "symfony/validator": "^2.8 || ^3.0 || ^4.0 || ^5.0 || ^6.0", - "symfony/yaml": "^2.8 || ^3.0 || ^4.0 || ^5.0 || ^6.0", + "symfony/form": "^4.4 || ^5.0 || ^6.0", + "symfony/framework-bundle": "^4.4 || ^5.0 || ^6.0", + "symfony/security-bundle": "^4.4 || ^5.0 || ^6.0", + "symfony/validator": "^4.4 || ^5.0 || ^6.0", + "symfony/yaml": "^4.4 || ^5.0 || ^6.0", "twig/twig": "^1.40 || ^2.9 || ^3.0" }, "require-dev": { - "phpunit/phpunit": "^7 || ^8 || ^9.5" + "phpunit/phpunit": "^8.5 || ^9.5" }, "autoload": { "psr-4": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 59d202f..b7f526d 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,9 +1,15 @@ - - + + colors="true" +> + + + + src + + @@ -11,10 +17,4 @@ - - - src - - - diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index f5ecb03..4e01741 100755 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -18,12 +18,7 @@ public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('ewz_recaptcha'); - if (method_exists($treeBuilder, 'getRootNode')) { - $rootNode = $treeBuilder->getRootNode(); - } else { - // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('ewz_recaptcha'); - } + $rootNode = $treeBuilder->getRootNode(); $rootNode ->children() @@ -51,7 +46,7 @@ public function getConfigTreeBuilder(): TreeBuilder return $treeBuilder; } - private function addHttpClientConfiguration(ArrayNodeDefinition $node) + private function addHttpClientConfiguration(ArrayNodeDefinition $node): void { $node ->children() @@ -67,7 +62,7 @@ private function addHttpClientConfiguration(ArrayNodeDefinition $node) ; } - private function addServiceDefinitionConfiguration(ArrayNodeDefinition $node) + private function addServiceDefinitionConfiguration(ArrayNodeDefinition $node): void { $node ->children() diff --git a/src/DependencyInjection/EWZRecaptchaExtension.php b/src/DependencyInjection/EWZRecaptchaExtension.php index c1489ba..44c1179 100755 --- a/src/DependencyInjection/EWZRecaptchaExtension.php +++ b/src/DependencyInjection/EWZRecaptchaExtension.php @@ -58,8 +58,6 @@ public function load(array $configs, ContainerBuilder $container): void /** * Registers the form widget. - * - * @param ContainerBuilder $container */ protected function registerWidget(ContainerBuilder $container, int $version = 2): void { diff --git a/src/Validator/Constraints/IsTrueValidatorV3.php b/src/Validator/Constraints/IsTrueValidatorV3.php index 155c526..bcdba11 100755 --- a/src/Validator/Constraints/IsTrueValidatorV3.php +++ b/src/Validator/Constraints/IsTrueValidatorV3.php @@ -28,6 +28,11 @@ class IsTrueValidatorV3 extends ConstraintValidator /** @var LoggerInterface */ private $logger; + /** + * @var ReCaptcha + */ + private $reCaptcha; + /** * ContainsRecaptchaValidator constructor. * From 8fd563c2c4164ada27306e720c8c635eb85cd670 Mon Sep 17 00:00:00 2001 From: Christopher Georg Date: Sun, 5 Feb 2023 13:59:02 +0100 Subject: [PATCH 2/2] feat: drop support of php 7.1, drop support of symfony < 4.4, improve ci, migrate phpunit config, fix for php 8.2 --- .github/workflows/build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 25825f3..f01289a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,8 +17,6 @@ jobs: php: [ 7.2, 7.3, 7.4, 8.0, 8.1, 8.2] symfony: [4.4, 5.4, 6.0] exclude: - - php: 8.0 - symfony: 3.4 - php: 7.2 symfony: 6.0 - php: 7.3