Skip to content

Commit 3e8dc4f

Browse files
committed
Fix bundle extension
1 parent 50ed89c commit 3e8dc4f

6 files changed

Lines changed: 15 additions & 15 deletions

File tree

DependencyInjection/Configuration.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
55
use Symfony\Component\Config\Definition\ConfigurationInterface;
66

7-
class Configuration implements ConfigurationInterface
7+
final readonly class Configuration implements ConfigurationInterface
88
{
99
public function getConfigTreeBuilder(): TreeBuilder
1010
{
1111
$treeBuilder = new TreeBuilder('rethink_db');
12-
$rootNode = $treeBuilder->getRootNode();
1312

14-
$rootNode
13+
$treeBuilder->getRootNode()
1514
->children()
1615
->scalarNode('hostname')
1716
->defaultValue('127.0.0.1')

DependencyInjection/RethinkDBExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
use Symfony\Component\Config\FileLocator;
66
use Symfony\Component\DependencyInjection\ContainerBuilder;
7+
use Symfony\Component\DependencyInjection\Extension\Extension;
78
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
8-
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
99

10-
class RethinkDBExtension extends Extension
10+
final class RethinkDBExtension extends Extension
1111
{
12-
public function load(array $configs, ContainerBuilder $container)
12+
public function load(array $configs, ContainerBuilder $container): void
1313
{
1414
$configuration = new Configuration();
1515
$config = $this->processConfiguration($configuration, $configs);

Entity/ModelBase.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@
55
use Geekimo\Bundle\RethinkDBBundle\Service\Connection;
66
use Symfony\Component\DependencyInjection\ContainerInterface;
77

8-
class ModelBase
8+
abstract class ModelBase
99
{
10-
protected $connection;
10+
protected ContainerInterface $container;
11+
protected Connection $connection;
1112

12-
public function setConnection(Connection $connection)
13+
public function setConnection(Connection $connection): void
1314
{
1415
$this->connection = $connection;
1516
}
1617

17-
public function setContainer(ContainerInterface $container)
18+
public function setContainer(ContainerInterface $container): void
1819
{
1920
$this->container = $container;
2021
}

Service/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Geekimo\Bundle\RethinkDBBundle\Exception\QueryException;
66
use r;
77

8-
class Connection {
8+
final readonly class Connection {
99
private r\Connection $connection;
1010

1111
public function __construct($parameters)

Service/Factory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Geekimo\Bundle\RethinkDBBundle\Service;
44

5-
class Factory
5+
final readonly class Factory
66
{
77
static public function getConnection($parameters) : Connection
88
{

Service/Repository.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@
66
use Geekimo\Bundle\RethinkDBBundle\Exception\RepositoryErrorException;
77
use Symfony\Component\DependencyInjection\ContainerInterface;
88

9-
class Repository
9+
final readonly class Repository
1010
{
1111
public function __construct(
1212
private Connection $connection,
1313
private ContainerInterface $container,
1414
) {
1515
}
1616

17-
public function get(string $model) {
17+
public function get(string $model): ModelBase
18+
{
1819
$model = new $model;
1920

2021
if(!($model instanceof ModelBase)) {
@@ -25,7 +26,6 @@ public function get(string $model) {
2526
));
2627
}
2728

28-
// some DI
2929
$model->setConnection($this->connection);
3030
$model->setContainer($this->container);
3131

0 commit comments

Comments
 (0)