1 | <?php |
||
28 | class UnderQuery |
||
29 | { |
||
30 | /** |
||
31 | * @var ContainerInterface $container |
||
32 | */ |
||
33 | private $container; |
||
34 | |||
35 | /** |
||
36 | * @param ContainerInterface|null $container |
||
37 | */ |
||
38 | 3 | public function __construct(ContainerInterface $container = null) |
|
39 | { |
||
40 | 3 | $this->container = $container ?: (new ContainerFactory())->create(); |
|
41 | 3 | } |
|
42 | |||
43 | /** |
||
44 | * @return ContainerInterface |
||
45 | */ |
||
46 | 2 | public function getContainer() |
|
47 | { |
||
48 | 2 | return $this->container; |
|
49 | } |
||
50 | |||
51 | /** |
||
52 | * @param ConnectionInterface $connection |
||
53 | * @param string $name |
||
54 | */ |
||
55 | 1 | public function registerConnection(ConnectionInterface $connection, $name = 'default') |
|
56 | { |
||
57 | 1 | $this->getConnectionManager()->registerConnection($connection, $name); |
|
58 | 1 | } |
|
59 | |||
60 | /** |
||
61 | * @return ConnectionManagerInterface |
||
62 | */ |
||
63 | 1 | public function getConnectionManager() |
|
64 | { |
||
65 | 1 | return $this->container->get('phuria.sql_builder.connection_manager'); |
|
66 | } |
||
67 | |||
68 | /** |
||
69 | * @param string $class |
||
70 | * |
||
71 | * @return QueryCompilerInterface |
||
72 | */ |
||
73 | 1 | private function createQueryBuilder($class) |
|
74 | { |
||
75 | 1 | return new $class( |
|
76 | 1 | $this->container->get('phuria.sql_builder.table_factory'), |
|
77 | 1 | $this->container->get('phuria.sql_builder.query_compiler') |
|
78 | 1 | ); |
|
79 | } |
||
80 | |||
81 | /** |
||
82 | * @return SelectBuilder |
||
|
|||
83 | */ |
||
84 | 1 | public function createSelect() |
|
88 | |||
89 | /** |
||
90 | * @return UpdateBuilder |
||
91 | */ |
||
92 | 1 | public function createUpdate() |
|
96 | |||
97 | /** |
||
98 | * @return DeleteBuilder |
||
99 | */ |
||
100 | 1 | public function createDelete() |
|
104 | |||
105 | /** |
||
106 | * @return InsertBuilder |
||
107 | */ |
||
108 | 1 | public function createInsert() |
|
112 | |||
113 | /** |
||
114 | * @return InsertSelectBuilder |
||
115 | */ |
||
116 | 1 | public function createInsertSelect() |
|
120 | } |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.