Passed
Push — master ( 4044da...99b674 )
by Pieter
05:43
created
tests/RapidoBundle/StorageWriterTest.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 
24 24
     public static function setUpBeforeClass()
25 25
     {
26
-        unlink(__DIR__ . '/Config/sqlite.db');
26
+        unlink(__DIR__.'/Config/sqlite.db');
27 27
     }
28 28
 
29 29
     protected function setUp()
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
                 new ReadModelField('f1', new Boolean()),
44 44
                 new ReadModelField('f2', new TextString(10)),
45 45
             ],
46
-            function ($data) { return new Record($data['id'], ['f1' => $data['f1'], 'f2' => $data['f2']]); },
47
-            function () {}
46
+            function($data) { return new Record($data['id'], ['f1' => $data['f1'], 'f2' => $data['f2']]); },
47
+            function() {}
48 48
         );
49 49
 
50 50
         $this->writer->writeRecord($meta, ['id' => 1, 'f1' => true, 'f2' => 'test']);
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
             [
63 63
                 new ReadModelField('f1', new TextString(10), true),
64 64
             ],
65
-            function ($data) { return new Record($data['id'], ['f1' => $data['f1']]); },
66
-            function () {}
65
+            function($data) { return new Record($data['id'], ['f1' => $data['f1']]); },
66
+            function() {}
67 67
         );
68 68
 
69 69
         $this->writer->writeRecord($meta, ['id' => 1, 'f1' => 'test']);
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
                 new ReadModelField('f2', new TextString(10)),
83 83
                 new ReadModelField('f3', new TextString(10)),
84 84
             ],
85
-            function ($data) { return new Record($data['id'], ['f1' => $data['f1'], 'f2' => $data['f2'], 'f3' => $data['f2']]); },
86
-            function () {}
85
+            function($data) { return new Record($data['id'], ['f1' => $data['f1'], 'f2' => $data['f2'], 'f3' => $data['f2']]); },
86
+            function() {}
87 87
         );
88 88
 
89 89
         $this->writer->writeRecord($meta, ['id' => 2, 'f1' => true, 'f2' => 'test']);
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
                 new ReadModelField('f1', new Boolean()),
103 103
                 new ReadModelField('f2', new TextString(10))
104 104
             ],
105
-            function ($data) { return new Record($data['id'], ['f1' => $data['f1'], 'f2' => $data['f2']]); },
106
-            function () {}
105
+            function($data) { return new Record($data['id'], ['f1' => $data['f1'], 'f2' => $data['f2']]); },
106
+            function() {}
107 107
         );
108 108
 
109 109
         $this->writer->writeRecord($meta, ['id' => 2, 'f1' => true, 'f2' => 'test2']);
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
                 new ReadModelField('f1', new Boolean()),
123 123
                 new ReadModelField('f2', new TextString(10)),
124 124
             ],
125
-            function ($data) { return new Record($data['id'], ['f1' => $data['f1'], 'f2' => $data['f2']]); },
126
-            function () {},
125
+            function($data) { return new Record($data['id'], ['f1' => $data['f1'], 'f2' => $data['f2']]); },
126
+            function() {},
127 127
             'created_at'
128 128
         );
129 129
 
Please login to merge, or discard this patch.
src/RapidoAdapter/DoctrineDbalStorage/SchemaSynchronizer.php 1 patch
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,7 +41,9 @@  discard block
 block discarded – undo
41 41
 
42 42
         $this->updateTable($table);
43 43
 
44
-        if (!$metadata->generateSnapshot()) return;
44
+        if (!$metadata->generateSnapshot()) {
45
+            return;
46
+        }
45 47
 
46 48
         $table = $this->generateTable($metadata, true);
47 49
         $table->setPrimaryKey([$this->idColumnName, $metadata->getSnapshotColumnName()]);
@@ -64,7 +66,9 @@  discard block
 block discarded – undo
64 66
 
65 67
         return new Table($name,
66 68
             array_merge($predefinedColumns, array_map(function(ReadModelField $field) use (&$indices) {
67
-                if ($field->useIndex()) $indices[] = new Index(sprintf('IDX_%s', $field->getId()), [$field->getId()]);
69
+                if ($field->useIndex()) {
70
+                    $indices[] = new Index(sprintf('IDX_%s', $field->getId()), [$field->getId()]);
71
+                }
68 72
 
69 73
                 return $this->columnFactory->createColumn($field->getDataType(), $field->getId());
70 74
             }, $metadata->getFields())),
@@ -79,13 +83,15 @@  discard block
 block discarded – undo
79 83
             function(Table $existingTable) use ($table) { return $table->getName() == $existingTable->getName(); }
80 84
         );
81 85
 
82
-        if (count($existingTables) > 1)
83
-            throw new \UnexpectedValueException(sprintf("Multiple tables with the name '%s' exist.", $table->getName()));
86
+        if (count($existingTables) > 1) {
87
+                    throw new \UnexpectedValueException(sprintf("Multiple tables with the name '%s' exist.", $table->getName()));
88
+        }
84 89
 
85 90
         if (count($existingTables) == 1) {
86 91
             $tableDiff = $this->schemaComparator->diffTable(current($existingTables), $table);
87
-            if ($tableDiff)
88
-                $this->schemaManager->alterTable($tableDiff);
92
+            if ($tableDiff) {
93
+                            $this->schemaManager->alterTable($tableDiff);
94
+            }
89 95
         } else {
90 96
             $this->schemaManager->createTable($table);
91 97
         }
Please login to merge, or discard this patch.