1 | <?php |
||
28 | { |
||
29 | /** |
||
30 | * List of tables patterns to ignore |
||
31 | * |
||
32 | * @var array |
||
33 | */ |
||
34 | protected $ignoredTables = []; |
||
35 | |||
36 | /** |
||
37 | * Should I protect the cols ? That will also protect the Primary Keys |
||
38 | * |
||
39 | * @var boolean |
||
40 | */ |
||
41 | protected $protectCols = true; |
||
42 | |||
43 | /** |
||
44 | * List the cols to protected. Could containe regexp |
||
45 | * |
||
46 | * @var array |
||
47 | */ |
||
48 | protected $protectedCols = ['id', 'parent_id']; |
||
49 | |||
50 | /** |
||
51 | * Store the tables added to the conf |
||
52 | * |
||
53 | * @var array |
||
54 | */ |
||
55 | protected $tablesInConf = []; |
||
56 | |||
57 | /** |
||
58 | * Doctrine conection handler |
||
59 | * @var \Doctrine\DBAL\Connection |
||
60 | */ |
||
61 | private $conn; |
||
62 | |||
63 | |||
64 | /** |
||
65 | * Generate the configuration by reading tables + cols |
||
66 | * |
||
67 | * @param DB $db |
||
68 | * @param GuesserInterface $guesser |
||
69 | * @return array |
||
70 | */ |
||
71 | 12 | public function generateConfFromDB(DB $db, GuesserInterface $guesser): array |
|
99 | |||
100 | |||
101 | /** |
||
102 | * Get Tables List added to the conf |
||
103 | * |
||
104 | * @return array |
||
105 | */ |
||
106 | 1 | public function getTablesInConf(): array |
|
110 | |||
111 | |||
112 | /** |
||
113 | * Set a flat to protect cols (Primary Key is protected by default) |
||
114 | * |
||
115 | * @param bool |
||
116 | */ |
||
117 | 8 | public function protectCols(bool $protectCols): Writer |
|
123 | |||
124 | |||
125 | /** |
||
126 | * Save the data to the file as YAML |
||
127 | * |
||
128 | * @param array $data |
||
129 | * @param string $filename |
||
130 | */ |
||
131 | 5 | public function save(array $data, string $filename) |
|
139 | |||
140 | |||
141 | /** |
||
142 | * Set protected cols |
||
143 | * |
||
144 | * @param array $ignoredTables |
||
145 | */ |
||
146 | 6 | public function setIgnoredTables(array $ignoredTables): Writer |
|
152 | |||
153 | |||
154 | /** |
||
155 | * Set protected cols |
||
156 | * |
||
157 | * @param array $protectedCols |
||
158 | */ |
||
159 | 5 | public function setProtectedCols(array $protectedCols): Writer |
|
165 | |||
166 | |||
167 | /** |
||
168 | * Check if that col has to be ignored |
||
169 | * |
||
170 | * @param string $table |
||
171 | * @param string $col |
||
172 | * @param bool $isPrimary |
||
|
|||
173 | * @return bool |
||
174 | */ |
||
175 | 7 | protected function colIgnored(string $table, string $col): bool |
|
189 | |||
190 | |||
191 | /** |
||
192 | * Get the cols lists from a connection + table |
||
193 | * |
||
194 | * @param string $table |
||
195 | * @return array |
||
196 | */ |
||
197 | 8 | protected function getColsList(string $table): array |
|
224 | |||
225 | |||
226 | /** |
||
227 | * Get the table lists from a connection |
||
228 | * |
||
229 | * @return array |
||
230 | */ |
||
231 | 12 | protected function getTablesList(): array |
|
247 | |||
248 | |||
249 | /** |
||
250 | * Guess the cols with the guesser |
||
251 | * |
||
252 | * @param string $table |
||
253 | * @param array $cols |
||
254 | * @param GuesserInterface $guesser |
||
255 | * @return array |
||
256 | */ |
||
257 | 6 | protected function guessColsAnonType(string $table, array $cols, GuesserInterface $guesser): array |
|
266 | |||
267 | |||
268 | /** |
||
269 | * Check if that table has to be ignored |
||
270 | * |
||
271 | * @param string $table |
||
272 | * @return bool |
||
273 | */ |
||
274 | 10 | protected function tableIgnored(string $table): bool |
|
284 | } |
||
285 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.