@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * value using class name and Doctrine inflector. |
| 131 | 131 | * |
| 132 | 132 | * @see Record::$table |
| 133 | - * @return mixed |
|
| 133 | + * @return string |
|
| 134 | 134 | */ |
| 135 | 135 | public function getTable() |
| 136 | 136 | { |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | * Get database where record data should be stored in. Database alias must be resolved. |
| 150 | 150 | * |
| 151 | 151 | * @see Record::$database |
| 152 | - * @return mixed |
|
| 152 | + * @return string |
|
| 153 | 153 | */ |
| 154 | 154 | public function getDatabase() |
| 155 | 155 | { |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | * @param AbstractColumn $column |
| 464 | 464 | * @param string $definition |
| 465 | 465 | * @param mixed $default Default value declared by record schema. |
| 466 | - * @return mixed |
|
| 466 | + * @return AbstractColumn |
|
| 467 | 467 | * @throws DefinitionException |
| 468 | 468 | * @throws \Spiral\Database\Exceptions\SchemaException |
| 469 | 469 | */ |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | public function getTableID() |
| 182 | 182 | { |
| 183 | - return $this->getDatabase() . '.' . $this->getTable(); |
|
| 183 | + return $this->getDatabase().'.'.$this->getTable(); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | /** |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | if (!empty($filter = $this->builder->getMutators($column->abstractType()))) { |
| 425 | 425 | //Mutator associated with type directly |
| 426 | 426 | $resolved += $filter; |
| 427 | - } elseif (!empty($filter = $this->builder->getMutators('php:' . $column->phpType()))) { |
|
| 427 | + } elseif (!empty($filter = $this->builder->getMutators('php:'.$column->phpType()))) { |
|
| 428 | 428 | //Mutator associated with php type |
| 429 | 429 | $resolved += $filter; |
| 430 | 430 | } |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | * |
| 76 | 76 | * @param RecordInterface|string|int $lookup |
| 77 | 77 | * |
| 78 | - * @return true |
|
| 78 | + * @return boolean |
|
| 79 | 79 | */ |
| 80 | 80 | public function has($lookup) |
| 81 | 81 | { |
@@ -881,7 +881,7 @@ |
||
| 881 | 881 | * Parse single result row to generate data tree. Must pass parsing to evert nested loader. |
| 882 | 882 | * |
| 883 | 883 | * @param array $row |
| 884 | - * @return bool |
|
| 884 | + * @return boolean|null |
|
| 885 | 885 | */ |
| 886 | 886 | private function parseRow(array $row) |
| 887 | 887 | { |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | * |
| 458 | 458 | * @see findOne() |
| 459 | 459 | * @param mixed $id Primary key value. |
| 460 | - * @return RecordEntity|null |
|
| 460 | + * @return null|RecordInterface |
|
| 461 | 461 | * @throws SelectorException |
| 462 | 462 | */ |
| 463 | 463 | public function findByPK($id) |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | * @see findByPK() |
| 483 | 483 | * @param array $where Selection WHERE statement. |
| 484 | 484 | * @param bool $setLimit Use limit 1. |
| 485 | - * @return RecordEntity|null |
|
| 485 | + * @return null|RecordInterface |
|
| 486 | 486 | */ |
| 487 | 487 | public function findOne(array $where = [], $setLimit = true) |
| 488 | 488 | { |
@@ -160,8 +160,8 @@ discard block |
||
| 160 | 160 | $offset = count($this->dataColumns); |
| 161 | 161 | |
| 162 | 162 | foreach ($columns as $column) { |
| 163 | - $columnAlias = 'c' . (++$this->countColumns); |
|
| 164 | - $this->dataColumns[] = $table . '.' . $column . ' AS ' . $columnAlias; |
|
| 163 | + $columnAlias = 'c'.(++$this->countColumns); |
|
| 164 | + $this->dataColumns[] = $table.'.'.$column.' AS '.$columnAlias; |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | return $offset; |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | public function count($column = self::DEFAULT_COUNTING_FIELD) |
| 534 | 534 | { |
| 535 | 535 | if ($column == self::DEFAULT_COUNTING_FIELD && !empty($this->loader->getPrimaryKey())) { |
| 536 | - $column = 'DISTINCT(' . $this->loader->getPrimaryKey() . ')'; |
|
| 536 | + $column = 'DISTINCT('.$this->loader->getPrimaryKey().')'; |
|
| 537 | 537 | } |
| 538 | 538 | |
| 539 | 539 | return parent::count($column); |
@@ -311,8 +311,8 @@ discard block |
||
| 311 | 311 | * own relations, loaders and schemas by altering ORM config. |
| 312 | 312 | * |
| 313 | 313 | * @param mixed $type |
| 314 | - * @param SchemaBuilder $builder |
|
| 315 | - * @param RecordSchema $record |
|
| 314 | + * @param Entities\SchemaBuilder $builder |
|
| 315 | + * @param Entities\Schemas\RecordSchema $record |
|
| 316 | 316 | * @param string $name |
| 317 | 317 | * @param array $definition |
| 318 | 318 | * @return Schemas\RelationInterface |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | * @param string $type Loader type (usually related to relation type). |
| 354 | 354 | * @param string $container Data segment associated with loader. |
| 355 | 355 | * @param array $definition |
| 356 | - * @param LoaderInterface|null $parent |
|
| 356 | + * @param null|Loader $parent |
|
| 357 | 357 | * @return Loader |
| 358 | 358 | */ |
| 359 | 359 | public function loader($type, $container, array $definition, Loader $parent = null) |
@@ -80,6 +80,9 @@ |
||
| 80 | 80 | ], $model->serializeData()); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | + /** |
|
| 84 | + * @param string $directory |
|
| 85 | + */ |
|
| 83 | 86 | protected function createLocator($directory) |
| 84 | 87 | { |
| 85 | 88 | $tokenizer = new Tokenizer(new FileManager(), new TokenizerConfig(), $this->createMemory()); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | public function testIndexation() |
| 27 | 27 | { |
| 28 | 28 | $odm = $this->createODM(); |
| 29 | - $builder = $odm->schemaBuilder($this->createLocator(__DIR__ . '/Fixtures')); |
|
| 29 | + $builder = $odm->schemaBuilder($this->createLocator(__DIR__.'/Fixtures')); |
|
| 30 | 30 | |
| 31 | 31 | $this->assertTrue($builder->hasDocument(Data::class)); |
| 32 | 32 | $this->assertTrue($builder->hasDocument(Element::class)); |
@@ -35,14 +35,14 @@ discard block |
||
| 35 | 35 | public function testUpdateSchema() |
| 36 | 36 | { |
| 37 | 37 | $odm = $this->createODM(); |
| 38 | - $builder = $odm->schemaBuilder($this->createLocator(__DIR__ . '/Fixtures')); |
|
| 38 | + $builder = $odm->schemaBuilder($this->createLocator(__DIR__.'/Fixtures')); |
|
| 39 | 39 | $odm->updateSchema($builder); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function testEntities() |
| 43 | 43 | { |
| 44 | 44 | $odm = $this->createODM(); |
| 45 | - $odm->updateSchema($odm->schemaBuilder($this->createLocator(__DIR__ . '/Fixtures'))); |
|
| 45 | + $odm->updateSchema($odm->schemaBuilder($this->createLocator(__DIR__.'/Fixtures'))); |
|
| 46 | 46 | |
| 47 | 47 | $data = $odm->document(Data::class); |
| 48 | 48 | $element = $data->elements->create(); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | public function testSerialization() |
| 53 | 53 | { |
| 54 | 54 | $odm = $this->createODM(); |
| 55 | - $odm->updateSchema($odm->schemaBuilder($this->createLocator(__DIR__ . '/Fixtures'))); |
|
| 55 | + $odm->updateSchema($odm->schemaBuilder($this->createLocator(__DIR__.'/Fixtures'))); |
|
| 56 | 56 | |
| 57 | 57 | $model = $odm->document(Data::class, [ |
| 58 | 58 | 'name' => 'value', |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | $enumValues[] = $this->table->driver()->getPDO()->quote($value); |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - return "$statement CHECK ({$this->getName(true)} IN (" . implode(', ', $enumValues) . '))'; |
|
| 119 | + return "$statement CHECK ({$this->getName(true)} IN (".implode(', ', $enumValues).'))'; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - $options = array_map(function ($value) { |
|
| 171 | + $options = array_map(function($value) { |
|
| 172 | 172 | return intval($value); |
| 173 | 173 | }, explode(',', $options)); |
| 174 | 174 | |
@@ -163,7 +163,7 @@ |
||
| 163 | 163 | { |
| 164 | 164 | //Temporary table is required to copy data over |
| 165 | 165 | $temporary = clone $this; |
| 166 | - $temporary->setName('spiral_temp_' . $this->getName() . '_' . uniqid()); |
|
| 166 | + $temporary->setName('spiral_temp_'.$this->getName().'_'.uniqid()); |
|
| 167 | 167 | |
| 168 | 168 | //We don't need any index in temporary table |
| 169 | 169 | foreach ($temporary->getIndexes() as $index) { |
@@ -189,14 +189,14 @@ |
||
| 189 | 189 | if ($this->abstractType() == 'enum') { |
| 190 | 190 | |
| 191 | 191 | //Fetching enum values |
| 192 | - $this->enumValues = array_map(function ($value) { |
|
| 192 | + $this->enumValues = array_map(function($value) { |
|
| 193 | 193 | return trim($value, $value[0]); |
| 194 | 194 | }, explode(',', $options)); |
| 195 | 195 | |
| 196 | 196 | return; |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - $options = array_map(function ($value) { |
|
| 199 | + $options = array_map(function($value) { |
|
| 200 | 200 | return intval($value); |
| 201 | 201 | }, explode(',', $options)); |
| 202 | 202 | |