Completed
Pull Request — master (#29)
by Vincent
09:49
created
src/Entity/EntityGenerator.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -724,13 +724,13 @@
 block discarded – undo
724 724
         }
725 725
 
726 726
         $replacements = array(
727
-          '<description>'       => ucfirst($type).' '.$variableName,
728
-          '<methodTypeHint>'    => $methodTypeHint,
729
-          '<variableType>'      => $variableType,
730
-          '<variableName>'      => $variableName,
731
-          '<methodName>'        => $methodName,
732
-          '<fieldName>'         => $fieldName,
733
-          '<variableDefault>'   => ($defaultValue !== null ) ? (' = '.$defaultValue) : ''
727
+            '<description>'       => ucfirst($type).' '.$variableName,
728
+            '<methodTypeHint>'    => $methodTypeHint,
729
+            '<variableType>'      => $variableType,
730
+            '<variableName>'      => $variableName,
731
+            '<methodName>'        => $methodName,
732
+            '<fieldName>'         => $fieldName,
733
+            '<variableDefault>'   => ($defaultValue !== null ) ? (' = '.$defaultValue) : ''
734 734
         );
735 735
 
736 736
         $method = str_replace(
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
         $body = str_replace('<spaces>', $this->spaces, $body);
357 357
         $last = strrpos($currentCode, '}');
358 358
 
359
-        return substr($currentCode, 0, $last) . $body . (strlen($body) > 0 ? "\n" : '') . "}\n";
359
+        return substr($currentCode, 0, $last).$body.(strlen($body) > 0 ? "\n" : '')."}\n";
360 360
     }
361 361
 
362 362
     /**
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
     protected function generateEntityNamespace(): string
366 366
     {
367 367
         if ($this->hasNamespace($this->mapperInfo->className())) {
368
-            return 'namespace ' . $this->getNamespace($this->mapperInfo->className()) .';' . "\n\n";
368
+            return 'namespace '.$this->getNamespace($this->mapperInfo->className()).';'."\n\n";
369 369
         }
370 370
 
371 371
         return '';
@@ -381,18 +381,18 @@  discard block
 block discarded – undo
381 381
         $use = [];
382 382
         
383 383
         if ($this->hasNamespace($this->getClassToExtend())) {
384
-            $use[$this->getClassToExtend()] = 'use ' . $this->getClassToExtend() . ';';
384
+            $use[$this->getClassToExtend()] = 'use '.$this->getClassToExtend().';';
385 385
         }
386 386
         
387 387
         foreach ($this->interfaces as $interface) {
388 388
             if ($this->hasNamespace($interface)) {
389
-                $use[$interface] = 'use ' . $interface . ';';
389
+                $use[$interface] = 'use '.$interface.';';
390 390
             }
391 391
         }
392 392
         
393 393
         foreach ($this->traits as $trait) {
394 394
             if ($this->hasNamespace($trait)) {
395
-                $use[$trait] = 'use ' . $trait . ';';
395
+                $use[$trait] = 'use '.$trait.';';
396 396
             }
397 397
         }
398 398
         
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
         
423 423
         sort($use);
424 424
         
425
-        return implode("\n", $use) . "\n\n";
425
+        return implode("\n", $use)."\n\n";
426 426
     }
427 427
     
428 428
     /**
@@ -430,9 +430,9 @@  discard block
 block discarded – undo
430 430
      */
431 431
     protected function generateEntityClassName()
432 432
     {
433
-        return 'class ' . $this->getClassName($this->mapperInfo->className()) .
434
-            ($this->classToExtend ? ' extends ' . $this->getClassToExtendName() : null) .
435
-            ($this->interfaces ? ' implements ' . $this->getInterfacesToImplement() : null);
433
+        return 'class '.$this->getClassName($this->mapperInfo->className()).
434
+            ($this->classToExtend ? ' extends '.$this->getClassToExtendName() : null).
435
+            ($this->interfaces ? ' implements '.$this->getInterfacesToImplement() : null);
436 436
     }
437 437
 
