Passed
Pull Request — 5.1 (#282)
by
unknown
03:34
created
tests/WeakrefObjectStorageTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
         $objectStorage = new WeakrefObjectStorage();
31 31
         $dbRow = $this->createMock(DbRow::class);
32 32
 
33
-        for ($i=0; $i<10001; $i++) {
33
+        for ($i = 0; $i < 10001; $i++) {
34 34
             $objectStorage->set('foo', $i, clone $dbRow);
35 35
         }
36 36
         $this->assertNull($objectStorage->get('foo', 42));
Please login to merge, or discard this patch.
tests/Utils/DbalUtilsTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@
 block discarded – undo
12 12
     {
13 13
         $params = [
14 14
             'key1' => 'foo',
15
-            'key2' => [1,2,3],
16
-            'key3' => [1,2,'baz'],
15
+            'key2' => [1, 2, 3],
16
+            'key3' => [1, 2, 'baz'],
17 17
             'key4' => 1,
18 18
         ];
19 19
 
Please login to merge, or discard this patch.
tests/AlterableResultIteratorTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@
 block discarded – undo
128 128
 
129 129
         $alterableResultIterator = new AlterableResultIterator($iterator);
130 130
 
131
-        $map = $alterableResultIterator->map(function ($item) {
131
+        $map = $alterableResultIterator->map(function($item) {
132 132
             return $item->foo;
133 133
         });
134 134
 
Please login to merge, or discard this patch.
src/Schema/ForeignKey.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
     public function getCacheKey(): string
64 64
     {
65 65
         if ($this->cacheKey === null) {
66
-            $this->cacheKey = 'from__' . implode(',', $this->getUnquotedLocalColumns()) . '__to__table__' . $this->getForeignTableName() . '__columns__' . implode(',', $this->getUnquotedForeignColumns());
66
+            $this->cacheKey = 'from__'.implode(',', $this->getUnquotedLocalColumns()).'__to__table__'.$this->getForeignTableName().'__columns__'.implode(',', $this->getUnquotedForeignColumns());
67 67
         }
68 68
         return $this->cacheKey;
69 69
     }
Please login to merge, or discard this patch.
src/Utils/PivotTableMethodsDescriptor.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 
202 202
         $getter = new MethodGenerator($this->getName());
203 203
         $getterDocBlock = new DocBlockGenerator(sprintf('Returns the list of %s associated to this bean via the %s pivot table.', $remoteBeanName, $this->pivotTable->getName()));
204
-        $getterDocBlock->setTag(new ReturnTag([ $fqcnRemoteBeanName.'[]' ]));
204
+        $getterDocBlock->setTag(new ReturnTag([$fqcnRemoteBeanName.'[]']));
205 205
         $getterDocBlock->setWordWrap(false);
206 206
         $getter->setDocBlock($getterDocBlock);
207 207
         $getter->setReturnType('array');
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 
211 211
         $adder = new MethodGenerator('add'.$singularName);
212 212
         $adderDocBlock = new DocBlockGenerator(sprintf('Adds a relationship with %s associated to this bean via the %s pivot table.', $remoteBeanName, $this->pivotTable->getName()));
213
-        $adderDocBlock->setTag(new ParamTag($variableName, [ $fqcnRemoteBeanName ]));
213
+        $adderDocBlock->setTag(new ParamTag($variableName, [$fqcnRemoteBeanName]));
214 214
         $adderDocBlock->setWordWrap(false);
215 215
         $adder->setDocBlock($adderDocBlock);
216 216
         $adder->setReturnType('void');
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 
220 220
         $remover = new MethodGenerator('remove'.$singularName);
221 221
         $removerDocBlock = new DocBlockGenerator(sprintf('Deletes the relationship with %s associated to this bean via the %s pivot table.', $remoteBeanName, $this->pivotTable->getName()));
222
-        $removerDocBlock->setTag(new ParamTag($variableName, [ $fqcnRemoteBeanName ]));
222
+        $removerDocBlock->setTag(new ParamTag($variableName, [$fqcnRemoteBeanName]));
223 223
         $removerDocBlock->setWordWrap(false);
224 224
         $remover->setDocBlock($removerDocBlock);
225 225
         $remover->setReturnType('void');
@@ -228,8 +228,8 @@  discard block
 block discarded – undo
228 228
 
229 229
         $has = new MethodGenerator('has'.$singularName);
230 230
         $hasDocBlock = new DocBlockGenerator(sprintf('Returns whether this bean is associated with %s via the %s pivot table.', $remoteBeanName, $this->pivotTable->getName()));
231
-        $hasDocBlock->setTag(new ParamTag($variableName, [ $fqcnRemoteBeanName ]));
232
-        $hasDocBlock->setTag(new ReturnTag([ 'bool' ]));
231
+        $hasDocBlock->setTag(new ParamTag($variableName, [$fqcnRemoteBeanName]));
232
+        $hasDocBlock->setTag(new ReturnTag(['bool']));
233 233
         $hasDocBlock->setWordWrap(false);
234 234
         $has->setDocBlock($hasDocBlock);
235 235
         $has->setReturnType('bool');
@@ -239,15 +239,15 @@  discard block
 block discarded – undo
239 239
         $setter = new MethodGenerator('set'.$pluralName);
240 240
         $setterDocBlock = new DocBlockGenerator(sprintf('Sets all relationships with %s associated to this bean via the %s pivot table.
241 241
 Exiting relationships will be removed and replaced by the provided relationships.', $remoteBeanName, $this->pivotTable->getName()));
242
-        $setterDocBlock->setTag(new ParamTag($pluralVariableName, [ $fqcnRemoteBeanName.'[]' ]));
243
-        $setterDocBlock->setTag(new ReturnTag([ 'void' ]));
242
+        $setterDocBlock->setTag(new ParamTag($pluralVariableName, [$fqcnRemoteBeanName.'[]']));
243
+        $setterDocBlock->setTag(new ReturnTag(['void']));
244 244
         $setterDocBlock->setWordWrap(false);
245 245
         $setter->setDocBlock($setterDocBlock);
246 246
         $setter->setReturnType('void');
247 247
         $setter->setParameter(new ParameterGenerator($pluralVariableName, 'array'));
248 248
         $setter->setBody(sprintf('$this->setRelationships(%s, $%s);', $pathKey, $pluralVariableName));
249 249
 
250
-        return [ $getter, $adder, $remover, $has, $setter ];
250
+        return [$getter, $adder, $remover, $has, $setter];
251 251
     }
252 252
 
253 253
     /**
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
         /** @var Annotation\JsonFormat|null $jsonFormat */
277 277
         $jsonFormat = $this->findRemoteAnnotation(Annotation\JsonFormat::class);
278 278
         if ($jsonFormat !== null) {
279
-            $method = $jsonFormat->method ?? 'get' . ucfirst($jsonFormat->property);
279
+            $method = $jsonFormat->method ?? 'get'.ucfirst($jsonFormat->property);
280 280
             $format = "$method()";
281 281
         } else {
282 282
             $stopRecursion = $this->findRemoteAnnotation(Annotation\JsonRecursive::class) ? '' : 'true';
Please login to merge, or discard this patch.
src/Utils/Annotation/Annotations.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
     public function findAnnotations(string $annotationType): array
41 41
     {
42
-        return array_values(array_filter($this->annotations, function ($annotation) use ($annotationType) {
42
+        return array_values(array_filter($this->annotations, function($annotation) use ($annotationType) {
43 43
             return is_a($annotation, $annotationType);
44 44
         }));
45 45
     }
Please login to merge, or discard this patch.
src/Utils/Annotation/AnnotationParser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
 
72 72
         // Let's add * in front of the line (otherwise, parsing is failing)
73 73
         $lines = explode("\n", $comment);
74
-        $lines = array_map(function (string $line) {
74
+        $lines = array_map(function(string $line) {
75 75
             return '* '.$line;
76 76
         }, $lines);
77 77
         $comment = implode("\n", $lines);
Please login to merge, or discard this patch.
src/Utils/DirectForeignKeyMethodDescriptor.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
     public function getName() : string
72 72
     {
73 73
         if (!$this->useAlternateName) {
74
-            return 'get' . $this->getPropertyName();
74
+            return 'get'.$this->getPropertyName();
75 75
         } else {
76
-            $methodName = 'get' . $this->getPropertyName() . 'By';
76
+            $methodName = 'get'.$this->getPropertyName().'By';
77 77
 
78 78
             $camelizedColumns = array_map([TDBMDaoGenerator::class, 'toCamelCase'], $this->foreignKey->getUnquotedLocalColumns());
79 79
 
@@ -128,12 +128,12 @@  discard block
 block discarded – undo
128 128
         $getter = new MethodGenerator($this->getName());
129 129
 
130 130
         if ($this->hasLocalUniqueIndex()) {
131
-            $classType = '\\' . $this->beanNamespace . '\\' . $beanClass;
131
+            $classType = '\\'.$this->beanNamespace.'\\'.$beanClass;
132 132
             $getterDocBlock = new DocBlockGenerator(sprintf('Returns the %s pointing to this bean via the %s column.', $beanClass, implode(', ', $this->foreignKey->getUnquotedLocalColumns())));
133
-            $getterDocBlock->setTag([new ReturnTag([$classType . '|null'])]);
133
+            $getterDocBlock->setTag([new ReturnTag([$classType.'|null'])]);
134 134
             $getterDocBlock->setWordWrap(false);
135 135
             $getter->setDocBlock($getterDocBlock);
136
-            $getter->setReturnType('?' . $classType);
136
+            $getter->setReturnType('?'.$classType);
137 137
 
138 138
             $code = sprintf(
139 139
                 'return $this->retrieveManyToOneRelationshipsStorage(%s, %s, %s)->first();',
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
             );
144 144
         } else {
145 145
             $getterDocBlock = new DocBlockGenerator(sprintf('Returns the list of %s pointing to this bean via the %s column.', $beanClass, implode(', ', $this->foreignKey->getUnquotedLocalColumns())));
146
-            $getterDocBlock->setTag(new ReturnTag([$beanClass . '[]', '\\' . AlterableResultIterator::class]));
146
+            $getterDocBlock->setTag(new ReturnTag([$beanClass.'[]', '\\'.AlterableResultIterator::class]));
147 147
             $getterDocBlock->setWordWrap(false);
148 148
             $getter->setDocBlock($getterDocBlock);
149 149
             $getter->setReturnType(AlterableResultIterator::class);
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
             $getter->setVisibility(AbstractMemberGenerator::VISIBILITY_PROTECTED);
163 163
         }
164 164
 
165
-        return [ $getter ];
165
+        return [$getter];
166 166
     }
167 167
 
168 168
     private function getFilters(ForeignKeyConstraint $fk) : string
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
         /** @var Annotation\JsonFormat|null $jsonFormat */
234 234
         $jsonFormat = $this->findAnnotation(Annotation\JsonFormat::class);
235 235
         if ($jsonFormat !== null) {
236
-            $method = $jsonFormat->method ?? 'get' . ucfirst($jsonFormat->property);
236
+            $method = $jsonFormat->method ?? 'get'.ucfirst($jsonFormat->property);
237 237
             $format = "$method()";
238 238
         } else {
239 239
             $stopRecursion = $this->findAnnotation(Annotation\JsonRecursive::class) ? '' : 'true';
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
         $isIncluded = $this->findAnnotation(Annotation\JsonInclude::class) !== null;
243 243
         $index = $jsonCollection->key ?: lcfirst($this->getPropertyName());
244 244
         $class = $this->getBeanClassName();
245
-        $variableName = '$' . TDBMDaoGenerator::toVariableName($class);
245
+        $variableName = '$'.TDBMDaoGenerator::toVariableName($class);
246 246
         $getter = $this->getName();
247 247
         if ($this->hasLocalUniqueIndex()) {
248 248
             $code = "\$array['$index'] = (\$object = \$this->$getter()) ? \$object->$format : null;";
Please login to merge, or discard this patch.
src/Utils/ScalarBeanPropertyDescriptor.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
                 'time',
163 163
                 'time_immutable',
164 164
             ], true)) {
165
-                if ($default !== null && in_array(strtoupper($default), ['CURRENT_TIMESTAMP' /* MySQL */, 'NOW()' /* PostgreSQL */, 'SYSDATE' /* Oracle */ , 'CURRENT_TIMESTAMP()' /* MariaDB 10.3 */], true)) {
165
+                if ($default !== null && in_array(strtoupper($default), ['CURRENT_TIMESTAMP' /* MySQL */, 'NOW()' /* PostgreSQL */, 'SYSDATE' /* Oracle */, 'CURRENT_TIMESTAMP()' /* MariaDB 10.3 */], true)) {
166 166
                     $defaultCode = 'new \DateTimeImmutable()';
167 167
                 } else {
168 168
                     throw new TDBMException('Unable to set default value for date in "'.$this->table->getName().'.'.$this->column->getName().'". Database passed this default value: "'.$default.'"');
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
             case 'v4':
187 187
                 return 'Uuid::uuid4()->toString()';
188 188
             default:
189
-                throw new TDBMException('@UUID annotation accepts either "v1" or "v4" parameter. Unexpected parameter: ' . $comment);
189
+                throw new TDBMException('@UUID annotation accepts either "v1" or "v4" parameter. Unexpected parameter: '.$comment);
190 190
         }
191 191
     }
192 192
 
@@ -234,14 +234,14 @@  discard block
 block discarded – undo
234 234
             $resourceTypeCheck = sprintf($resourceTypeCheck, $checkNullable, $variableName, $variableName);
235 235
         }
236 236
 
237
-        $types = [ $normalizedType ];
237
+        $types = [$normalizedType];
238 238
         if ($isNullable) {
239 239
             $types[] = 'null';
240 240
         }
241 241
 
242 242
         $paramType = null;
243 243
         if ($this->isTypeHintable()) {
244
-            $paramType = ($isNullable?'?':'').$normalizedType;
244
+            $paramType = ($isNullable ? '?' : '').$normalizedType;
245 245
         }
246 246
 
247 247
         $getter = new MethodGenerator($columnGetterName);
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
                             break;
338 338
                         }
339 339
                     }
340
-                    $args = array_map(function ($v) {
340
+                    $args = array_map(function($v) {
341 341
                         return var_export($v, true);
342 342
                     }, $args);
343
-                    $args = empty($args) ? '' : ', ' . implode(', ', $args);
344
-                    $unit = $jsonFormat->unit ? ' . ' . var_export($jsonFormat->unit, true) : '';
343
+                    $args = empty($args) ? '' : ', '.implode(', ', $args);
344
+                    $unit = $jsonFormat->unit ? ' . '.var_export($jsonFormat->unit, true) : '';
345 345
                     if ($this->column->getNotnull()) {
346 346
                         return "\$array['$index'] = number_format(\$this->$getter()$args)$unit;";
347 347
                     } else {
Please login to merge, or discard this patch.