Completed
Push — master ( 2ddbe4...3b2952 )
by Guillaume
06:31
created
src/Structure/MysqlDatabaseColumn.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     }
89 89
 
90 90
     /**
91
-     * @return mixed
91
+     * @return integer
92 92
      */
93 93
     public function getLength()
94 94
     {
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
     }
139 139
 
140 140
     /**
141
-     * @return array
141
+     * @return string[]
142 142
      *
143 143
      * @throws TableHasNotDefinedException
144 144
      */
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     }
156 156
 
157 157
     /**
158
-     * @return array
158
+     * @return string[]
159 159
      *
160 160
      * @throws TableHasNotDefinedException
161 161
      */
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     {
53 53
         $isEnum = explode('enum', $this->type);
54 54
         if ($isEnum) {
55
-            $numberElements = substr_count(str_replace(['(', ')', "'",], '', $isEnum[1]), ',') + 1;
55
+            $numberElements = substr_count(str_replace(['(', ')', "'", ], '', $isEnum[1]), ',') + 1;
56 56
             if ($numberElements == 2) {
57 57
                 $this->type = 'tinyint';
58 58
                 $this->length = 1;
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
             throw new TableHasNotDefinedException('table not defined');
93 93
         }
94 94
         $null = $this->getNullable() ? '' : 'NOT';
95
-        $default = $this->getDefaultValue() == false ? '' : ' DEFAULT ' . $this->getDefaultValue();
95
+        $default = $this->getDefaultValue() == false ? '' : ' DEFAULT '.$this->getDefaultValue();
96 96
         $modification = sprintf('ALTER TABLE `%s` ADD COLUMN `%s` %s %s NULL %s %s;', $this->getTable(), $this->getName(), $this->getColonneType(), $null, $default, $this->getExtra());
97 97
 
98
-        return [str_replace(['   ', '  ',], ' ', $modification)];
98
+        return [str_replace(['   ', '  ', ], ' ', $modification)];
99 99
     }
100 100
 
101 101
     /**
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     {
132 132
         $baseType = $this->type;
133 133
         if (in_array($baseType, ['int', 'mediumint', 'tinyint', 'smallint', 'binary', 'varchar', 'bigint', 'char', 'float'], false)) {
134
-            $baseType = $baseType . '(' . $this->length . ')';
134
+            $baseType = $baseType.'('.$this->length.')';
135 135
         }
136 136
 
137 137
         return $baseType;
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
             throw new TableHasNotDefinedException('table not defined');
165 165
         }
166 166
         $null = $this->getNullable() ? '' : 'NOT';
167
-        $default = $this->getDefaultValue() == false ? '' : ' DEFAULT ' . $this->getDefaultValue();
168
-        $columnName = '`' . $this->getName() . '`';
167
+        $default = $this->getDefaultValue() == false ? '' : ' DEFAULT '.$this->getDefaultValue();
168
+        $columnName = '`'.$this->getName().'`';
169 169
         $modification = sprintf('ALTER TABLE `%s` CHANGE COLUMN %s %s %s %s NULL %s %s;', $this->getTable(), $columnName, $columnName, $this->getColonneType(), $null, $default, $this->getExtra());
170 170
 
171
-        return [str_replace(['   ', '  ',], ' ', $modification)];
171
+        return [str_replace(['   ', '  ', ], ' ', $modification)];
172 172
     }
173 173
 }
Please login to merge, or discard this patch.
src/Structure/MysqlDatabaseTable.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,8 +62,8 @@
 block discarded – undo
62 62
     }
63 63
 
64 64
     /**
65
-     * @param       $indexName
66
-     * @param       $unique
65
+     * @param       string $indexName
66
+     * @param       integer $unique
67 67
      * @param array $columns
68 68
      */
69 69
     protected function addIndexType($indexName, $unique, array $columns)
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     protected function addIndexType($indexName, $unique, array $columns)
70 70
     {
71 71
         if (empty($indexName)) {
72
-            $indexName = ($unique ? 'UNI_' : 'IDX_') . md5(implode(',', $columns));
72
+            $indexName = ($unique ? 'UNI_' : 'IDX_').md5(implode(',', $columns));
73 73
         }
74 74
         try {
75 75
             $index = new MysqlDatabaseIndex($indexName, $columns, $unique);
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
     {
183 183
         $statements = [];
184 184
         foreach ($modificationsBetweenTable as $modifications) {
185
-            foreach ((array)$modifications as $modification) {
185
+            foreach ((array) $modifications as $modification) {
186 186
                 $statements[] = $modification;
187 187
             }
188 188
         }
@@ -197,10 +197,10 @@  discard block
 block discarded – undo
197 197
         }
198 198
         $tmp = [];
199 199
         foreach ($modifications as $modification) {
200
-            $tmp[] = str_replace(['ALTER TABLE `' . $this->getTable() . '` ADD COLUMN', 'ALTER TABLE `' . $this->getTable() . '` ADD ', ';',], '', $modification);
200
+            $tmp[] = str_replace(['ALTER TABLE `'.$this->getTable().'` ADD COLUMN', 'ALTER TABLE `'.$this->getTable().'` ADD ', ';', ], '', $modification);
201 201
         }
202 202
 
203
-        return ['(' . $finalStatement . implode(',', $tmp) . ');'];
203
+        return ['('.$finalStatement.implode(',', $tmp).');'];
204 204
     }
205 205
 
206 206
     /**
Please login to merge, or discard this patch.
src/Checker/MysqlDatabaseCheckerService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -188,7 +188,7 @@
 block discarded – undo
188 188
     {
189 189
         $statements = [];
190 190
         foreach ($modificationsBetweenTable as $modifications) {
191
-            foreach ((array)$modifications as $modification) {
191
+            foreach ((array) $modifications as $modification) {
192 192
                 $statements[] = $modification;
193 193
             }
194 194
         }
Please login to merge, or discard this patch.
src/Factory/MysqlDatabaseFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
         try {
47 47
             $export = $factoryJsonDatabase->generate();
48 48
         } catch (\Exception $e) {
49
-            throw new \LogicException('Un expected error with json.' . $e->getMessage());
49
+            throw new \LogicException('Un expected error with json.'.$e->getMessage());
50 50
         }
51 51
 
52 52
         return $export;
Please login to merge, or discard this patch.
src/Factory/JsonDatabaseFactory.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -57,16 +57,16 @@  discard block
 block discarded – undo
57 57
             } catch (\Exception $e) {
58 58
                 continue;
59 59
             }
60
-            foreach ((array)$dataTable['columns'] as $columnName => $row) {
60
+            foreach ((array) $dataTable['columns'] as $columnName => $row) {
61 61
                 $table->addColumn(new MysqlDatabaseColumn($columnName, $row['type'], $row['length'], $row['nullable'], $row['defaultValue'], $row['extra']));
62 62
             }
63
-            foreach ((array)$dataTable['indexes'] as $row) {
63
+            foreach ((array) $dataTable['indexes'] as $row) {
64 64
                 $table->addIndex($row['columns'], $row['name']);
65 65
             }
66 66
             if (isset($dataTable['primary'])) {
67
-                $table->addPrimary((array)$dataTable['primary']);
67
+                $table->addPrimary((array) $dataTable['primary']);
68 68
             }
69
-            foreach ((array)$dataTable['uniques'] as $row) {
69
+            foreach ((array) $dataTable['uniques'] as $row) {
70 70
                 $table->addUnique($row['columns'], $row['name']);
71 71
             }
72 72
             $tables[] = $table;
@@ -129,13 +129,13 @@  discard block
 block discarded – undo
129 129
         $export = [];
130 130
         foreach ($data as $nomTable => $table) {
131 131
             $dataTable = $resolverTable->resolve($table);
132
-            foreach ((array)$dataTable['columns'] as $columnName => $column) {
132
+            foreach ((array) $dataTable['columns'] as $columnName => $column) {
133 133
                 $dataTable['columns'][$columnName] = $resolverColumns->resolve($column);
134 134
             }
135
-            foreach ((array)$dataTable['indexes'] as $keyIndex => $index) {
135
+            foreach ((array) $dataTable['indexes'] as $keyIndex => $index) {
136 136
                 $dataTable['indexes'][$keyIndex] = $resolverIndex->resolve($index);
137 137
             }
138
-            foreach ((array)$dataTable['uniques'] as $keyIndex => $index) {
138
+            foreach ((array) $dataTable['uniques'] as $keyIndex => $index) {
139 139
                 $dataTable['uniques'][$keyIndex] = $resolverIndex->resolve($index);
140 140
             }
141 141
             $export[$nomTable] = $dataTable;
Please login to merge, or discard this patch.
src/Structure/MysqlDatabaseIndex.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -90,10 +90,10 @@
 block discarded – undo
90 90
             throw new TableHasNotDefinedException('table not defined');
91 91
         }
92 92
         if ($this->isPrimary()) {
93
-            return [sprintf('ALTER TABLE `%s` ADD PRIMARY KEY (%s);', $this->getTable(), '`' . implode('`, `', $this->getColumns()) . '`')];
93
+            return [sprintf('ALTER TABLE `%s` ADD PRIMARY KEY (%s);', $this->getTable(), '`'.implode('`, `', $this->getColumns()).'`')];
94 94
         }
95 95
 
96
-        return [sprintf('ALTER TABLE `%s` ADD %s INDEX `%s` (%s);', $this->getTable(), $this->getIndexType(), $this->getName(), '`' . implode('`, `', $this->getColumns()) . '`')];
96
+        return [sprintf('ALTER TABLE `%s` ADD %s INDEX `%s` (%s);', $this->getTable(), $this->getIndexType(), $this->getName(), '`'.implode('`, `', $this->getColumns()).'`')];
97 97
     }
98 98
 
99 99
     /**
Please login to merge, or discard this patch.