438 438
     /**
@@ -447,10 +447,10 @@  discard block
 block discarded – undo
447 447
         $traits = '';
448 448
         
449 449
         foreach ($this->traits as $trait) {
450
-            $traits .= $this->spaces . 'use ' . $this->getRelativeClassName($trait) . ';' . "\n";
450
+            $traits .= $this->spaces.'use '.$this->getRelativeClassName($trait).';'."\n";
451 451
         }
452 452
         
453
-        return $traits . "\n";
453
+        return $traits."\n";
454 454
     }
455 455
 
456 456
     /**
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
     {
556 556
         $lines = array();
557 557
         $lines[] = '/**';
558
-        $lines[] = ' * ' . $this->getClassName($this->mapperInfo->className());
558
+        $lines[] = ' * '.$this->getClassName($this->mapperInfo->className());
559 559
         $lines[] = ' */';
560 560
         
561 561
         return implode("\n", $lines);
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
             $variableName = Inflector::camelize($fieldName);
687 687
             $methodName = $variableName;
688 688
         } else {
689
-            $methodName = $type . Inflector::classify($fieldName);
689
+            $methodName = $type.Inflector::classify($fieldName);
690 690
             $variableName = Inflector::camelize($fieldName);
691 691
         }
692 692
         
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
         if ($propertyInfo->isObject()) {
705 705
             /** @var ObjectPropertyInfo $propertyInfo */
706 706
             $variableType = $this->getRelativeClassName($propertyInfo->className());
707
-            $methodTypeHint =  $variableType.' ';
707
+            $methodTypeHint = $variableType.' ';
708 708
         } else {
709 709
             /** @var PropertyInfo $propertyInfo */
710 710
             $variableType = $propertyInfo->phpType();
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
           '<variableName>'      => $variableName,
736 736
           '<methodName>'        => $methodName,
737 737
           '<fieldName>'         => $fieldName,
738
-          '<variableDefault>'   => ($defaultValue !== null ) ? (' = '.$defaultValue) : ''
738
+          '<variableDefault>'   => ($defaultValue !== null) ? (' = '.$defaultValue) : ''
739 739
         );
740 740
 
741 741
         $method = str_replace(
@@ -810,9 +810,9 @@  discard block
 block discarded – undo
810 810
     protected function generateFieldMappingPropertyDocBlock($property)
811 811
     {
812 812
         $lines = array();
813
-        $lines[] = $this->spaces . '/**';
814
-        $lines[] = $this->spaces . ' * @var '.$property->phpType();
815
-        $lines[] = $this->spaces . ' */';
813
+        $lines[] = $this->spaces.'/**';
814
+        $lines[] = $this->spaces.' * @var '.$property->phpType();
815
+        $lines[] = $this->spaces.' */';
816 816
 
817 817
         return implode("\n", $lines);
818 818
     }
@@ -841,9 +841,9 @@  discard block
 block discarded – undo
841 841
         }
842 842
         
843 843
         $lines = array();
844
-        $lines[] = $this->spaces . '/**';
845
-        $lines[] = $this->spaces . ' * @var '.$className;
846
-        $lines[] = $this->spaces . ' */';
844
+        $lines[] = $this->spaces.'/**';
845
+        $lines[] = $this->spaces.' * @var '.$className;
846
+        $lines[] = $this->spaces.' */';
847 847
 
848 848
         return implode("\n", $lines);
849 849
     }
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
 
885 885
             if ($inClass) {
886 886
                 $inClass = false;
887
-                $lastSeenClass = $lastSeenNamespace . ($lastSeenNamespace ? '\\' : '') . $token[1];
887
+                $lastSeenClass = $lastSeenNamespace.($lastSeenNamespace ? '\\' : '').$token[1];
888 888
                 $this->staticReflection[$lastSeenClass]['properties'] = array();
889 889
                 $this->staticReflection[$lastSeenClass]['methods'] = array();
890 890
             }
@@ -892,16 +892,16 @@  discard block
 block discarded – undo
