Passed
Pull Request — master (#55)
by Thomas
01:32
created
src/Dbal/Type/Number.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
     public function validate($value)
24 24
     {
25 25
         if (!is_int($value) && !is_double($value) && (!is_string($value) || !is_numeric($value))) {
26
-            return new NoNumber([ 'value' => (string) $value ]);
26
+            return new NoNumber(['value' => (string) $value]);
27 27
         }
28 28
 
29 29
         return true;
Please login to merge, or discard this patch.
src/Dbal/Type/DateTime.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,8 +35,7 @@  discard block
 block discarded – undo
35 35
     {
36 36
         $this->precision = (int) $precision;
37 37
         $this->regex     = $dateOnly ?
38
-            '/^' . self::DATE_REGEX . '([ T]' . self::TIME_REGEX . self::ZONE_REGEX . ')?$/' :
39
-            '/^' . self::DATE_REGEX . '[ T]' . self::TIME_REGEX . self::ZONE_REGEX . '$/';
38
+            '/^' . self::DATE_REGEX . '([ T]' . self::TIME_REGEX . self::ZONE_REGEX . ')?$/' : '/^' . self::DATE_REGEX . '[ T]' . self::TIME_REGEX . self::ZONE_REGEX . '$/';
40 39
     }
41 40
 
42 41
     public static function factory(Dbal $dbal, array $columnDefinition)
@@ -56,7 +55,7 @@  discard block
 block discarded – undo
56 55
     public function validate($value)
57 56
     {
58 57
         if (!$value instanceof \DateTime && (!is_string($value) || !preg_match($this->regex, $value))) {
59
-            return new NoDateTime([ 'value' => (string) $value ]);
58
+            return new NoDateTime(['value' => (string) $value]);
60 59
         }
61 60
 
62 61
         return true;
Please login to merge, or discard this patch.
src/Dbal/Type/Time.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
                 return new Error([], 'DATETIME', 'DateTime is not allowed for time');
33 33
             }
34 34
 
35
-            return new NoTime([ 'value' => (string) $value ]);
35
+            return new NoTime(['value' => (string) $value]);
36 36
         }
37 37
 
38 38
         return true;
Please login to merge, or discard this patch.
src/Dbal/Column.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     protected static function getRegisteredType(array $columnDefinition)
42 42
     {
43 43
         foreach (self::$registeredTypes as $class) {
44
-            if (call_user_func([ $class, 'fits' ], $columnDefinition)) {
44
+            if (call_user_func([$class, 'fits'], $columnDefinition)) {
45 45
                 return $class;
46 46
             }
47 47
         }
@@ -152,11 +152,11 @@  discard block
 block discarded – undo
152 152
                 $class = $this->columnDefinition['type'];
153 153
             }
154 154
 
155
-            if ($class === null || !is_callable([ $class, 'factory' ])) {
155
+            if ($class === null || !is_callable([$class, 'factory'])) {
156 156
                 $class = Type\Text::class;
157 157
             }
158 158
 
159
-            $this->type = call_user_func([ $class, 'factory' ], $this->dbal, $this->columnDefinition);
159
+            $this->type = call_user_func([$class, 'factory'], $this->dbal, $this->columnDefinition);
160 160
         }
161 161
 
162 162
         return $this->type;
Please login to merge, or discard this patch.
src/Dbal/Sqlite.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     public function describe($schemaTable)
54 54
     {
55 55
         $table = explode($this->identifierDivider, $schemaTable);
56
-        list($schema, $table) = count($table) === 2 ? $table : [ null, $table[ 0 ] ];
56
+        list($schema, $table) = count($table) === 2 ? $table : [null, $table[0]];
57 57
         $schema = $schema !== null ? $this->escapeIdentifier($schema) . '.' : '';
58 58
 
59 59
         $result     = $this->entityManager->getConnection()->query(
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     {
86 86
         return count(array_filter(array_map(
87 87
             function ($rawColumn) {
88
-                return $rawColumn[ 'pk' ];
88
+                return $rawColumn['pk'];
89 89
             },
90 90
             $rawColumns
91 91
         ))) > 1;
Please login to merge, or discard this patch.
src/Relation/OneToMany.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,6 +56,6 @@
 block discarded – undo
56 56
             $expression[] = $alias . '.' . $myVar . ' = ' . $this->name . '.' . $hisVar;
57 57
         }
58 58
 
59
-        call_user_func([ $fetcher, $join ], $this->class, implode(' AND ', $expression), $this->name, [], true);
59
+        call_user_func([$fetcher, $join], $this->class, implode(' AND ', $expression), $this->name, [], true);
60 60
     }
61 61
 }
Please login to merge, or discard this patch.
src/Relation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -147,7 +147,7 @@
 block discarded – undo
147 147
 //            return null;
148 148
 //        }
149 149
 
150
-        return call_user_func([ $this->class, 'getRelation' ], $this->opponent);
150
+        return call_user_func([$this->class, 'getRelation'], $this->opponent);
151 151
     }
152 152
 
153 153
     /**
Please login to merge, or discard this patch.
src/Entity/Relations.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -168,7 +168,6 @@
 block discarded – undo
168 168
 
169 169
         $relation = $this::getRelation($relation);
170 170
 
171
-        return $getAll ? $relation->fetchAll($this, $this->entityManager) :
172
-            $relation->fetch($this, $this->entityManager);
171
+        return $getAll ? $relation->fetchAll($this, $this->entityManager) : $relation->fetch($this, $this->entityManager);
173 172
     }
174 173
 }
Please login to merge, or discard this patch.
src/Dbal/Dbal.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -199,8 +199,8 @@  discard block
 block discarded – undo
199 199
         }
200 200
 
201 201
         $statement = 'UPDATE ' . $this->escapeIdentifier($entity::getTableName()) . ' ' .
202
-                     'SET ' . implode(',', $set) . ' ' .
203
-                     'WHERE ' . implode(' AND ', $where);
202
+                        'SET ' . implode(',', $set) . ' ' .
203
+                        'WHERE ' . implode(' AND ', $where);
204 204
         $this->entityManager->getConnection()->query($statement);
205 205
 
206 206
         return $this->entityManager->sync($entity, true);
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
         }
225 225
 
226 226
         $statement = 'DELETE FROM ' . $this->escapeIdentifier($entity::getTableName()) . ' ' .
227
-                     'WHERE ' . implode(' AND ', $where);
227
+                        'WHERE ' . implode(' AND ', $where);
228 228
         $this->entityManager->getConnection()->query($statement);
229 229
 
230 230
         return true;
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
         $cols = array_combine($cols, array_map([$this, 'escapeIdentifier'], $cols));
252 252
 
253 253
         $statement = 'INSERT INTO ' . $this->escapeIdentifier($entity::getTableName()) . ' ' .
254
-                     '(' . implode(',', $cols) . ') VALUES ';
254
+                        '(' . implode(',', $cols) . ') VALUES ';
255 255
 
256 256
         $statement .= implode(',', array_map(function ($values) use ($cols) {
257 257
             $result = [];
Please login to merge, or discard this patch.
Spacing   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         if ($value instanceof \DateTime) {
97 97
             $type = 'DateTime';
98 98
         }
99
-        $method = [ $this, 'escape' . ucfirst($type) ];
99
+        $method = [$this, 'escape' . ucfirst($type)];
100 100
 
101 101
         if (is_callable($method)) {
102 102
             return call_user_func($method, $value);
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
         $var    = $entity::getPrimaryKeyVars()[0];
302 302
         $column = $entity::getColumnName($var);
303 303
 
304
-        $entity->setOriginalData(array_merge($entity->getData(), [ $column => $value ]));
304
+        $entity->setOriginalData(array_merge($entity->getData(), [$column => $value]));
305 305
         $entity->__set($var, $value);
306 306
     }
307 307
 
@@ -318,8 +318,7 @@  discard block
 block discarded – undo
318 318
         $primary = array_combine($vars, $cols);
319 319
 
320 320
         $query = "SELECT * FROM " . $this->escapeIdentifier($entity::getTableName()) . " WHERE ";
321
-        $query .= count($cols) > 1 ? $this->buildCompositeWhereInStatement($cols, $entities) :
322
-            $this->escapeIdentifier($cols[0]) . ' IN (' . implode(',', array_map(function (Entity $entity) {
321
+        $query .= count($cols) > 1 ? $this->buildCompositeWhereInStatement($cols, $entities) : $this->escapeIdentifier($cols[0]) . ' IN (' . implode(',', array_map(function (Entity $entity) {
323 322
                 return $this->escapeValue(array_values($entity->getPrimaryKey())[0]);
324 323
             }, $entities)) . ')';
325 324
 
Please login to merge, or discard this patch.