From 5035c047880f76f5ae35a2c1c22b1fa5487aaea8 Mon Sep 17 00:00:00 2001 From: Maarten Steltenpool Date: Fri, 3 Apr 2026 18:47:14 +0200 Subject: [PATCH 1/3] Allow psr/log 2 and 3 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0214e0d..e40fe68 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "require": { "php": "^8.1", "hostnet/entity-tracker-component": "^2.0.0", - "psr/log": "^1.1.0", + "psr/log": "^1.1.0||^2.0.0||^3.0.0", "symfony/config": "^5.4||^6.0", "symfony/dependency-injection": "^5.4||^6.0", "symfony/http-kernel": "^5.4||^6.0", From ec6b571cdf8217ea462792d06105f67ca7ea26e6 Mon Sep 17 00:00:00 2001 From: Maarten Steltenpool Date: Tue, 7 Apr 2026 17:40:18 +0200 Subject: [PATCH 2/3] only run phpcs for lowest PHP version --- .github/workflows/main.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index b485beb..ddc6a3f 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -29,4 +29,5 @@ jobs: - name: phpunit run: php vendor/bin/phpunit - name: phpcs + if: matrix.php-versions == '8.1' run: php vendor/bin/phpcs From 2c89a69baff930106de148dae81d0505a88ee23e Mon Sep 17 00:00:00 2001 From: Maarten Steltenpool Date: Wed, 8 Apr 2026 12:28:49 +0200 Subject: [PATCH 3/3] different approach --- .github/workflows/main.yaml | 3 +- composer.json | 6 +-- src/DependencyInjection/Configuration.php | 45 +++++-------------- .../HostnetEntityTrackerExtension.php | 6 +-- 4 files changed, 18 insertions(+), 42 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index ddc6a3f..e59bb7e 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -8,7 +8,7 @@ jobs: strategy: matrix: - php-versions: ['8.1', '8.2', '8.3'] + php-versions: ['8.3'] name: PHP ${{ matrix.php-versions }} steps: - uses: actions/checkout@v2 @@ -29,5 +29,4 @@ jobs: - name: phpunit run: php vendor/bin/phpunit - name: phpcs - if: matrix.php-versions == '8.1' run: php vendor/bin/phpcs diff --git a/composer.json b/composer.json index e40fe68..7fcec4c 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "license": "MIT", "minimum-stability": "stable", "require": { - "php": "^8.1", + "php": "^8.3", "hostnet/entity-tracker-component": "^2.0.0", "psr/log": "^1.1.0||^2.0.0||^3.0.0", "symfony/config": "^5.4||^6.0", @@ -16,10 +16,10 @@ "hostnet/entity-blamable-component": "^1.0.4", "hostnet/phpcs-tool": "^9.1.0", "phpspec/prophecy": "^1.19", + "phpspec/prophecy-phpunit": "^2.2", "phpunit/phpunit": "^9.5.6", "symfony/framework-bundle": "^5.4||^6.0", - "symfony/security-bundle": "^5.4||^6.0", - "phpspec/prophecy-phpunit": "^2.2" + "symfony/security-bundle": "^5.4||^6.0" }, "suggest": { "hostnet/entity-blamable-component": "Provides the @Blamable annotation and listeners", diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index c3e62b6..4527646 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -6,23 +6,26 @@ namespace Hostnet\Bundle\EntityTrackerBundle\DependencyInjection; -use Symfony\Component\Config\Definition\Builder\NodeDefinition; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\ConfigurationInterface; -use Symfony\Component\HttpKernel\Kernel; class Configuration implements ConfigurationInterface { - public const REVISION_FACTORY_INTERFACE = 'Hostnet\Component\EntityRevision\Factory\RevisionFactoryInterface'; - public const BLAMABLE_PROVIDER_INTERFACE = 'Hostnet\Component\EntityBlamable\Provider\BlamableProviderInterface'; - public const BLAMABLE_DEFAULT_PROVIDER = 'entity_tracker.provider.blamable'; + public const string REVISION_FACTORY_INTERFACE + = 'Hostnet\Component\EntityRevision\Factory\RevisionFactoryInterface'; - private const CONFIG_ROOT = 'hostnet_entity_tracker'; + public const string BLAMABLE_PROVIDER_INTERFACE + = 'Hostnet\Component\EntityBlamable\Provider\BlamableProviderInterface'; + + public const string BLAMABLE_DEFAULT_PROVIDER + = 'entity_tracker.provider.blamable'; + + private const string CONFIG_ROOT = 'hostnet_entity_tracker'; public function getConfigTreeBuilder(): TreeBuilder { - $tree_builder = $this->createTreeBuilder(); - $root_node = $this->retrieveRootNode($tree_builder); + $tree_builder = new TreeBuilder(self::CONFIG_ROOT); + $root_node = $tree_builder->getRootNode(); $component_info = 'Configures and enables the %s listener'; @@ -58,30 +61,4 @@ public function getConfigTreeBuilder(): TreeBuilder return $tree_builder; } - - private function createTreeBuilder(): TreeBuilder - { - if (Kernel::VERSION_ID >= 40200) { - return new TreeBuilder(self::CONFIG_ROOT); - } - - if (Kernel::VERSION_ID < 40200) { - return new TreeBuilder(); - } - - throw new \RuntimeException('This bundle can only be used by Symfony 4.0 and up.'); - } - - private function retrieveRootNode(TreeBuilder $tree_builder): NodeDefinition - { - if (Kernel::VERSION_ID >= 40200) { - return $tree_builder->getRootNode(); - } - - if (Kernel::VERSION_ID < 40200) { - return $tree_builder->root(self::CONFIG_ROOT); - } - - throw new \RuntimeException('This bundle can only be used by Symfony 4.0 and up.'); - } } diff --git a/src/DependencyInjection/HostnetEntityTrackerExtension.php b/src/DependencyInjection/HostnetEntityTrackerExtension.php index 2337131..01c416c 100644 --- a/src/DependencyInjection/HostnetEntityTrackerExtension.php +++ b/src/DependencyInjection/HostnetEntityTrackerExtension.php @@ -14,9 +14,9 @@ class HostnetEntityTrackerExtension extends Extension { - private const BLAMABLE = 'Hostnet\Component\EntityBlamable\Blamable'; - private const MUTATION = 'Hostnet\Component\EntityMutation\Mutation'; - private const REVISION = 'Hostnet\Component\EntityRevision\Revision'; + private const string BLAMABLE = 'Hostnet\Component\EntityBlamable\Blamable'; + private const string MUTATION = 'Hostnet\Component\EntityMutation\Mutation'; + private const string REVISION = 'Hostnet\Component\EntityRevision\Revision'; public function load(array $configs, ContainerBuilder $container): void {