892 892
             if ($token[0] == T_NAMESPACE) {
893 893
                 $lastSeenNamespace = "";
894 894
                 $inNamespace = true;
895
-            } elseif ($token[0] == T_CLASS && $tokens[$i-1][0] != T_DOUBLE_COLON) {
895
+            } elseif ($token[0] == T_CLASS && $tokens[$i - 1][0] != T_DOUBLE_COLON) {
896 896
                 $inClass = true;
897 897
             } elseif ($token[0] == T_FUNCTION) {
898
-                if ($tokens[$i+2][0] == T_STRING) {
899
-                    $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i+2][1]);
900
-                } elseif ($tokens[$i+2] == "&" && $tokens[$i+3][0] == T_STRING) {
901
-                    $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i+3][1]);
898
+                if ($tokens[$i + 2][0] == T_STRING) {
899
+                    $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i + 2][1]);
900
+                } elseif ($tokens[$i + 2] == "&" && $tokens[$i + 3][0] == T_STRING) {
901
+                    $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i + 3][1]);
902 902
                 }
903
-            } elseif (in_array($token[0], array(T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED)) && $tokens[$i+2][0] != T_FUNCTION) {
904
-                $this->staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i+2][1], 1);
903
+            } elseif (in_array($token[0], array(T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED)) && $tokens[$i + 2][0] != T_FUNCTION) {
904
+                $this->staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i + 2][1], 1);
905 905
             }
906 906
         }
907 907
     }
@@ -976,7 +976,7 @@  discard block
 block discarded – undo
976 976
         if ($this->hasNamespace($className)) {
977 977
             return $this->getClassName($className);
978 978
         } else {
979
-            return '\\' . $className;
979
+            return '\\'.$className;
980 980
         }
981 981
     }
982 982
     
@@ -1077,8 +1077,8 @@  discard block
 block discarded – undo
1077 1077
         $lines = explode("\n", $code);
1078 1078
 
1079 1079
         foreach ($lines as $key => $value) {
1080
-            if ( ! empty($value)) {
1081
-                $lines[$key] = str_repeat($this->spaces, $num) . $lines[$key];
1080
+            if (!empty($value)) {
1081
+                $lines[$key] = str_repeat($this->spaces, $num).$lines[$key];
1082 1082
             }
1083 1083
         }
1084 1084
 
@@ -1107,7 +1107,7 @@  discard block
 block discarded – undo
1107 1107
         }
1108 1108
         
1109 1109
         if (is_string($value)) {
1110
-            return "'" . $value . "'";
1110
+            return "'".$value."'";
1111 1111
         }
1112 1112
         
1113 1113
         if (is_bool($value)) {
@@ -1244,7 +1244,7 @@  discard block
 block discarded – undo
1244 1244
     public function setFieldVisibility(string $visibility): void
1245 1245
     {
1246 1246
         if ($visibility !== static::FIELD_VISIBLE_PRIVATE && $visibility !== static::FIELD_VISIBLE_PROTECTED) {
1247
-            throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): ' . $visibility);
1247
+            throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): '.$visibility);
1248 1248
         }
1249 1249
 
1250 1250
         $this->fieldVisibility = $visibility;
Please login to merge, or discard this patch.
src/Entity/Hydrator/Generator/TypeAccessor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
      *
40 40
      * @param string $type
41 41
      */
