@@ -73,18 +73,18 @@ discard block |
||
| 73 | 73 | $connection->exec($sqlStmt); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - for ($i = 1; $i<200; $i++) { |
|
| 76 | + for ($i = 1; $i < 200; $i++) { |
|
| 77 | 77 | TDBMAbstractServiceTest::insert($connection, 'countries', [ |
| 78 | 78 | 'id' => $i, |
| 79 | 79 | 'label' => 'Country '.$i, |
| 80 | 80 | ]); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - for ($i = 1; $i<1000; $i++) { |
|
| 83 | + for ($i = 1; $i < 1000; $i++) { |
|
| 84 | 84 | TDBMAbstractServiceTest::insert($connection, 'users', [ |
| 85 | 85 | 'id' => $i, |
| 86 | 86 | 'name' => 'User '.$i, |
| 87 | - 'country_id' => ($i%199) +1, |
|
| 87 | + 'country_id' => ($i % 199) + 1, |
|
| 88 | 88 | ]); |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | $schemaLockFileDumper = new SchemaLockFileDumper($connection, new ArrayCache(), Configuration::getDefaultLockFilePath()); |
| 97 | 97 | $tdbmSchemaAnalyzer = new TDBMSchemaAnalyzer($connection, new ArrayCache(), $schemaAnalyzer, $schemaLockFileDumper); |
| 98 | 98 | $tdbmDaoGenerator = new TDBMDaoGenerator(self::createConfiguration(), $tdbmSchemaAnalyzer); |
| 99 | - $rootPath = __DIR__ . '/../'; |
|
| 100 | - self::recursiveDelete(__DIR__. '/../../src/Test/Dao/'); |
|
| 99 | + $rootPath = __DIR__.'/../'; |
|
| 100 | + self::recursiveDelete(__DIR__.'/../../src/Test/Dao/'); |
|
| 101 | 101 | |
| 102 | 102 | $tdbmDaoGenerator->generateAllDaosAndBeans(); |
| 103 | 103 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | if (is_file($str)) { |
| 114 | 114 | return @unlink($str); |
| 115 | 115 | } elseif (is_dir($str)) { |
| 116 | - $scan = glob(rtrim($str, '/') . '/*'); |
|
| 116 | + $scan = glob(rtrim($str, '/').'/*'); |
|
| 117 | 117 | foreach ($scan as $index => $path) { |
| 118 | 118 | self::recursiveDelete($path); |
| 119 | 119 | } |
@@ -30,7 +30,7 @@ |
||
| 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)); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | $this->assertEquals(null, $a->first()); |
| 26 | 26 | $this->assertEquals(null, isset($a[0])); //an empty resultIterator must implement arrayAccess |
| 27 | 27 | $this->assertEquals([], $a->toArray()); |
| 28 | - foreach ($a->map(function ($foo) { |
|
| 28 | + foreach ($a->map(function($foo) { |
|
| 29 | 29 | }) as $empty) { |
| 30 | 30 | throw new \LogicException("Not supposed to iterate on an empty iterator."); |
| 31 | 31 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $this->assertEquals(0, $b->count()); |
| 52 | 52 | $this->assertEquals([], $b->toArray()); |
| 53 | 53 | $this->assertEquals(0, $b->totalCount()); |
| 54 | - $c = $b->map(function ($foo) { |
|
| 54 | + $c = $b->map(function($foo) { |
|
| 55 | 55 | }); |
| 56 | 56 | foreach ($c as $empty) { |
| 57 | 57 | throw new \LogicException("Not supposed to iterate on an empty iterator."); |
@@ -12,8 +12,8 @@ |
||
| 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 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | { |
| 39 | 39 | return new ArrayIterator($this); |
| 40 | 40 | } |
| 41 | - }, function ($item) { |
|
| 41 | + }, function($item) { |
|
| 42 | 42 | return $item; |
| 43 | 43 | }); |
| 44 | 44 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | public function testConstructorException1(): void |
| 49 | 49 | { |
| 50 | 50 | $this->expectException('TheCodingMachine\TDBM\TDBMException'); |
| 51 | - $mapIterator = new MapIterator(new \DateTime(), function ($item) { |
|
| 51 | + $mapIterator = new MapIterator(new \DateTime(), function($item) { |
|
| 52 | 52 | return $item; |
| 53 | 53 | }); |
| 54 | 54 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | public function testConstructorException2(): void |
| 57 | 57 | { |
| 58 | 58 | $this->expectException('TheCodingMachine\TDBM\TDBMException'); |
| 59 | - $mapIterator = new MapIterator(array(1, 2, 3), function () { |
|
| 59 | + $mapIterator = new MapIterator(array(1, 2, 3), function() { |
|
| 60 | 60 | return $item; |
| 61 | 61 | }); |
| 62 | 62 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | public function testJsonSerialize(): void |
| 65 | 65 | { |
| 66 | 66 | $value = array(1, 2, 3); |
| 67 | - $mapIterator = new MapIterator($value, function ($item) { |
|
| 67 | + $mapIterator = new MapIterator($value, function($item) { |
|
| 68 | 68 | return $item; |
| 69 | 69 | }); |
| 70 | 70 | |
@@ -128,7 +128,7 @@ |
||
| 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 | |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | $objectStorage = new NativeWeakrefObjectStorage(); |
| 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)); |
@@ -63,7 +63,7 @@ |
||
| 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 | } |
@@ -201,7 +201,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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'; |