Skip to content

Commit a33eed8

Browse files
committed
clean
1 parent 5035c04 commit a33eed8

3 files changed

Lines changed: 15 additions & 39 deletions

File tree

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
"hostnet/entity-blamable-component": "^1.0.4",
1717
"hostnet/phpcs-tool": "^9.1.0",
1818
"phpspec/prophecy": "^1.19",
19+
"phpspec/prophecy-phpunit": "^2.2",
1920
"phpunit/phpunit": "^9.5.6",
2021
"symfony/framework-bundle": "^5.4||^6.0",
21-
"symfony/security-bundle": "^5.4||^6.0",
22-
"phpspec/prophecy-phpunit": "^2.2"
22+
"symfony/security-bundle": "^5.4||^6.0"
2323
},
2424
"suggest": {
2525
"hostnet/entity-blamable-component": "Provides the @Blamable annotation and listeners",

src/DependencyInjection/Configuration.php

Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,25 @@
66

77
namespace Hostnet\Bundle\EntityTrackerBundle\DependencyInjection;
88

9-
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
109
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
1110
use Symfony\Component\Config\Definition\ConfigurationInterface;
12-
use Symfony\Component\HttpKernel\Kernel;
1311

1412
class Configuration implements ConfigurationInterface
1513
{
16-
public const REVISION_FACTORY_INTERFACE = 'Hostnet\Component\EntityRevision\Factory\RevisionFactoryInterface';
17-
public const BLAMABLE_PROVIDER_INTERFACE = 'Hostnet\Component\EntityBlamable\Provider\BlamableProviderInterface';
18-
public const BLAMABLE_DEFAULT_PROVIDER = 'entity_tracker.provider.blamable';
14+
public const string REVISION_FACTORY_INTERFACE
15+
= 'Hostnet\Component\EntityRevision\Factory\RevisionFactoryInterface';
1916

20-
private const CONFIG_ROOT = 'hostnet_entity_tracker';
17+
public const string BLAMABLE_PROVIDER_INTERFACE
18+
= 'Hostnet\Component\EntityBlamable\Provider\BlamableProviderInterface';
19+
20+
public const string BLAMABLE_DEFAULT_PROVIDER = 'entity_tracker.provider.blamable';
21+
22+
private const string CONFIG_ROOT = 'hostnet_entity_tracker';
2123

2224
public function getConfigTreeBuilder(): TreeBuilder
2325
{
24-
$tree_builder = $this->createTreeBuilder();
25-
$root_node = $this->retrieveRootNode($tree_builder);
26+
$tree_builder = new TreeBuilder(self::CONFIG_ROOT);
27+
$root_node = $tree_builder->getRootNode();
2628

2729
$component_info = 'Configures and enables the %s listener';
2830

@@ -58,30 +60,4 @@ public function getConfigTreeBuilder(): TreeBuilder
5860

5961
return $tree_builder;
6062
}
61-
62-
private function createTreeBuilder(): TreeBuilder
63-
{
64-
if (Kernel::VERSION_ID >= 40200) {
65-
return new TreeBuilder(self::CONFIG_ROOT);
66-
}
67-
68-
if (Kernel::VERSION_ID < 40200) {
69-
return new TreeBuilder();
70-
}
71-
72-
throw new \RuntimeException('This bundle can only be used by Symfony 4.0 and up.');
73-
}
74-
75-
private function retrieveRootNode(TreeBuilder $tree_builder): NodeDefinition
76-
{
77-
if (Kernel::VERSION_ID >= 40200) {
78-
return $tree_builder->getRootNode();
79-
}
80-
81-
if (Kernel::VERSION_ID < 40200) {
82-
return $tree_builder->root(self::CONFIG_ROOT);
83-
}
84-
85-
throw new \RuntimeException('This bundle can only be used by Symfony 4.0 and up.');
86-
}
8763
}

src/DependencyInjection/HostnetEntityTrackerExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

1515
class HostnetEntityTrackerExtension extends Extension
1616
{
17-
private const BLAMABLE = 'Hostnet\Component\EntityBlamable\Blamable';
18-
private const MUTATION = 'Hostnet\Component\EntityMutation\Mutation';
19-
private const REVISION = 'Hostnet\Component\EntityRevision\Revision';
17+
private const string BLAMABLE = 'Hostnet\Component\EntityBlamable\Blamable';
18+
private const string MUTATION = 'Hostnet\Component\EntityMutation\Mutation';
19+
private const string REVISION = 'Hostnet\Component\EntityRevision\Revision';
2020

2121
public function load(array $configs, ContainerBuilder $container): void
2222
{

0 commit comments

Comments
 (0)