Completed
Push — master ( 2847c6...8da64b )
by
unknown
19s queued 13s
created
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.