42
-    public function declare(string $type): void
42
+    public function declare(string$type): void
43 43
     {
44 44
         if (isset($this->declaredTypes[$type])) {
45 45
             return;
Please login to merge, or discard this patch.
src/Connection/ConnectionRegistry.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@
 block discarded – undo
124 124
         }
125 125
 
126 126
         if (!isset($this->parametersMap[$connectionName])) {
127
-            throw new DBALException('Connection name "' . $connectionName . '" is not set');
127
+            throw new DBALException('Connection name "'.$connectionName.'" is not set');
128 128
         }
129 129
 
130 130
         $parameters = $this->parametersMap[$connectionName];
Please login to merge, or discard this patch.
src/Connection/Factory/ConnectionFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
 
65 65
         // Replace 'adapter' with 'driver' and add 'pdo_'
66 66
         if (isset($parameters['adapter'])) {
67
-            $parameters['driver'] = 'pdo_' . $parameters['adapter'];
67
+            $parameters['driver'] = 'pdo_'.$parameters['adapter'];
68 68
             unset($parameters['adapter']);
69 69
         }
70 70
 
Please login to merge, or discard this patch.
src/Query/Extension/CachableTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@
 block discarded – undo
44 44
     {
45 45
         if ($this->cacheKey === null) {
46 46
             $this->cacheKey = new CacheKey(
47
-                function () { return $this->cacheNamespace(); },
48
-                $key ?? function () { return $this->cacheKey(); },
47
+                function() { return $this->cacheNamespace(); },
48
+                $key ?? function() { return $this->cacheKey(); },
49 49
                 $lifetime
50 50
             );
51 51
 
Please login to merge, or discard this patch.
src/Exception/HydratorException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
      */
25 25
     public function __construct(string $entityClass, string $message = '', ?Throwable $previous = null)
26 26
     {
27
-        parent::__construct($entityClass . ' : ' . $message, 0, $previous);
27
+        parent::__construct($entityClass.' : '.$message, 0, $previous);
28 28
 
29 29
         $this->entityClass = $entityClass;
30 30
     }
Please login to merge, or discard this patch.
src/Query/Compiler/SqlCompiler.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
         foreach ($query->statements['tables'] as $table) {
187 187
             return $query->state()->compiled = 'UPDATE '
188 188
                 . $this->quoteIdentifier($query, $table['table'])
189
-                . ' SET ' . implode(', ', $values)
189
+                . ' SET '.implode(', ', $values)
190 190
                 . $this->compileWhere($query)
191 191
             ;
192 192
         }
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
                     $from['sql'] = $this->quoteIdentifier($query, $databasePrefix.$from['table']);
525 525
                     $compiled[$from['table']] = $from;
526 526
                 } else {
527
-                    $from['sql'] = $this->quoteIdentifier($query, $databasePrefix.$from['table']) . ' ' . $this->quoteIdentifier($query, $from['alias']);
527
+                    $from['sql'] = $this->quoteIdentifier($query, $databasePrefix.$from['table']).' '.$this->quoteIdentifier($query, $from['alias']);
528 528
                     $compiled[$from['alias']] = $from;
529 529
                 }
530 530
             }
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
                 if (is_array($value)) {
698 698
                     return $this->compileIntoExpression($query, $value, $column, 'REGEXP', $converted);
699 699
                 }
700
-                return $this->quoteIdentifier($query, $column).' REGEXP '.$this->compileExpressionValue($query, (string)$value, $converted);
700
+                return $this->quoteIdentifier($query, $column).' REGEXP '.$this->compileExpressionValue($query, (string) $value, $converted);
701 701
 
702 702
             // LIKE
703 703
             case ':like':
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
                 
771 771
             // Unsupported operator
772 772
             default:
773
-                throw new UnexpectedValueException("Unsupported operator '" . $operator . "' in WHERE clause");
773
+                throw new UnexpectedValueException("Unsupported operator '".$operator."' in WHERE clause");
774 774
         }
775 775
     }
776 776
 
@@ -858,7 +858,7 @@  discard block
 block discarded – undo
858 858
         $sql = '('.$this->compileSelect($query).')';
859 859
         
860 860
         if ($alias) {
861
-            $sql = $sql . ' as ' . $this->quoteIdentifier($clause, $alias);
861
+            $sql = $sql.' as '.$this->quoteIdentifier($clause, $alias);
862 862
         }
863 863
         
864 864
         $this->addQueryBindings($clause, $query);
@@ -1016,12 +1016,12 @@  discard block
 block discarded – undo
