Passed
Pull Request — master (#271)
by
unknown
14:18 queued 10:07
created
src/TDBMService.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -365,10 +365,10 @@  discard block
 block discarded – undo
365 365
 
366 366
                     $localTableName = $incomingFk->getLocalTableName();
367 367
 
368
-                    $className = $this->beanNamespace . '\\' . $this->namingStrategy->getBeanClassName($localTableName);
368
+                    $className = $this->beanNamespace.'\\'.$this->namingStrategy->getBeanClassName($localTableName);
369 369
                     assert(class_exists($className));
370 370
 
371
-                    $resultIteratorClassName = $this->resultIteratorNamespace . '\\' . $this->namingStrategy->getResultIteratorClassName($localTableName);
371
+                    $resultIteratorClassName = $this->resultIteratorNamespace.'\\'.$this->namingStrategy->getResultIteratorClassName($localTableName);
372 372
                     assert(class_exists($resultIteratorClassName));
373 373
 
374 374
                     $results = $this->findObjects(
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
                 }
439 439
             }
440 440
 
441
-            return ['(' . implode(') AND (', $sqlParts) . ')', $parameters, $counter];
441
+            return ['('.implode(') AND (', $sqlParts).')', $parameters, $counter];
442 442
         } elseif ($filter_bag instanceof ResultIterator) {
443 443
             $subQuery = $filter_bag->_getSubQuery();
444 444
             return [$subQuery, [], $counter];
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
 
1017 1017
         return $this->fromCache(
1018 1018
             $this->cachePrefix.'_linkbetweeninheritedtables_'.implode('__split__', $tables),
1019
-            function () use ($tables) {
1019
+            function() use ($tables) {
1020 1020
                 return $this->_getLinkBetweenInheritedTablesWithoutCache($tables);
1021 1021
             }
1022 1022
         );
@@ -1064,7 +1064,7 @@  discard block
 block discarded – undo
1064 1064
      */
1065 1065
     public function _getRelatedTablesByInheritance(string $table): array
1066 1066
     {
1067
-        return $this->fromCache($this->cachePrefix.'_relatedtables_'.$table, function () use ($table) {
1067
+        return $this->fromCache($this->cachePrefix.'_relatedtables_'.$table, function() use ($table) {
1068 1068
             return $this->_getRelatedTablesByInheritanceWithoutCache($table);
1069 1069
         });
1070 1070
     }
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
     public function findObjects(string $mainTable, $filter, array $parameters, $orderString, array $additionalTablesFetch, ?int $mode, ?string $className, string $resultIteratorClass): ResultIterator
1154 1154
     {
1155 1155
         if (!is_a($resultIteratorClass, ResultIterator::class, true)) {
1156
-            throw new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.');
1156
+            throw new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.');
1157 1157
         }
1158 1158
         // $mainTable is not secured in MagicJoin, let's add a bit of security to avoid SQL injection.
1159 1159
         if (!preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $mainTable)) {
@@ -1190,7 +1190,7 @@  discard block
 block discarded – undo
1190 1190
     public function findObjectsFromSql(string $mainTable, string $from, $filter, array $parameters, $orderString, ?int $mode, ?string $className, string $resultIteratorClass): ResultIterator
1191 1191
     {
1192 1192
         if (!is_a($resultIteratorClass, ResultIterator::class, true)) {
1193
-            throw new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.');
1193
+            throw new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.');
1194 1194
         }
1195 1195
         // $mainTable is not secured in MagicJoin, let's add a bit of security to avoid SQL injection.
1196 1196
         if (!preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $mainTable)) {
@@ -1223,8 +1223,8 @@  discard block
 block discarded – undo
1223 1223
      */
1224 1224
     public function findObjectByPk(string $table, array $primaryKeys, array $additionalTablesFetch, bool $lazy, string $className, string $resultIteratorClass): AbstractTDBMObject
1225 1225
     {
1226
-        assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.'));
1227
-        assert(is_a($className, AbstractTDBMObject::class, true), new TDBMInvalidArgumentException('$className should be a `'. AbstractTDBMObject::class. '`. `' . $className . '` provided.'));
1226
+        assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.'));
1227
+        assert(is_a($className, AbstractTDBMObject::class, true), new TDBMInvalidArgumentException('$className should be a `'.AbstractTDBMObject::class.'`. `'.$className.'` provided.'));
1228 1228
         $primaryKeys = $this->_getPrimaryKeysFromObjectData($table, $primaryKeys);
1229 1229
         $hash = $this->getObjectHash($primaryKeys);
1230 1230
 
@@ -1281,7 +1281,7 @@  discard block
 block discarded – undo
1281 1281
      */
1282 1282
     public function findObject(string $mainTable, $filter, array $parameters, array $additionalTablesFetch, string $className, string $resultIteratorClass) : ?AbstractTDBMObject
1283 1283
     {
1284
-        assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.'));
1284
+        assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.'));
1285 1285
         $objects = $this->findObjects($mainTable, $filter, $parameters, null, $additionalTablesFetch, self::MODE_ARRAY, $className, $resultIteratorClass);
1286 1286
         return $this->getAtMostOneObjectOrFail($objects, $mainTable, $filter, $parameters);
1287 1287
     }
@@ -1303,18 +1303,18 @@  discard block
 block discarded – undo
1303 1303
         if ($count > 1) {
1304 1304
             $additionalErrorInfos = '';
1305 1305
             if (is_string($filter) && !empty($parameters)) {
1306
-                $additionalErrorInfos = ' for filter "' . $filter.'"';
1306
+                $additionalErrorInfos = ' for filter "'.$filter.'"';
1307 1307
                 foreach ($parameters as $fieldName => $parameter) {
1308 1308
                     if (is_array($parameter)) {
1309
-                        $value = '(' . implode(',', $parameter) . ')';
1309
+                        $value = '('.implode(',', $parameter).')';
1310 1310
                     } else {
1311 1311
                         $value = $parameter;
1312 1312
                     }
1313
-                    $additionalErrorInfos = str_replace(':' . $fieldName, var_export($value, true), $additionalErrorInfos);
1313
+                    $additionalErrorInfos = str_replace(':'.$fieldName, var_export($value, true), $additionalErrorInfos);
1314 1314
                 }
1315 1315
             }
1316 1316
             $additionalErrorInfos .= '.';
1317
-            throw new DuplicateRowException("Error while querying an object in table '$mainTable': More than 1 row have been returned, but we should have received at most one" . $additionalErrorInfos);
1317
+            throw new DuplicateRowException("Error while querying an object in table '$mainTable': More than 1 row have been returned, but we should have received at most one".$additionalErrorInfos);
1318 1318
         } elseif ($count === 0) {
1319 1319
             return null;
1320 1320
         }
@@ -1338,7 +1338,7 @@  discard block
 block discarded – undo
1338 1338
      */
1339 1339
     public function findObjectFromSql(string $mainTable, string $from, $filter, array $parameters, ?string $className, string $resultIteratorClass) : ?AbstractTDBMObject
1340 1340
     {
1341
-        assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.'));
1341
+        assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.'));
1342 1342
         $objects = $this->findObjectsFromSql($mainTable, $from, $filter, $parameters, null, self::MODE_ARRAY, $className, $resultIteratorClass);
1343 1343
         return $this->getAtMostOneObjectOrFail($objects, $mainTable, $filter, $parameters);
1344 1344
     }
@@ -1359,7 +1359,7 @@  discard block
 block discarded – undo
1359 1359
     public function findObjectsFromRawSql(string $mainTable, string $sql, array $parameters, ?int $mode, ?string $className, ?string $sqlCount, string $resultIteratorClass): ResultIterator
1360 1360
     {
1361 1361
         if (!is_a($resultIteratorClass, ResultIterator::class, true)) {
1362
-            throw new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.');
1362
+            throw new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.');
1363 1363
         }
1364 1364
         // $mainTable is not secured in MagicJoin, let's add a bit of security to avoid SQL injection.
1365 1365
         if (!preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $mainTable)) {
@@ -1390,7 +1390,7 @@  discard block
 block discarded – undo
1390 1390
      */
1391 1391
     public function findObjectOrFail(string $mainTable, $filter, array $parameters, array $additionalTablesFetch, string $className, string $resultIteratorClass): AbstractTDBMObject
1392 1392
     {
1393
-        assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.'));
1393
+        assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.'));
1394 1394
         $bean = $this->findObject($mainTable, $filter, $parameters, $additionalTablesFetch, $className, $resultIteratorClass);
1395 1395
         if ($bean === null) {
1396 1396
             throw NoBeanFoundException::missFilterRecord($mainTable);
@@ -1500,7 +1500,7 @@  discard block
 block discarded – undo
1500 1500
         $table1 = $fks[0]->getForeignTableName();
1501 1501
         $table2 = $fks[1]->getForeignTableName();
1502 1502
 
1503
-        $beanTables = array_map(function (DbRow $dbRow) {
1503
+        $beanTables = array_map(function(DbRow $dbRow) {
1504 1504
             return $dbRow->_getDbTableName();
1505 1505
         }, $bean->_getDbRows());
1506 1506
 
Please login to merge, or discard this patch.
src/Utils/ManyToManyRelationshipPathDescriptor.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function __construct(string $targetTable, string $pivotTable, array $joinForeignKeys, array $joinLocalKeys, array $whereKeys, string $resultIteratorClass)
48 48
     {
49
-        assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.'));
49
+        assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.'));
50 50
         $this->targetTable = $targetTable;
51 51
         $this->pivotTable = $pivotTable;
52 52
         $this->joinForeignKeys = $joinForeignKeys;
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
     public static function generateModelKey(ForeignKeyConstraint $remoteFk, ForeignKeyConstraint $localFk): string
59 59
     {
60
-        return $remoteFk->getLocalTableName() . "." . implode("__", $localFk->getUnquotedLocalColumns());
60
+        return $remoteFk->getLocalTableName().".".implode("__", $localFk->getUnquotedLocalColumns());
61 61
     }
62 62
 
63 63
     public function getPivotName(): string
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
             );
92 92
         }
93 93
 
94
-        return $platform->quoteIdentifier($mainTable) . ' JOIN ' . $platform->quoteIdentifier($pivotTable) . ' ON ' . implode(' AND ', $join);
94
+        return $platform->quoteIdentifier($mainTable).' JOIN '.$platform->quoteIdentifier($pivotTable).' ON '.implode(' AND ', $join);
95 95
     }
96 96
 
97 97
     /**
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     {
117 117
         $params = [];
118 118
         foreach ($primaryKeys as $key => $primaryKeyValue) {
119
-            $params['param' . $key] = $primaryKeyValue;
119
+            $params['param'.$key] = $primaryKeyValue;
120 120
         }
121 121
         return $params;
122 122
     }
Please login to merge, or discard this patch.
tests/TDBMDaoGeneratorTest.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         $schemaLockFileDumper = new SchemaLockFileDumper($this->tdbmService->getConnection(), new ArrayCache(), Configuration::getDefaultLockFilePath());
113 113
         $tdbmSchemaAnalyzer = new TDBMSchemaAnalyzer($this->tdbmService->getConnection(), new ArrayCache(), $schemaAnalyzer, $schemaLockFileDumper);
114 114
         $this->tdbmDaoGenerator = new TDBMDaoGenerator($this->getConfiguration(), $tdbmSchemaAnalyzer);
115
-        $this->rootPath = __DIR__ . '/../';
115
+        $this->rootPath = __DIR__.'/../';
116 116
         //$this->tdbmDaoGenerator->setComposerFile($this->rootPath.'composer.json');
117 117
     }
118 118
 
@@ -134,10 +134,10 @@  discard block
 block discarded – undo
134 134
     public function testDaoGeneration(): void
135 135
     {
136 136
         // Remove all previously generated files.
137
-        $this->recursiveDelete($this->rootPath . 'src/Test/Dao/');
138
-        mkdir($this->rootPath . 'src/Test/Dao/Generated', 0755, true);
137
+        $this->recursiveDelete($this->rootPath.'src/Test/Dao/');
138
+        mkdir($this->rootPath.'src/Test/Dao/Generated', 0755, true);
139 139
         // Let's generate a dummy file to see it is indeed removed.
140
-        $dummyFile = $this->rootPath . 'src/Test/Dao/Generated/foobar.php';
140
+        $dummyFile = $this->rootPath.'src/Test/Dao/Generated/foobar.php';
141 141
         touch($dummyFile);
142 142
         $this->assertFileExists($dummyFile);
143 143
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 
157 157
         // Let's require all files to check they are valid PHP!
158 158
         // Test the daoFactory
159
-        require_once $this->rootPath . 'src/Test/Dao/Generated/DaoFactory.php';
159
+        require_once $this->rootPath.'src/Test/Dao/Generated/DaoFactory.php';
160 160
         // Test the others
161 161
 
162 162
         $beanDescriptors = $this->getDummyGeneratorListener()->getBeanDescriptors();
@@ -166,10 +166,10 @@  discard block
 block discarded – undo
166 166
             $daoBaseName = $beanDescriptor->getBaseDaoClassName();
167 167
             $beanName = $beanDescriptor->getBeanClassName();
168 168
             $baseBeanName = $beanDescriptor->getBaseBeanClassName();
169
-            require_once $this->rootPath . 'src/Test/Dao/Bean/Generated/' . $baseBeanName . '.php';
170
-            require_once $this->rootPath . 'src/Test/Dao/Bean/' . $beanName . '.php';
171
-            require_once $this->rootPath . 'src/Test/Dao/Generated/' . $daoBaseName . '.php';
172
-            require_once $this->rootPath . 'src/Test/Dao/' . $daoName . '.php';
169
+            require_once $this->rootPath.'src/Test/Dao/Bean/Generated/'.$baseBeanName.'.php';
170
+            require_once $this->rootPath.'src/Test/Dao/Bean/'.$beanName.'.php';
171
+            require_once $this->rootPath.'src/Test/Dao/Generated/'.$daoBaseName.'.php';
172
+            require_once $this->rootPath.'src/Test/Dao/'.$daoName.'.php';
173 173
         }
174 174
 
175 175
         // Check that pivot tables do not generate DAOs or beans.
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
         $schemaLockFileDumper = new SchemaLockFileDumper($this->tdbmService->getConnection(), new ArrayCache(), Configuration::getDefaultLockFilePath());
186 186
         $tdbmSchemaAnalyzer = new TDBMSchemaAnalyzer($this->tdbmService->getConnection(), new ArrayCache(), $schemaAnalyzer, $schemaLockFileDumper);
187 187
         $tdbmDaoGenerator = new TDBMDaoGenerator($configuration, $tdbmSchemaAnalyzer);
188
-        $this->rootPath = __DIR__ . '/../../../../';
188
+        $this->rootPath = __DIR__.'/../../../../';
189 189
         //$tdbmDaoGenerator->setComposerFile($this->rootPath.'composer.json');
190 190
 
191 191
         $this->expectException(NoPathFoundException::class);
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
         if (is_file($str)) {
204 204
             return @unlink($str);
205 205
         } elseif (is_dir($str)) {
206
-            $scan = glob(rtrim($str, '/') . '/*');
206
+            $scan = glob(rtrim($str, '/').'/*');
207 207
             foreach ($scan as $index => $path) {
208 208
                 $this->recursiveDelete($path);
209 209
             }
@@ -1643,7 +1643,7 @@  discard block
 block discarded – undo
1643 1643
 
1644 1644
         // executes after the command finishes
1645 1645
         if (!$process->isSuccessful()) {
1646
-            $this->fail('Generated code is not PSR-2 compliant' . PHP_EOL . $process->getErrorOutput());
1646
+            $this->fail('Generated code is not PSR-2 compliant'.PHP_EOL.$process->getErrorOutput());
1647 1647
         }
1648 1648
         $this->assertTrue($process->isSuccessful());
1649 1649
     }
@@ -2082,7 +2082,7 @@  discard block
 block discarded – undo
2082 2082
 
2083 2083
         $artists = new ArtistDao($this->tdbmService);
2084 2084
         $pinkFloyd = $artists->getById(1);
2085
-        $animals =  $pinkFloyd->getAlbums()[0];
2085
+        $animals = $pinkFloyd->getAlbums()[0];
2086 2086
         $json = $pinkFloyd->jsonSerialize();
2087 2087
         // Collection name properly handled ('discography' instead of default 'albums')
2088 2088
         self::assertTrue(isset($json['discography']));
Please login to merge, or discard this patch.
src/Utils/BeanDescriptor.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
      */
216 216
     public function getConstructorProperties(): array
217 217
     {
218
-        $constructorProperties = array_filter($this->beanPropertyDescriptors, static function (AbstractBeanPropertyDescriptor $property) {
218
+        $constructorProperties = array_filter($this->beanPropertyDescriptors, static function(AbstractBeanPropertyDescriptor $property) {
219 219
             return !$property instanceof InheritanceReferencePropertyDescriptor && $property->isCompulsory() && !$property->isReadOnly();
220 220
         });
221 221
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
     public function getPropertiesWithDefault(): array
231 231
     {
232 232
         $properties = $this->getPropertiesForTable($this->table);
233
-        $defaultProperties = array_filter($properties, function (AbstractBeanPropertyDescriptor $property) {
233
+        $defaultProperties = array_filter($properties, function(AbstractBeanPropertyDescriptor $property) {
234 234
             return $property->hasDefault();
235 235
         });
236 236
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
      */
245 245
     public function getExposedProperties(): array
246 246
     {
247
-        $exposedProperties = array_filter($this->beanPropertyDescriptors, function (AbstractBeanPropertyDescriptor $property) {
247
+        $exposedProperties = array_filter($this->beanPropertyDescriptors, function(AbstractBeanPropertyDescriptor $property) {
248 248
             return !$property instanceof InheritanceReferencePropertyDescriptor && $property->getTable()->getName() === $this->table->getName();
249 249
         });
250 250
 
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
         foreach ($beanPropertyDescriptors as $beanDescriptor) {
351 351
             $name = $beanDescriptor->getGetterName();
352 352
             if (isset($names[$name])) {
353
-                throw new TDBMException('Unsolvable name conflict while generating method name "' . $name . '"');
353
+                throw new TDBMException('Unsolvable name conflict while generating method name "'.$name.'"');
354 354
             } else {
355 355
                 $names[$name] = $beanDescriptor;
356 356
             }
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
             $assigns[] = $property->assignToDefaultCode()."\n";
400 400
         }
401 401
 
402
-        $body = $parentConstructorCode . implode('', $assigns);
402
+        $body = $parentConstructorCode.implode('', $assigns);
403 403
 
404 404
         $constructor->setBody($body);
405 405
 
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
         $this->descriptorsByMethodName[$name][] = $descriptor;
474 474
         $descriptors = $this->descriptorsByMethodName[$name];
475 475
         if (count($descriptors) > 1) {
476
-            $properties = array_filter($descriptors, function ($descriptor) {
476
+            $properties = array_filter($descriptors, function($descriptor) {
477 477
                 return $descriptor instanceof AbstractBeanPropertyDescriptor;
478 478
             });
479 479
             $renameProperties = count($properties) > 1;
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
         foreach ($this->getExposedProperties() as $beanPropertyDescriptor) {
525 525
             $propertyCode = $beanPropertyDescriptor->getJsonSerializeCode();
526 526
             if (!empty($propertyCode)) {
527
-                $body .= PHP_EOL . $propertyCode;
527
+                $body .= PHP_EOL.$propertyCode;
528 528
             }
529 529
         }
530 530
 
@@ -532,11 +532,11 @@  discard block
 block discarded – undo
532 532
         foreach ($this->getMethodDescriptors() as $methodDescriptor) {
533 533
             $methodCode = $methodDescriptor->getJsonSerializeCode();
534 534
             if (!empty($methodCode)) {
535
-                $body .= PHP_EOL . $methodCode;
535
+                $body .= PHP_EOL.$methodCode;
536 536
             }
537 537
         }
538 538
 
539
-        $body .= PHP_EOL . 'return $array;';
539
+        $body .= PHP_EOL.'return $array;';
540 540
 
541 541
         $method->setBody($body);
542 542
 
@@ -632,10 +632,10 @@  discard block
 block discarded – undo
632 632
         /** @var AddInterface[] $addInterfaceAnnotations */
633 633
         $addInterfaceAnnotations = $this->annotationParser->getTableAnnotations($this->table)->findAnnotations(AddInterface::class);
634 634
 
635
-        $interfaces = [ JsonSerializable::class ];
635
+        $interfaces = [JsonSerializable::class];
636 636
         foreach ($addInterfaceAnnotations as $annotation) {
637 637
             /** @phpstan-var class-string $className */
638
-            $className =  $annotation->getName();
638
+            $className = $annotation->getName();
639 639
             $interfaces[] = $className;
640 640
         }
641 641
 
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
                 }
675 675
             } elseif ($methodDescriptor instanceof PivotTableMethodsDescriptor) {
676 676
                 $pivotTableMethodsDescriptors[] = $methodDescriptor;
677
-                [ $getter, $adder, $remover, $has, $setter ] = $methodDescriptor->getCode();
677
+                [$getter, $adder, $remover, $has, $setter] = $methodDescriptor->getCode();
678 678
                 $methods = $this->codeGeneratorListener->onBaseBeanManyToManyGenerated($getter, $adder, $remover, $has, $setter, $methodDescriptor, $this, $this->configuration, $class);
679 679
                 foreach ($methods as $method) {
680 680
                     if ($method) {
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
         $interfaces = [];
805 805
         foreach ($addInterfaceOnDaoAnnotations as $annotation) {
806 806
             /** @phpstan-var class-string $className */
807
-            $className =  $annotation->getName();
807
+            $className = $annotation->getName();
808 808
             $interfaces[] = $className;
809 809
         }
810 810
 
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
 
827 827
         $constructorMethod = new MethodGenerator(
828 828
             '__construct',
829
-            [ new ParameterGenerator('tdbmService', TDBMService::class) ],
829
+            [new ParameterGenerator('tdbmService', TDBMService::class)],
830 830
             MethodGenerator::FLAG_PUBLIC,
831 831
             '$this->tdbmService = $tdbmService;',
832 832
             'Sets the TDBM service used by this DAO.'
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
 
839 839
         $saveMethod = new MethodGenerator(
840 840
             'save',
841
-            [ new ParameterGenerator('obj', $beanClassName) ],
841
+            [new ParameterGenerator('obj', $beanClassName)],
842 842
             MethodGenerator::FLAG_PUBLIC,
843 843
             '$this->tdbmService->save($obj);',
844 844
             (new DocBlockGenerator(
@@ -886,7 +886,7 @@  discard block
 block discarded – undo
886 886
 
887 887
             foreach ($primaryKeyColumns as $primaryKeyColumn) {
888 888
                 if ($primaryKeyColumn === $lazyLoadingParameterName) {
889
-                    throw new TDBMException('Primary Column name `' . $lazyLoadingParameterName . '` is not allowed.');
889
+                    throw new TDBMException('Primary Column name `'.$lazyLoadingParameterName.'` is not allowed.');
890 890
                 }
891 891
                 $phpType = TDBMDaoGenerator::dbalTypeToPhpType($this->table->getColumn($primaryKeyColumn)->getType());
892 892
                 $parameters[] = new ParameterGenerator($primaryKeyColumn, $phpType);
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
                 'getById',
903 903
                 $parameters,
904 904
                 MethodGenerator::FLAG_PUBLIC,
905
-                "return \$this->tdbmService->findObjectByPk('$tableName', [" . implode(', ', $primaryKeyFilter) . "], [], \$$lazyLoadingParameterName, \\$beanClassName::class, \\$resultIteratorClass::class);",
905
+                "return \$this->tdbmService->findObjectByPk('$tableName', [".implode(', ', $primaryKeyFilter)."], [], \$$lazyLoadingParameterName, \\$beanClassName::class, \\$resultIteratorClass::class);",
906 906
                 (new DocBlockGenerator(
907 907
                     "Get $beanClassWithoutNameSpace specified by its ID (its primary key).",
908 908
                     'If the primary key does not exist, an exception is thrown.',
@@ -1190,7 +1190,7 @@  discard block
 block discarded – undo
1190 1190
             $class->addUse(ResultIterator::class);
1191 1191
             $class->setExtendedClass(ResultIterator::class);
1192 1192
         } else {
1193
-            $class->addUse($this->resultIteratorNamespace . '\\' . $extends);
1193
+            $class->addUse($this->resultIteratorNamespace.'\\'.$extends);
1194 1194
             /** @var class-string $extends */
1195 1195
             $class->setExtendedClass($extends);
1196 1196
         }
@@ -1198,7 +1198,7 @@  discard block
 block discarded – undo
1198 1198
         $class->setDocBlock((new DocBlockGenerator(
1199 1199
             "The $baseClassName class will iterate over results of $beanClassWithoutNameSpace class.",
1200 1200
             null,
1201
-            [new Tag\MethodTag('getIterator', ['\\' . $beanClassName . '[]']), new Tag\MethodTag('toArray', ['\\' . $beanClassName . '[]'])]
1201
+            [new Tag\MethodTag('getIterator', ['\\'.$beanClassName.'[]']), new Tag\MethodTag('toArray', ['\\'.$beanClassName.'[]'])]
1202 1202
         ))->setWordWrap(false));
1203 1203
 
1204 1204
         $file = $this->codeGeneratorListener->onBaseResultIteratorGenerated($file, $this, $this->configuration);
@@ -1254,7 +1254,7 @@  discard block
 block discarded – undo
1254 1254
                 }
1255 1255
             }
1256 1256
         }
1257
-        usort($methods, static function (MethodGenerator $methodA, MethodGenerator $methodB) {
1257
+        usort($methods, static function(MethodGenerator $methodA, MethodGenerator $methodB) {
1258 1258
             return $methodA->getName() <=> $methodB->getName();
1259 1259
         });
1260 1260
 
@@ -1403,11 +1403,11 @@  discard block
 block discarded – undo
1403 1403
 
1404 1404
         if ($index->isUnique()) {
1405 1405
             $parameters[] = new ParameterGenerator('additionalTablesFetch', 'array', []);
1406
-            $params[] = new ParamTag('additionalTablesFetch', [ 'string[]' ], 'A list of additional tables to fetch (for performance improvement)');
1407
-            $params[] = new ReturnTag([ '\\'.$beanNamespace.'\\'.$beanClassName, 'null' ]);
1406
+            $params[] = new ParamTag('additionalTablesFetch', ['string[]'], 'A list of additional tables to fetch (for performance improvement)');
1407
+            $params[] = new ReturnTag(['\\'.$beanNamespace.'\\'.$beanClassName, 'null']);
1408 1408
             $method->setReturnType('?\\'.$beanNamespace.'\\'.$beanClassName);
1409 1409
 
1410
-            $docBlock = new DocBlockGenerator("Get a $beanClassName filtered by ".implode(', ', $commentArguments). '.', null, $params);
1410
+            $docBlock = new DocBlockGenerator("Get a $beanClassName filtered by ".implode(', ', $commentArguments).'.', null, $params);
1411 1411
             $docBlock->setWordWrap(false);
1412 1412
 
1413 1413
             $body = "\$filter = [
@@ -1416,12 +1416,12 @@  discard block
 block discarded – undo
1416 1416
 ";
1417 1417
         } else {
1418 1418
             $parameters[] = (new ParameterGenerator('orderBy'))->setDefaultValue(null);
1419
-            $params[] = new ParamTag('orderBy', [ 'mixed' ], 'The order string');
1419
+            $params[] = new ParamTag('orderBy', ['mixed'], 'The order string');
1420 1420
             $parameters[] = new ParameterGenerator('additionalTablesFetch', 'array', []);
1421
-            $params[] = new ParamTag('additionalTablesFetch', [ 'string[]' ], 'A list of additional tables to fetch (for performance improvement)');
1421
+            $params[] = new ParamTag('additionalTablesFetch', ['string[]'], 'A list of additional tables to fetch (for performance improvement)');
1422 1422
             $parameters[] = (new ParameterGenerator('mode', '?int'))->setDefaultValue(null);
1423
-            $params[] = new ParamTag('mode', [ 'int', 'null' ], 'Either TDBMService::MODE_ARRAY or TDBMService::MODE_CURSOR (for large datasets). Defaults to TDBMService::MODE_ARRAY.');
1424
-            $method->setReturnType($this->resultIteratorNamespace . '\\' . $this->getResultIteratorClassName());
1423
+            $params[] = new ParamTag('mode', ['int', 'null'], 'Either TDBMService::MODE_ARRAY or TDBMService::MODE_CURSOR (for large datasets). Defaults to TDBMService::MODE_ARRAY.');
1424
+            $method->setReturnType($this->resultIteratorNamespace.'\\'.$this->getResultIteratorClassName());
1425 1425
 
1426 1426
             $docBlock = new DocBlockGenerator("Get a list of $beanClassName filtered by ".implode(', ', $commentArguments).".", null, $params);
1427 1427
             $docBlock->setWordWrap(false);
@@ -1481,8 +1481,8 @@  discard block
 block discarded – undo
1481 1481
                     var_export($tdbmFk->getCacheKey(), true),
1482 1482
                     'null',
1483 1483
                     var_export($this->table->getName(), true),
1484
-                    '\\' . $this->beanNamespace . '\\' . $this->namingStrategy->getBeanClassName($foreignTableName) . '::class',
1485
-                    '\\' . $this->resultIteratorNamespace . '\\' . $this->namingStrategy->getResultIteratorClassName($foreignTableName) . '::class'
1484
+                    '\\'.$this->beanNamespace.'\\'.$this->namingStrategy->getBeanClassName($foreignTableName).'::class',
1485
+                    '\\'.$this->resultIteratorNamespace.'\\'.$this->namingStrategy->getResultIteratorClassName($foreignTableName).'::class'
1486 1486
                 );
1487 1487
             }
1488 1488
         }
@@ -1756,17 +1756,17 @@  discard block
 block discarded – undo
1756 1756
      * @param string $indent
1757 1757
      * @return string
1758 1758
      */
1759
-    private function psr2VarExport($var, string $indent=''): string
1759
+    private function psr2VarExport($var, string $indent = ''): string
1760 1760
     {
1761 1761
         if (is_array($var)) {
1762 1762
             $indexed = array_keys($var) === range(0, count($var) - 1);
1763 1763
             $r = [];
1764 1764
             foreach ($var as $key => $value) {
1765 1765
                 $r[] = "$indent    "
1766
-                    . ($indexed ? '' : $this->psr2VarExport($key) . ' => ')
1766
+                    . ($indexed ? '' : $this->psr2VarExport($key).' => ')
1767 1767
                     . $this->psr2VarExport($value, "$indent    ");
1768 1768
             }
1769
-            return "[\n" . implode(",\n", $r) . "\n" . $indent . ']';
1769
+            return "[\n".implode(",\n", $r)."\n".$indent.']';
1770 1770
         }
1771 1771
         return var_export($var, true);
1772 1772
     }
Please login to merge, or discard this patch.
src/InnerResultIterator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@
 block discarded – undo
135 135
         if ($this->fetchStarted && $this->tdbmService->getConnection()->getDatabasePlatform() instanceof MySqlPlatform) {
136 136
             // Optimisation: we don't need a separate "count" SQL request in MySQL.
137 137
             assert($this->statement instanceof Statement);
138
-            $this->count = (int)$this->statement->rowCount();
138
+            $this->count = (int) $this->statement->rowCount();
139 139
             return $this->count;
140 140
         }
141 141
         return $this->getRowCountViaSqlQuery();
Please login to merge, or discard this patch.