Passed
Push — feature-FRAM-58-refactor-entit... ( e3cd10...fc48d1 )
by Vincent
06:00
created
src/Entity/EntityGenerator.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
                 case $property->isArray() && $property->wrapper() === null:
537 537
                     // Simple array relation
538 538
                     $generator->setDefaultValue([]);
539
-                    $generator->setVarTag($property->className() . '[]');
539
+                    $generator->setVarTag($property->className().'[]');
540 540
 
541 541
                     if ($this->useTypedProperties) {
542 542
                         $generator->setTypeHint('array');
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
                 case $property->isArray() && $property->wrapper() !== null:
547 547
                     // Array relation with wrapper
548 548
                     $repository = $this->prime->repository($property->className());
549
-                    $generator->setVarTag($repository->collectionFactory()->wrapperClass($property->wrapper()) . '|' . $property->className() . '[]');
549
+                    $generator->setVarTag($repository->collectionFactory()->wrapperClass($property->wrapper()).'|'.$property->className().'[]');
550 550
 
551 551
                     // The value is an object : so the default value must be null
552 552
                     if ($nullable) {
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
             $variableName = $this->inflector->camelize($fieldName);
602 602
             $methodName = $variableName;
603 603
         } else {
604
-            $methodName = $prefix . $this->inflector->classify($fieldName);
604
+            $methodName = $prefix.$this->inflector->classify($fieldName);
605 605
             $variableName = $this->inflector->camelize($fieldName);
606 606
         }
607 607
 
@@ -664,12 +664,12 @@  discard block
 block discarded – undo
664 664
         }
665 665
 
666 666
         $method = $generator->addMethod($metadata['method']);
667
-        $method->addComment('Get ' . $metadata['variable']);
667
+        $method->addComment('Get '.$metadata['variable']);
668 668
         $method->addComment('');
669 669
         $method->setReturnType($metadata['typeHint']);
670 670
         $method->setReturnNullable($metadata['nullable']);
671 671
         $method->setBody('return $this->?;', [$metadata['field']]);
672
-        $method->addComment('@return ' . $metadata['docType']);
672
+        $method->addComment('@return '.$metadata['docType']);
673 673
     }
674 674
 
675 675
     protected function generateSetter(ClassType $generator, PhpNamespace $namespace, InfoInterface $propertyInfo): void
@@ -681,9 +681,9 @@  discard block
 block discarded – undo
681 681
         }
682 682
 
683 683
         $method = $generator->addMethod($metadata['method']);
684
-        $method->addComment('Set ' . $metadata['variable']);
684
+        $method->addComment('Set '.$metadata['variable']);
685 685
         $method->addComment('');
686
-        $method->addComment('@param ' . $metadata['docType'] . ' $' . $metadata['variable']);
686
+        $method->addComment('@param '.$metadata['docType'].' $'.$metadata['variable']);
687 687
         $method->addComment('');
688 688
         $method->addComment('@return $this');
689 689
         $method->setReturnType('self');
@@ -706,9 +706,9 @@  discard block
 block discarded – undo
706 706
         }
707 707
 
708 708
         $method = $generator->addMethod($metadata['method']);
709
-        $method->addComment('Add ' . $metadata['variable']);
709
+        $method->addComment('Add '.$metadata['variable']);
710 710
         $method->addComment('');
711
-        $method->addComment('@param ' . $metadata['docType'] . ' $' . $metadata['variable']);
711
+        $method->addComment('@param '.$metadata['docType'].' $'.$metadata['variable']);
712 712
         $method->addComment('');
713 713
         $method->addComment('@return $this');
714 714
         $method->setReturnType('self');
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
 
760 760
             if ($inClass) {
761 761
                 $inClass = false;
762
-                $lastSeenClass = $lastSeenNamespace . ($lastSeenNamespace ? '\\' : '') . $token[1];
762
+                $lastSeenClass = $lastSeenNamespace.($lastSeenNamespace ? '\\' : '').$token[1];
763 763
                 $this->staticReflection[$lastSeenClass]['properties'] = [];
764 764
                 $this->staticReflection[$lastSeenClass]['methods'] = [];
765 765
             }
@@ -767,16 +767,16 @@  discard block
 block discarded – undo
767 767
             if ($token[0] == T_NAMESPACE) {
768 768
                 $lastSeenNamespace = "";
769 769
                 $inNamespace = true;
770
-            } elseif ($token[0] == T_CLASS && $tokens[$i-1][0] != T_DOUBLE_COLON) {
770
+            } elseif ($token[0] == T_CLASS && $tokens[$i - 1][0] != T_DOUBLE_COLON) {
771 771
                 $inClass = true;
772 772
             } elseif ($token[0] == T_FUNCTION) {
773
-                if ($tokens[$i+2][0] == T_STRING) {
774
-                    $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i+2][1]);
775
-                } elseif ($tokens[$i+2] == "&" && $tokens[$i+3][0] == T_STRING) {
776
-                    $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i+3][1]);
773
+                if ($tokens[$i + 2][0] == T_STRING) {
774
+                    $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i + 2][1]);
775
+                } elseif ($tokens[$i + 2] == "&" && $tokens[$i + 3][0] == T_STRING) {
776
+                    $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i + 3][1]);
777 777
                 }
778
-            } elseif (in_array($token[0], [T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED]) && $tokens[$i+2][0] != T_FUNCTION) {
779
-                $this->staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i+2][1], 1);
778
+            } elseif (in_array($token[0], [T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED]) && $tokens[$i + 2][0] != T_FUNCTION) {
779
+                $this->staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i + 2][1], 1);
780 780
             }
781 781
         }
782 782
     }
@@ -1026,7 +1026,7 @@  discard block
 block discarded – undo
1026 1026
     public function setFieldVisibility(string $visibility): void
1027 1027
     {
1028 1028
         if ($visibility !== static::FIELD_VISIBLE_PRIVATE && $visibility !== static::FIELD_VISIBLE_PROTECTED) {
1029
-            throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): ' . $visibility);
1029
+            throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): '.$visibility);
1030 1030
         }
1031 1031
 
1032 1032
         $this->fieldVisibility = $visibility;
@@ -1293,7 +1293,7 @@  discard block
 block discarded – undo
1293 1293
                 continue;
1294 1294
             }
1295 1295
 
1296
-            $part = $namespace->simplifyName($atomicType) . ($isArray ? '[]' : '');
1296
+            $part = $namespace->simplifyName($atomicType).($isArray ? '[]' : '');
1297 1297
         }
1298 1298
 
1299 1299
         return implode('|', $types);
Please login to merge, or discard this patch.