1016 1016
         if ($lock !== null && !$query->statements['aggregate']) {
1017 1017
             // Lock for update
1018 1018
             if ($lock === LockMode::PESSIMISTIC_WRITE) {
1019
-                return ' ' . $this->platform()->grammar()->getWriteLockSQL();
1019
+                return ' '.$this->platform()->grammar()->getWriteLockSQL();
1020 1020
             }
1021 1021
 
1022 1022
             // Shared Lock: other process can read the row but not update it.
1023 1023
             if ($lock === LockMode::PESSIMISTIC_READ) {
1024
-                return ' ' . $this->platform()->grammar()->getReadLockSQL();
1024
+                return ' '.$this->platform()->grammar()->getReadLockSQL();
1025 1025
             }
1026 1026
         }
1027 1027
 
Please login to merge, or discard this patch.
src/Collection/EntityCollection.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     #[ReadOperation]
78 78
     public function load($relations)
79 79
     {
80
-        foreach (Relation::sanitizeRelations((array)$relations) as $relationName => $meta) {
80
+        foreach (Relation::sanitizeRelations((array) $relations) as $relationName => $meta) {
81 81
             $this->repository->relation($relationName)->load(
82 82
                 EntityIndexer::fromArray($this->repository->mapper(), $this->storage->all()),
83 83
                 $meta['relations'],
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     #[WriteOperation]
143 143
     public function delete()
144 144
     {
145
-        $this->repository->transaction(function (RepositoryInterface $repository) {
145
+        $this->repository->transaction(function(RepositoryInterface $repository) {
146 146
             /** @var RepositoryInterface&RepositoryEventsSubscriberInterface $repository */
147 147
             $writer = new BufferedWriter($repository);
148 148
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
     #[WriteOperation]
166 166
     public function save()
167 167
     {
168
-        $this->repository->transaction(function (RepositoryInterface $repository) {
168
+        $this->repository->transaction(function(RepositoryInterface $repository) {
169 169
             foreach ($this as $entity) {
170 170
                 $repository->save($entity);
171 171
             }
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
     #[WriteOperation]
187 187
     public function saveAll($relations)
188 188
     {
189
-        $relations = Relation::sanitizeRelations((array)$relations);
189
+        $relations = Relation::sanitizeRelations((array) $relations);
190 190
 
191 191
         return $this->repository->transaction(function(RepositoryInterface $repository) use($relations) {
192 192
             $nb = 0;
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
     #[WriteOperation]
216 216
     public function deleteAll($relations)
217 217
     {
218
-        $relations = Relation::sanitizeRelations((array)$relations);
218
+        $relations = Relation::sanitizeRelations((array) $relations);
219 219
 
220 220
         return $this->repository->transaction(function(RepositoryInterface $repository) use($relations) {
221 221
             $nb = 0;
Please login to merge, or discard this patch.
src/Query/QueryRepositoryExtension.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
             return $entity;
133 133
         }
134 134
 
135
-        throw new EntityNotFoundException('Cannot resolve entity identifier "'.implode('", "', (array)$id).'"');
135
+        throw new EntityNotFoundException('Cannot resolve entity identifier "'.implode('", "', (array) $id).'"');
136 136
     }
137 137
 
138 138
     /**
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
      */
179 179
     public function with(ReadCommandInterface $query, $relations)
180 180
     {
181
-        $this->withRelations = Relation::sanitizeRelations((array)$relations);
181
+        $this->withRelations = Relation::sanitizeRelations((array) $relations);
182 182
 
183 183
         return $query;
184 184
     }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
      */
194 194
     public function without(ReadCommandInterface $query, $relations)
195 195
     {
196
-        $this->withoutRelations = Relation::sanitizeWithoutRelations((array)$relations);
196
+        $this->withoutRelations = Relation::sanitizeWithoutRelations((array) $relations);
197 197
 
198 198
         return $query;
199 199
     }
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
         $scopes = $this->repository->scopes();
297 297
 
298 298
         if (!isset($scopes[$name])) {
299
-            throw new BadMethodCallException('Scope "' . get_class($this->mapper) . '::' . $name . '" not found');
299
+            throw new BadMethodCallException('Scope "'.get_class($this->mapper).'::'.$name.'" not found');
300 300
         }
301 301
 
302 302
         return $scopes[$name](...$arguments);
Please login to merge, or discard this patch.