diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index b485beb..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 diff --git a/composer.json b/composer.json index 0214e0d..7fcec4c 100644 --- a/composer.json +++ b/composer.json @@ -4,9 +4,9 @@ "license": "MIT", "minimum-stability": "stable", "require": { - "php": "^8.1", + "php": "^8.3", "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", @@ -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 {