@@ -207,7 +207,7 @@ |
||
207 | 207 | if (strlen($alias) <= 30) { // Older oracle version had a limit of 30 characters for identifiers |
208 | 208 | return $alias; |
209 | 209 | } |
210 | - return substr($columnName, 0, 20) . crc32($tableName.'____'.$columnName); |
|
210 | + return substr($columnName, 0, 20).crc32($tableName.'____'.$columnName); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | abstract protected function compute(): void; |
@@ -142,7 +142,7 @@ |
||
142 | 142 | public function getIncomingForeignKeys(string $tableName): array |
143 | 143 | { |
144 | 144 | $junctionTables = $this->schemaAnalyzer->detectJunctionTables(true); |
145 | - $junctionTableNames = array_map(function (Table $table) { |
|
145 | + $junctionTableNames = array_map(function(Table $table) { |
|
146 | 146 | return $table->getName(); |
147 | 147 | }, $junctionTables); |
148 | 148 | $childrenRelationships = $this->schemaAnalyzer->getChildrenRelationships($tableName); |
@@ -49,7 +49,7 @@ |
||
49 | 49 | |
50 | 50 | $fromLock = (bool) $input->getOption('from-lock'); |
51 | 51 | |
52 | - $loggers = [ new ConsoleLogger($output) ]; |
|
52 | + $loggers = [new ConsoleLogger($output)]; |
|
53 | 53 | |
54 | 54 | $logger = $alteredConf->getLogger(); |
55 | 55 | if ($logger) { |
@@ -8,7 +8,7 @@ |
||
8 | 8 | { |
9 | 9 | public static function getValidVariableName(string $variableName): string |
10 | 10 | { |
11 | - $valid = preg_replace_callback('/^(\d+)/', static function (array $match) { |
|
11 | + $valid = preg_replace_callback('/^(\d+)/', static function(array $match) { |
|
12 | 12 | $f = new \NumberFormatter('en', \NumberFormatter::SPELLOUT); |
13 | 13 | $number = $f->format((int) $match[0]); |
14 | 14 | return preg_replace('/[^a-z]+/i', '_', $number); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function getParamAnnotation(): ParamTag |
69 | 69 | { |
70 | - return new ParamTag($this->getSafeVariableName(), [ $this->getPhpType() ]); |
|
70 | + return new ParamTag($this->getSafeVariableName(), [$this->getPhpType()]); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | public function getVariableName(): string |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | public function getSafeVariableName(): string |
79 | 79 | { |
80 | - return '$' . StringUtils::getValidVariableName(ltrim($this->getVariableName(), '$')); |
|
80 | + return '$'.StringUtils::getValidVariableName(ltrim($this->getVariableName(), '$')); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | public function getSetterName(): string |
@@ -19,12 +19,12 @@ |
||
19 | 19 | */ |
20 | 20 | private const LEVELS = array( |
21 | 21 | LogLevel::EMERGENCY, // 0 |
22 | - LogLevel::ALERT, // 1 |
|
23 | - LogLevel::CRITICAL, // 2 |
|
24 | - LogLevel::ERROR, // 3 |
|
25 | - LogLevel::WARNING, // 4 |
|
26 | - LogLevel::NOTICE, // 5 |
|
27 | - LogLevel::INFO, // 6 |
|
22 | + LogLevel::ALERT, // 1 |
|
23 | + LogLevel::CRITICAL, // 2 |
|
24 | + LogLevel::ERROR, // 3 |
|
25 | + LogLevel::WARNING, // 4 |
|
26 | + LogLevel::NOTICE, // 5 |
|
27 | + LogLevel::INFO, // 6 |
|
28 | 28 | LogLevel::DEBUG // 7 |
29 | 29 | ); |
30 | 30 |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $this->getArrayInlineCode($this->remoteFk->getUnquotedForeignColumns()), |
185 | 185 | $this->getArrayInlineCode($this->remoteFk->getUnquotedLocalColumns()), |
186 | 186 | $this->getArrayInlineCode($this->localFk->getUnquotedLocalColumns()), |
187 | - '\\' . $this->resultIteratorNamespace . '\\' . $this->getResultIteratorClassName() . '::class' |
|
187 | + '\\'.$this->resultIteratorNamespace.'\\'.$this->getResultIteratorClassName().'::class' |
|
188 | 188 | ); |
189 | 189 | } |
190 | 190 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | |
227 | 227 | $getter = new MethodGenerator($this->getName()); |
228 | 228 | $getterDocBlock = new DocBlockGenerator(sprintf('Returns the list of %s associated to this bean via the %s pivot table.', $remoteBeanName, $this->pivotTable->getName())); |
229 | - $getterDocBlock->setTag(new ReturnTag([ $fqcnRemoteBeanName.'[]' ])); |
|
229 | + $getterDocBlock->setTag(new ReturnTag([$fqcnRemoteBeanName.'[]'])); |
|
230 | 230 | $getterDocBlock->setWordWrap(false); |
231 | 231 | $getter->setDocBlock($getterDocBlock); |
232 | 232 | $getter->setReturnType('array'); |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | |
236 | 236 | $adder = new MethodGenerator('add'.$singularName); |
237 | 237 | $adderDocBlock = new DocBlockGenerator(sprintf('Adds a relationship with %s associated to this bean via the %s pivot table.', $remoteBeanName, $this->pivotTable->getName())); |
238 | - $adderDocBlock->setTag(new ParamTag($variableName, [ $fqcnRemoteBeanName ])); |
|
238 | + $adderDocBlock->setTag(new ParamTag($variableName, [$fqcnRemoteBeanName])); |
|
239 | 239 | $adderDocBlock->setWordWrap(false); |
240 | 240 | $adder->setDocBlock($adderDocBlock); |
241 | 241 | $adder->setReturnType('void'); |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | |
245 | 245 | $remover = new MethodGenerator('remove'.$singularName); |
246 | 246 | $removerDocBlock = new DocBlockGenerator(sprintf('Deletes the relationship with %s associated to this bean via the %s pivot table.', $remoteBeanName, $this->pivotTable->getName())); |
247 | - $removerDocBlock->setTag(new ParamTag($variableName, [ $fqcnRemoteBeanName ])); |
|
247 | + $removerDocBlock->setTag(new ParamTag($variableName, [$fqcnRemoteBeanName])); |
|
248 | 248 | $removerDocBlock->setWordWrap(false); |
249 | 249 | $remover->setDocBlock($removerDocBlock); |
250 | 250 | $remover->setReturnType('void'); |
@@ -253,8 +253,8 @@ discard block |
||
253 | 253 | |
254 | 254 | $has = new MethodGenerator('has'.$singularName); |
255 | 255 | $hasDocBlock = new DocBlockGenerator(sprintf('Returns whether this bean is associated with %s via the %s pivot table.', $remoteBeanName, $this->pivotTable->getName())); |
256 | - $hasDocBlock->setTag(new ParamTag($variableName, [ $fqcnRemoteBeanName ])); |
|
257 | - $hasDocBlock->setTag(new ReturnTag([ 'bool' ])); |
|
256 | + $hasDocBlock->setTag(new ParamTag($variableName, [$fqcnRemoteBeanName])); |
|
257 | + $hasDocBlock->setTag(new ReturnTag(['bool'])); |
|
258 | 258 | $hasDocBlock->setWordWrap(false); |
259 | 259 | $has->setDocBlock($hasDocBlock); |
260 | 260 | $has->setReturnType('bool'); |
@@ -264,15 +264,15 @@ discard block |
||
264 | 264 | $setter = new MethodGenerator('set'.$pluralName); |
265 | 265 | $setterDocBlock = new DocBlockGenerator(sprintf('Sets all relationships with %s associated to this bean via the %s pivot table. |
266 | 266 | Exiting relationships will be removed and replaced by the provided relationships.', $remoteBeanName, $this->pivotTable->getName())); |
267 | - $setterDocBlock->setTag(new ParamTag($pluralVariableName, [ $fqcnRemoteBeanName.'[]' ])); |
|
268 | - $setterDocBlock->setTag(new ReturnTag([ 'void' ])); |
|
267 | + $setterDocBlock->setTag(new ParamTag($pluralVariableName, [$fqcnRemoteBeanName.'[]'])); |
|
268 | + $setterDocBlock->setTag(new ReturnTag(['void'])); |
|
269 | 269 | $setterDocBlock->setWordWrap(false); |
270 | 270 | $setter->setDocBlock($setterDocBlock); |
271 | 271 | $setter->setReturnType('void'); |
272 | 272 | $setter->setParameter(new ParameterGenerator($pluralVariableName, 'array')); |
273 | 273 | $setter->setBody(sprintf('$this->setRelationships(%s, $%s);', $pathKey, $pluralVariableName)); |
274 | 274 | |
275 | - return [ $getter, $adder, $remover, $has, $setter ]; |
|
275 | + return [$getter, $adder, $remover, $has, $setter]; |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | /** @var Annotation\JsonFormat|null $jsonFormat */ |
302 | 302 | $jsonFormat = $this->findRemoteAnnotation(Annotation\JsonFormat::class); |
303 | 303 | if ($jsonFormat !== null) { |
304 | - $method = $jsonFormat->method ?? 'get' . ucfirst($jsonFormat->property); |
|
304 | + $method = $jsonFormat->method ?? 'get'.ucfirst($jsonFormat->property); |
|
305 | 305 | $format = "$method()"; |
306 | 306 | } else { |
307 | 307 | $stopRecursion = $this->findRemoteAnnotation(Annotation\JsonRecursive::class) ? '' : 'true'; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function getPhpType(): string |
95 | 95 | { |
96 | - return '\\' . $this->beanNamespace . '\\' . $this->getClassName(); |
|
96 | + return '\\'.$this->beanNamespace.'\\'.$this->getClassName(); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -168,17 +168,17 @@ discard block |
||
168 | 168 | $referencedResultIteratorName = $this->namingStrategy->getResultIteratorClassName($foreignTableName); |
169 | 169 | |
170 | 170 | $getter = new MethodGenerator($getterName); |
171 | - $getter->setDocBlock(new DocBlockGenerator('Returns the ' . $referencedBeanName . ' object bound to this object via the ' . implode(' and ', $this->foreignKey->getUnquotedLocalColumns()) . ' column.')); |
|
171 | + $getter->setDocBlock(new DocBlockGenerator('Returns the '.$referencedBeanName.' object bound to this object via the '.implode(' and ', $this->foreignKey->getUnquotedLocalColumns()).' column.')); |
|
172 | 172 | |
173 | - $getter->setReturnType(($isNullable ? '?' : '') . $this->beanNamespace . '\\' . $referencedBeanName); |
|
173 | + $getter->setReturnType(($isNullable ? '?' : '').$this->beanNamespace.'\\'.$referencedBeanName); |
|
174 | 174 | $tdbmFk = ForeignKey::createFromFk($this->foreignKey); |
175 | 175 | |
176 | 176 | $getter->setBody(sprintf( |
177 | 177 | 'return $this->getRef(%s, %s, %s, %s);', |
178 | 178 | var_export($tdbmFk->getCacheKey(), true), |
179 | 179 | var_export($tableName, true), |
180 | - '\\' . $this->beanNamespace . '\\' . $referencedBeanName . '::class', |
|
181 | - '\\' . $this->resultIteratorNamespace . '\\' . $referencedResultIteratorName . '::class' |
|
180 | + '\\'.$this->beanNamespace.'\\'.$referencedBeanName.'::class', |
|
181 | + '\\'.$this->resultIteratorNamespace.'\\'.$referencedResultIteratorName.'::class' |
|
182 | 182 | )); |
183 | 183 | |
184 | 184 | if ($this->isGetterProtected()) { |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | |
188 | 188 | if (!$this->isReadOnly()) { |
189 | 189 | $setter = new MethodGenerator($setterName); |
190 | - $setter->setDocBlock(new DocBlockGenerator('The setter for the ' . $referencedBeanName . ' object bound to this object via the ' . implode(' and ', $this->foreignKey->getUnquotedLocalColumns()) . ' column.')); |
|
190 | + $setter->setDocBlock(new DocBlockGenerator('The setter for the '.$referencedBeanName.' object bound to this object via the '.implode(' and ', $this->foreignKey->getUnquotedLocalColumns()).' column.')); |
|
191 | 191 | |
192 | - $setter->setParameter(new ParameterGenerator('object', ($isNullable ? '?' : '') . $this->beanNamespace . '\\' . $referencedBeanName)); |
|
192 | + $setter->setParameter(new ParameterGenerator('object', ($isNullable ? '?' : '').$this->beanNamespace.'\\'.$referencedBeanName)); |
|
193 | 193 | |
194 | 194 | $setter->setReturnType('void'); |
195 | 195 | |
@@ -198,8 +198,8 @@ discard block |
||
198 | 198 | var_export($tdbmFk->getCacheKey(), true), |
199 | 199 | '$object', |
200 | 200 | var_export($tableName, true), |
201 | - '\\' . $this->beanNamespace . '\\' . $referencedBeanName . '::class', |
|
202 | - '\\' . $this->resultIteratorNamespace . '\\' . $referencedResultIteratorName . '::class' |
|
201 | + '\\'.$this->beanNamespace.'\\'.$referencedBeanName.'::class', |
|
202 | + '\\'.$this->resultIteratorNamespace.'\\'.$referencedResultIteratorName.'::class' |
|
203 | 203 | )); |
204 | 204 | |
205 | 205 | if ($this->isSetterProtected()) { |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | /** @var Annotation\JsonFormat|null $jsonFormat */ |
240 | 240 | $jsonFormat = $this->findAnnotation(Annotation\JsonFormat::class); |
241 | 241 | if ($jsonFormat !== null) { |
242 | - $method = $jsonFormat->method ?? 'get' . ucfirst($jsonFormat->property); |
|
242 | + $method = $jsonFormat->method ?? 'get'.ucfirst($jsonFormat->property); |
|
243 | 243 | $format = "$method()"; |
244 | 244 | } else { |
245 | 245 | $stopRecursion = $this->findAnnotation(Annotation\JsonRecursive::class) ? '' : 'true'; |
@@ -295,10 +295,10 @@ discard block |
||
295 | 295 | } elseif ($descriptor instanceof ScalarBeanPropertyDescriptor) { |
296 | 296 | $rows[] = "'$indexName' => $propertyAccess->$columnGetterName()"; |
297 | 297 | } else { |
298 | - throw new TDBMException('PropertyDescriptor of class `' . get_class($descriptor) . '` cannot be serialized.'); |
|
298 | + throw new TDBMException('PropertyDescriptor of class `'.get_class($descriptor).'` cannot be serialized.'); |
|
299 | 299 | } |
300 | 300 | } |
301 | - return '[' . implode(', ', $rows) . ']'; |
|
301 | + return '['.implode(', ', $rows).']'; |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | private function getBeanPropertyDescriptor(string $column): AbstractBeanPropertyDescriptor |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | return $descriptor; |
312 | 312 | } |
313 | 313 | } |
314 | - throw new TDBMException('PropertyDescriptor for `'.$this->table->getName().'`.`' . $column . '` not found in `' . $this->foreignBeanDescriptor->getTable()->getName() . '`'); |
|
314 | + throw new TDBMException('PropertyDescriptor for `'.$this->table->getName().'`.`'.$column.'` not found in `'.$this->foreignBeanDescriptor->getTable()->getName().'`'); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | /** |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | { |
455 | 455 | $beans = $this->tdbmService->findObjects('person', null, [], 'person.id ASC', [], null, TDBMObject::class, ResultIterator::class); |
456 | 456 | |
457 | - $results = $beans->map(function ($item) { |
|
457 | + $results = $beans->map(function($item) { |
|
458 | 458 | return $item->getProperty('id', 'person'); |
459 | 459 | })->toArray(); |
460 | 460 | |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | // Same test with page |
464 | 464 | $page = $beans->take(0, 2); |
465 | 465 | |
466 | - $results = $page->map(function ($item) { |
|
466 | + $results = $page->map(function($item) { |
|
467 | 467 | return $item->getProperty('id', 'person'); |
468 | 468 | })->toArray(); |
469 | 469 | |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | public function testFindObjectsMethodWithoutResultIteratorClass(): void |
844 | 844 | { |
845 | 845 | $this->expectException(TDBMInvalidArgumentException::class); |
846 | - $this->expectExceptionMessageMatches('/^\$resultIteratorClass should be a `' . preg_quote(ResultIterator::class, '/') . '`. `(.*)` provided\.$/'); |
|
846 | + $this->expectExceptionMessageMatches('/^\$resultIteratorClass should be a `'.preg_quote(ResultIterator::class, '/').'`. `(.*)` provided\.$/'); |
|
847 | 847 | $tdbmService = new TDBMService(new Configuration('TheCodingMachine\\TDBM\\Test\\Dao\\Bean', 'TheCodingMachine\\TDBM\\Test\\Dao', self::getConnection(), $this->getNamingStrategy(), null, null, new NullLogger())); |
848 | 848 | |
849 | 849 | $tdbmService->findObjects('', null, [], null, [], null, null, self::class); |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | public function testFindObjectsFromSqlMethodWithoutResultIteratorClass(): void |
853 | 853 | { |
854 | 854 | $this->expectException(TDBMInvalidArgumentException::class); |
855 | - $this->expectExceptionMessageMatches('/^\$resultIteratorClass should be a `' . preg_quote(ResultIterator::class, '/') . '`. `(.*)` provided\.$/'); |
|
855 | + $this->expectExceptionMessageMatches('/^\$resultIteratorClass should be a `'.preg_quote(ResultIterator::class, '/').'`. `(.*)` provided\.$/'); |
|
856 | 856 | $tdbmService = new TDBMService(new Configuration('TheCodingMachine\\TDBM\\Test\\Dao\\Bean', 'TheCodingMachine\\TDBM\\Test\\Dao', self::getConnection(), $this->getNamingStrategy(), null, null, new NullLogger())); |
857 | 857 | |
858 | 858 | $tdbmService->findObjectsFromSql('', '', null, [], null, null, null, self::class); |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | public function testFindObjectsFromRawSqlMethodWithoutResultIteratorClass(): void |
862 | 862 | { |
863 | 863 | $this->expectException(TDBMInvalidArgumentException::class); |
864 | - $this->expectExceptionMessageMatches('/^\$resultIteratorClass should be a `' . preg_quote(ResultIterator::class, '/') . '`. `(.*)` provided\.$/'); |
|
864 | + $this->expectExceptionMessageMatches('/^\$resultIteratorClass should be a `'.preg_quote(ResultIterator::class, '/').'`. `(.*)` provided\.$/'); |
|
865 | 865 | $tdbmService = new TDBMService(new Configuration('TheCodingMachine\\TDBM\\Test\\Dao\\Bean', 'TheCodingMachine\\TDBM\\Test\\Dao', self::getConnection(), $this->getNamingStrategy(), null, null, new NullLogger())); |
866 | 866 | |
867 | 867 | $tdbmService->findObjectsFromRawSql('', '', [], null, null, null, self::class); |