From 809c262f91db7091a5b8fe94128b4e35eef78090 Mon Sep 17 00:00:00 2001 From: Jannik Zschiesche Date: Mon, 21 Feb 2022 09:25:37 +0100 Subject: [PATCH 1/4] Allow Symfony v6 --- CHANGELOG.md | 6 ++++++ composer.json | 33 ++++++++++++++++++--------------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 076c3c0..dc6cee5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +2.1.2 +===== + +* (improvement) Allow Symfony v6. + + 2.1.1 ===== diff --git a/composer.json b/composer.json index d47e715..43e178b 100644 --- a/composer.json +++ b/composer.json @@ -1,33 +1,25 @@ { "name": "21torr/bundle-helpers", - "type": "library", "description": "Helper classes specifically designed to ease implementation of Symfony bundles.", - "homepage": "https://github.com/21TORR/bundle-helpers", "license": "BSD-3-Clause", + "type": "library", "authors": [ { "name": "21TORR", "homepage": "https://www.21torr.com/" } ], + "homepage": "https://github.com/21TORR/bundle-helpers", "require": { "php": "^7.4 || ^8.0", - "symfony/config": "^5.1", - "symfony/dependency-injection": "^5.1", - "symfony/http-kernel": "^5.1" + "symfony/config": "^5.1 || ^6.0", + "symfony/dependency-injection": "^5.1 || ^6.0", + "symfony/http-kernel": "^5.1 || ^6.0" }, "require-dev": { "bamarni/composer-bin-plugin": "^1.4", - "roave/security-advisories": "dev-master", - "symfony/phpunit-bridge": "^5.1" - }, - "config": { - "sort-packages": true - }, - "extra": { - "branch-alias": { - "dev-next": "2.x-dev" - } + "roave/security-advisories": "dev-latest", + "symfony/phpunit-bridge": "^5.1 || ^6.0" }, "autoload": { "psr-4": { @@ -39,6 +31,17 @@ "Tests\\Torr\\BundleHelpers\\": "tests/" } }, + "config": { + "allow-plugins": { + "bamarni/composer-bin-plugin": true + }, + "sort-packages": true + }, + "extra": { + "branch-alias": { + "dev-next": "2.x-dev" + } + }, "scripts": { "post-install-cmd": [ "@composer bin all install --ansi" From fab8d6471deed7f6aca74f91dcb8af31be8fce9c Mon Sep 17 00:00:00 2001 From: Jannik Zschiesche Date: Mon, 21 Feb 2022 09:25:42 +0100 Subject: [PATCH 2/4] CS Fixes --- .gitignore | 3 ++- src/Bundle/BundleExtension.php | 10 +++++++--- src/Bundle/ConfigurableBundleExtension.php | 2 +- vendor-bin/cs-fixer/composer.json | 5 +++++ vendor-bin/test/composer.json | 8 +++++++- 5 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 vendor-bin/cs-fixer/composer.json diff --git a/.gitignore b/.gitignore index d0fd872..4f7066d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ +/.php-cs-fixer.cache /.php_cs.cache /.phpunit.result.cache /composer.lock /studio.json /vendor /vendor-bin/*/composer.lock -/vendor-bin/*/vendor \ No newline at end of file +/vendor-bin/*/vendor diff --git a/src/Bundle/BundleExtension.php b/src/Bundle/BundleExtension.php index f6caa0f..792ee4d 100644 --- a/src/Bundle/BundleExtension.php +++ b/src/Bundle/BundleExtension.php @@ -21,7 +21,7 @@ class BundleExtension extends Extension public function __construct ( BundleInterface $bundle, - ?string $alias = null + ?string $alias = null, ) { $this->bundle = $bundle; @@ -60,10 +60,14 @@ public function getAlias () : string { throw new BundleHelpersException(\sprintf( "The bundle does not follow the naming convention; you must pass an explicit alias. Its name should end on 'Bundle', but it is '%s'.", - $className + $className, )); } - $classBaseName = \substr(\strrchr($className, '\\'), 1, -6); + + $classBaseNameForNamespacedClass = \strrchr($className, '\\'); + $classBaseName = false !== $classBaseNameForNamespacedClass + ? \substr($classBaseNameForNamespacedClass, 1, -6) + : $className; return Container::underscore($classBaseName); } diff --git a/src/Bundle/ConfigurableBundleExtension.php b/src/Bundle/ConfigurableBundleExtension.php index ba55c35..5c3abcb 100644 --- a/src/Bundle/ConfigurableBundleExtension.php +++ b/src/Bundle/ConfigurableBundleExtension.php @@ -22,7 +22,7 @@ public function __construct ( BundleInterface $bundle, ConfigurationInterface $config, callable $callback, - ?string $alias = null + ?string $alias = null, ) { parent::__construct($bundle, $alias); diff --git a/vendor-bin/cs-fixer/composer.json b/vendor-bin/cs-fixer/composer.json new file mode 100644 index 0000000..5be7619 --- /dev/null +++ b/vendor-bin/cs-fixer/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "friendsofphp/php-cs-fixer": "^3.6" + } +} diff --git a/vendor-bin/test/composer.json b/vendor-bin/test/composer.json index cc12bc9..8105a33 100644 --- a/vendor-bin/test/composer.json +++ b/vendor-bin/test/composer.json @@ -1,5 +1,11 @@ { "require": { - "21torr/php-cs": "^2.0.1" + "21torr/php-cs": "^4.0.4" + }, + "config": { + "allow-plugins": { + "phpstan/extension-installer": true, + "ergebnis/composer-normalize": true + } } } From 5ca99f4c0984c36175d146cbbe548a1f2270987d Mon Sep 17 00:00:00 2001 From: Jannik Zschiesche Date: Mon, 21 Feb 2022 09:28:23 +0100 Subject: [PATCH 3/4] Use PHP 8 only --- .github/workflows/ci.yml | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d08980..43c0429 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: - php: ['7.4', '8.0'] + php: ['8.0', '8.1'] steps: - name: Checkout Code diff --git a/composer.json b/composer.json index 43e178b..319f921 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ ], "homepage": "https://github.com/21TORR/bundle-helpers", "require": { - "php": "^7.4 || ^8.0", + "php": "^8.0", "symfony/config": "^5.1 || ^6.0", "symfony/dependency-injection": "^5.1 || ^6.0", "symfony/http-kernel": "^5.1 || ^6.0" From 8fc849f41c7cac15439235bbc519fbb6944b0f6b Mon Sep 17 00:00:00 2001 From: Jannik Zschiesche Date: Mon, 21 Feb 2022 09:34:45 +0100 Subject: [PATCH 4/4] Fix workflow --- .github/workflows/ci.yml | 16 +++++++++------- phpunit.xml | 8 ++++---- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43c0429..cd08afe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: coverage: "none" ini-values: "memory_limit=-1" php-version: "${{ matrix.php }}" - tools: pecl + tools: "composer, composer-normalize, cs2pr" - name: Display versions run: | @@ -29,17 +29,19 @@ jobs: php -i - name: Install Composer - uses: php-actions/composer@v1 + run: composer install --optimize-autoloader --classmap-authoritative --no-interaction - name: Composer Normalize - uses: "docker://ergebnis/composer-normalize-action:latest" - with: - args: "--indent-style tab --indent-size 1 --dry-run" + run: composer-normalize --indent-style tab --indent-size 1 --dry-run --ansi - name: PHP CS Fixer - run: "./vendor/bin/php-cs-fixer fix --diff --config vendor-bin/test/vendor/21torr/php-cs/.php_cs.dist --dry-run --no-interaction" + run: "./vendor/bin/php-cs-fixer fix --diff --config vendor-bin/test/vendor/21torr/php-cs/.php-cs-fixer.dist.php --dry-run --no-interaction --ansi --format=checkstyle | cs2pr" env: PHP_CS_FIXER_IGNORE_ENV: 1 - name: PHPStan - run: "./vendor/bin/phpstan analyze -c vendor-bin/test/vendor/21torr/php-cs/phpstan/lib.neon ." + run: "./vendor/bin/phpstan analyze -c vendor-bin/test/vendor/21torr/php-cs/phpstan/lib.neon . --ansi --error-format=checkstyle | cs2pr" + + - name: PHPUnit + # --teamcity output used by `mheap/phpunit-matcher-action` + run: "./vendor/bin/simple-phpunit --teamcity" diff --git a/phpunit.xml b/phpunit.xml index 181ccdb..ce2a66e 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,6 +1,6 @@ @@ -9,12 +9,12 @@ - + - + tests tests/fixtures @@ -23,4 +23,4 @@ - \ No newline at end of file +