File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44use Symfony \Component \Config \Definition \Builder \TreeBuilder ;
55use 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 ' )
Original file line number Diff line number Diff line change 44
55use Symfony \Component \Config \FileLocator ;
66use Symfony \Component \DependencyInjection \ContainerBuilder ;
7+ use Symfony \Component \DependencyInjection \Extension \Extension ;
78use 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 );
Original file line number Diff line number Diff line change 55use Geekimo \Bundle \RethinkDBBundle \Service \Connection ;
66use 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 }
Original file line number Diff line number Diff line change 55use Geekimo \Bundle \RethinkDBBundle \Exception \QueryException ;
66use r ;
77
8- class Connection {
8+ final readonly class Connection {
99 private r \Connection $ connection ;
1010
1111 public function __construct ($ parameters )
Original file line number Diff line number Diff line change 22
33namespace Geekimo \Bundle \RethinkDBBundle \Service ;
44
5- class Factory
5+ final readonly class Factory
66{
77 static public function getConnection ($ parameters ) : Connection
88 {
Original file line number Diff line number Diff line change 66use Geekimo \Bundle \RethinkDBBundle \Exception \RepositoryErrorException ;
77use 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
You can’t perform that action at this time.
0 commit comments