1 | <?php |
||
25 | abstract class AbstractBuilder implements BuilderInterface |
||
26 | { |
||
27 | /** |
||
28 | * @var QueryBuilderFacade |
||
29 | */ |
||
30 | private $facade; |
||
31 | |||
32 | /** |
||
33 | * @var ReferenceCollectionInterface |
||
34 | */ |
||
35 | private $referenceCollection; |
||
36 | |||
37 | /** |
||
38 | * @var ParameterCollectionInterface |
||
39 | */ |
||
40 | private $parameterCollection; |
||
41 | |||
42 | /** |
||
43 | * @var AbstractTable[] $tables |
||
44 | */ |
||
45 | private $rootTables = []; |
||
46 | |||
47 | /** |
||
48 | * @param QueryBuilderFacade $facade |
||
49 | */ |
||
50 | 7 | public function __construct(QueryBuilderFacade $facade) |
|
51 | { |
||
52 | 7 | $this->facade = $facade; |
|
53 | 7 | $this->parameterCollection = new ParameterCollection(); |
|
54 | 7 | $this->referenceCollection = new ReferenceCollection(); |
|
55 | 7 | } |
|
56 | |||
57 | /** |
||
58 | * @return BuilderInterface |
||
59 | */ |
||
60 | 1 | public function getQueryBuilder() |
|
61 | { |
||
62 | 1 | return $this; |
|
63 | } |
||
64 | |||
65 | /** |
||
66 | * @return ParameterCollectionInterface |
||
67 | */ |
||
68 | 2 | public function getParameters() |
|
69 | { |
||
70 | 2 | return $this->parameterCollection; |
|
71 | } |
||
72 | |||
73 | /** |
||
74 | * @return ReferenceCollectionInterface |
||
75 | */ |
||
76 | 4 | public function getReferences() |
|
77 | { |
||
78 | 4 | return $this->referenceCollection; |
|
79 | } |
||
80 | |||
81 | /** |
||
82 | * @param mixed $table |
||
83 | * @param string $alias |
||
|
|||
84 | * |
||
85 | * @return AbstractTable |
||
86 | */ |
||
87 | 1 | public function addRootTable($table, $alias = null) |
|
88 | { |
||
89 | 1 | $this->rootTables[] = $table = $this->createTable($table, $alias); |
|
90 | |||
91 | 1 | return $table; |
|
92 | } |
||
93 | |||
94 | /** |
||
95 | * @return AbstractTable[] |
||
96 | */ |
||
97 | 3 | public function getRootTables() |
|
98 | { |
||
99 | 3 | return $this->rootTables; |
|
100 | } |
||
101 | |||
102 | /** |
||
103 | * @param mixed $table |
||
104 | * @param string|null $alias |
||
105 | * |
||
106 | * @return AbstractTable |
||
107 | */ |
||
108 | 1 | public function createTable($table, $alias = null) |
|
109 | { |
||
110 | 1 | $table = $this->facade->createTable($this, $table); |
|
111 | |||
112 | 1 | if ($alias) { |
|
113 | 1 | $table->setAlias($alias); |
|
114 | 1 | } |
|
115 | |||
116 | 1 | return $table; |
|
117 | } |
||
118 | |||
119 | /** |
||
120 | * @inheritdoc |
||
121 | */ |
||
122 | 1 | public function objectToString($object) |
|
126 | |||
127 | /** |
||
128 | * @inheritdoc |
||
129 | */ |
||
130 | 1 | public function setParameter($name, $value) |
|
137 | |||
138 | /** |
||
139 | * @return Query |
||
140 | */ |
||
141 | 1 | public function buildQuery() |
|
142 | { |
||
143 | 1 | return new Query($this->buildSQL(), $this->parameterCollection->toArray()); |
|
144 | } |
||
145 | |||
146 | /** |
||
147 | * @inheritdoc |
||
148 | */ |
||
149 | 2 | public function buildSQL() |
|
153 | |||
154 | /** |
||
155 | * @param mixed|null $connectionHint |
||
156 | * |
||
157 | * @return StatementInterface |
||
158 | */ |
||
159 | public function buildStatement($connectionHint = null) |
||
163 | } |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.