@@ -14,7 +14,6 @@ |
||
| 14 | 14 | use Lechimp\Dicto\Indexer\Insert; |
| 15 | 15 | use Lechimp\Dicto\Indexer\Location; |
| 16 | 16 | use Lechimp\Dicto\Analysis\Query; |
| 17 | -use Lechimp\Dicto\Analysis\Violation; |
|
| 18 | 17 | use \Lechimp\Dicto\Variables\Variable; |
| 19 | 18 | |
| 20 | 19 | /** |
@@ -126,6 +126,9 @@ |
||
| 126 | 126 | ); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | + /** |
|
| 130 | + * @param boolean $negate |
|
| 131 | + */ |
|
| 129 | 132 | protected function regexp_source_filter($regexp, $negate) { |
| 130 | 133 | assert('is_string($regexp)'); |
| 131 | 134 | assert('is_bool($negate)'); |
@@ -210,6 +210,7 @@ discard block |
||
| 210 | 210 | // IMPLEMENTATION OF Parser |
| 211 | 211 | |
| 212 | 212 | /** |
| 213 | + * @param string $source |
|
| 213 | 214 | * @return Ruleset |
| 214 | 215 | */ |
| 215 | 216 | public function parse($source) { |
@@ -270,6 +271,7 @@ discard block |
||
| 270 | 271 | |
| 271 | 272 | /** |
| 272 | 273 | * @param string |
| 274 | + * @param string $content |
|
| 273 | 275 | * @return string |
| 274 | 276 | */ |
| 275 | 277 | protected function trim_explanation($content) { |
@@ -338,7 +340,7 @@ discard block |
||
| 338 | 340 | /** |
| 339 | 341 | * Fetch a rule schema and its arguments from the stream. |
| 340 | 342 | * |
| 341 | - * @return array (R\Schema, array) |
|
| 343 | + * @return R\Schema (R\Schema, array) |
|
| 342 | 344 | */ |
| 343 | 345 | protected function schema() { |
| 344 | 346 | $t = $this->current_symbol(); |
@@ -12,9 +12,7 @@ |
||
| 12 | 12 | |
| 13 | 13 | use Lechimp\Dicto\Graph; |
| 14 | 14 | use Doctrine\DBAL\Schema; |
| 15 | -use Doctrine\DBAL\Types\Type; |
|
| 16 | 15 | use Doctrine\DBAL\Schema\Synchronizer\SingleDatabaseSynchronizer; |
| 17 | -use Doctrine\DBAL\Statement; |
|
| 18 | 16 | |
| 19 | 17 | class IndexDB extends DB { |
| 20 | 18 | /** |
@@ -60,6 +60,9 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | protected $id_counter = 0; |
| 62 | 62 | |
| 63 | + /** |
|
| 64 | + * @param \Doctrine\DBAL\Connection $connection |
|
| 65 | + */ |
|
| 63 | 66 | public function __construct($connection) { |
| 64 | 67 | parent::__construct($connection); |
| 65 | 68 | foreach ($this->tables as $table => $_) { |
@@ -180,6 +183,9 @@ discard block |
||
| 180 | 183 | $which = []; |
| 181 | 184 | } |
| 182 | 185 | |
| 186 | + /** |
|
| 187 | + * @param string $table |
|
| 188 | + */ |
|
| 183 | 189 | protected function append_and_maybe_flush($table, $values) { |
| 184 | 190 | if ($values[0] === null) { |
| 185 | 191 | $id = $this->id_counter++; |
@@ -197,6 +203,10 @@ discard block |
||
| 197 | 203 | |
| 198 | 204 | return $id; |
| 199 | 205 | } |
| 206 | + |
|
| 207 | + /** |
|
| 208 | + * @param string $str |
|
| 209 | + */ |
|
| 200 | 210 | protected function esc_str($str) { |
| 201 | 211 | assert('is_string($str)'); |
| 202 | 212 | return '"'.str_replace('"', '""', $str).'"'; |
@@ -340,6 +350,9 @@ discard block |
||
| 340 | 350 | |
| 341 | 351 | // INIT DATABASE |
| 342 | 352 | |
| 353 | + /** |
|
| 354 | + * @param string $name |
|
| 355 | + */ |
|
| 343 | 356 | public function init_table($name, Schema\Schema $schema, Schema\Table $file_table = null, Schema\Table $namespace_table = null) { |
| 344 | 357 | assert('array_key_exists($name, $this->tables)'); |
| 345 | 358 | $table = $schema->createTable($name); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
| 100 | - * @return Iterator <[Node,mixed]> |
|
| 100 | + * @return \Generator <[Node,mixed]> |
|
| 101 | 101 | */ |
| 102 | 102 | protected function switch_run_command(\Iterator $nodes, $step) { |
| 103 | 103 | list($cmd,$par) = $step; |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
| 119 | - * @return Iterator <[Node,mixed]> |
|
| 119 | + * @return \Generator <[Node,mixed]> |
|
| 120 | 120 | */ |
| 121 | 121 | protected function run_expand(\Iterator $nodes, \Closure $clsr) { |
| 122 | 122 | while ($nodes->valid()) { |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
| 133 | - * @return Iterator <[Node,mixed]> |
|
| 133 | + * @return \Generator <[Node,mixed]> |
|
| 134 | 134 | */ |
| 135 | 135 | protected function run_extract(\Iterator $nodes, \Closure $clsr) { |
| 136 | 136 | while ($nodes->valid()) { |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
| 148 | - * @return Iterator <[Node,mixed]> |
|
| 148 | + * @return \Generator <[Node,mixed]> |
|
| 149 | 149 | */ |
| 150 | 150 | protected function run_filter(\Iterator $nodes, Predicate $predicate) { |
| 151 | 151 | $clsr = $predicate->compile(); |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
| 163 | - * @return Iterator <[Node,mixed]> |
|
| 163 | + * @return \Generator <[Node,mixed]> |
|
| 164 | 164 | */ |
| 165 | 165 | protected function add_result(\Iterator $nodes, &$result) { |
| 166 | 166 | while ($nodes->valid()) { |
@@ -10,9 +10,6 @@ |
||
| 10 | 10 | |
| 11 | 11 | namespace Lechimp\Dicto\Indexer; |
| 12 | 12 | |
| 13 | -use Lechimp\Dicto\Variables\Variable; |
|
| 14 | -use PhpParser\Node as N; |
|
| 15 | - |
|
| 16 | 13 | /** |
| 17 | 14 | * Interface to implement Rules that visit the AST. |
| 18 | 15 | * |
@@ -10,8 +10,6 @@ |
||
| 10 | 10 | |
| 11 | 11 | namespace Lechimp\Dicto\Indexer; |
| 12 | 12 | |
| 13 | -use Lechimp\Dicto\Analysis\Variable; |
|
| 14 | - |
|
| 15 | 13 | /** |
| 16 | 14 | * Duplicate inserts, return handles from both interfaces and analyses them |
| 17 | 15 | * on usage. |