Passed
Push — master ( 5e566a...b3ece8 )
by y
01:34
created
src/DB/Migrator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public function down(string $to = null): ?string
51 51
     {
52
-        return $this->db->transact(function () use ($to) {
52
+        return $this->db->transact(function() use ($to) {
53 53
             $current = $this->getCurrent();
54 54
             // walk newest to oldest
55 55
             foreach (array_reverse($this->glob(), true) as $sequence => $file) {
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
      */
136 136
     public function up(string $to = null): ?string
137 137
     {
138
-        return $this->db->transact(function () use ($to) {
138
+        return $this->db->transact(function() use ($to) {
139 139
             $current = $this->getCurrent();
140 140
             // walk oldest to newest
141 141
             foreach ($this->glob() as $sequence => $file) {
Please login to merge, or discard this patch.
src/DB/EAV.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public function exists(int $id, string $attribute): bool
41 41
     {
42
-        $statement = $this->cache(__FUNCTION__, function () {
42
+        $statement = $this->cache(__FUNCTION__, function() {
43 43
             return $this->select(['COUNT(*) > 0'])->where('entity = ? AND attribute = ?')->prepare();
44 44
         });
45 45
         $exists = (bool)$statement([$id, $attribute])->fetchColumn();
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function load(int $id): array
91 91
     {
92
-        $statement = $this->cache(__FUNCTION__, function () {
92
+        $statement = $this->cache(__FUNCTION__, function() {
93 93
             $select = $this->select(['attribute', 'value']);
94 94
             $select->where('entity = ?');
95 95
             $select->order('attribute');
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
         }
152 152
 
153 153
         // upsert each
154
-        $statement = $this->cache(__FUNCTION__, function () {
154
+        $statement = $this->cache(__FUNCTION__, function() {
155 155
             if ($this->db->isSQLite()) {
156 156
                 return $this->db->prepare(
157 157
                     "INSERT INTO {$this} (entity,attribute,value) VALUES (?,?,?)"
Please login to merge, or discard this patch.
src/DB/Column.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@
 block discarded – undo
136 136
     public function select()
137 137
     {
138 138
         return Select::factory($this->db, $this->qualifier, [$this->name])
139
-            ->setFetcher(function (Statement $statement) {
139
+            ->setFetcher(function(Statement $statement) {
140 140
                 while (false !== $value = $statement->fetchColumn()) {
141 141
                     yield $value;
142 142
                 }
Please login to merge, or discard this patch.
src/DB/Schema.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -144,16 +144,16 @@  discard block
 block discarded – undo
144 144
         // bool
145 145
         'BOOLEAN' => 'bool',
146 146
         // int
147
-        'BIGINT' => 'int',  // mysql
147
+        'BIGINT' => 'int', // mysql
148 148
         'INTEGER' => 'int', // sqlite (must be this type to allow AUTOINCREMENT)
149 149
         // float
150 150
         'DOUBLE PRECISION' => 'float',
151 151
         // string <= 255
152 152
         'VARCHAR(255)' => 'string',
153 153
         // string <= 64k
154
-        'TEXT' => 'String',     // @var String
154
+        'TEXT' => 'String', // @var String
155 155
         // string > 64k
156
-        'BLOB' => 'STRING',     // @var STRING (sqlite)
156
+        'BLOB' => 'STRING', // @var STRING (sqlite)
157 157
         'LONGBLOB' => 'STRING', // @var STRING (mysql)
158 158
         // DateTime
159 159
         'DATETIME' => 'DateTime',
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
      */
457 457
     protected function sortColumns(array $types): array
458 458
     {
459
-        uksort($types, function (string $a, string $b) use ($types) {
459
+        uksort($types, function(string $a, string $b) use ($types) {
460 460
             // descending type constant, ascending name
461 461
             return $types[$b] <=> $types[$a] ?: $a <=> $b;
462 462
         });
Please login to merge, or discard this patch.
src/DB/Fluent/Choice.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,9 +90,11 @@
 block discarded – undo
90 90
      * @param string|ValueInterface $else
91 91
      * @return $this
92 92
      */
93
-    public function else($else)
93
+    public function else {
94
+        ($else)
94 95
     {
95 96
         $this->else = isset($else) ? $this->db->quote($else) : null;
97
+    }
96 98
         return $this;
97 99
     }
98 100
 
Please login to merge, or discard this patch.
src/DB/Fluent/Value/ComparisonTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -322,7 +322,7 @@
 block discarded – undo
322 322
      * @param array $values `[when => then]`
323 323
      * @return Choice
324 324
      */
325
-    public function switch(array $values = [])
325
+    public function switch (array $values = [])
326 326
     {
327 327
         return Choice::factory($this->db, "{$this}", $values);
328 328
     }
Please login to merge, or discard this patch.
src/DB/Junction.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@
 block discarded – undo
119 119
      */
120 120
     public function link(array $ids): int
121 121
     {
122
-        $statement = $this->cache(__FUNCTION__, function () {
122
+        $statement = $this->cache(__FUNCTION__, function() {
123 123
             $columns = implode(',', array_keys($this->columns));
124 124
             $slots = implode(',', $this->db->slots(array_keys($this->columns)));
125 125
             if ($this->db->isSQLite()) {
Please login to merge, or discard this patch.
src/DB.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
      */
136 136
     public static function slots(array $columns)
137 137
     {
138
-        return array_combine($columns, array_map(function (string $column) {
138
+        return array_combine($columns, array_map(function(string $column) {
139 139
             return ':' . str_replace('.', '__', $column);
140 140
         }, $columns));
141 141
     }
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
             $this->exec("SET time_zone = 'UTC'");
180 180
         } elseif ($this->isSQLite()) {
181 181
             // polyfill sqlite functions
182
-            $this->sqliteCreateFunctions([ // deterministic functions
182
+            $this->sqliteCreateFunctions([// deterministic functions
183 183
                 // https://www.sqlite.org/lang_mathfunc.html
184 184
                 'ACOS' => 'acos',
185 185
                 'ASIN' => 'asin',
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
                 'SIGN' => fn($x) => $x <=> 0
206 206
             ]);
207 207
 
208
-            $this->sqliteCreateFunctions([ // non-deterministic
208
+            $this->sqliteCreateFunctions([// non-deterministic
209 209
                 'RAND' => fn() => mt_rand() / mt_getrandmax(),
210 210
             ], false);
211 211
         }
Please login to merge, or discard this patch.
src/DB/Record.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -75,19 +75,19 @@  discard block
 block discarded – undo
75 75
      */
76 76
     protected const SCALARS = [
77 77
         'bool' => 'bool',
78
-        'boolean' => 'bool',    // gettype()
79
-        'double' => 'float',    // gettype()
80
-        'false' => 'bool',      // @var
78
+        'boolean' => 'bool', // gettype()
79
+        'double' => 'float', // gettype()
80
+        'false' => 'bool', // @var
81 81
         'float' => 'float',
82 82
         'int' => 'int',
83
-        'integer' => 'int',     // gettype()
84
-        'NULL' => 'string',     // gettype()
85
-        'number' => 'string',   // @var
86
-        'scalar' => 'string',   // @var
83
+        'integer' => 'int', // gettype()
84
+        'NULL' => 'string', // gettype()
85
+        'number' => 'string', // @var
86
+        'scalar' => 'string', // @var
87 87
         'string' => 'string',
88
-        'String' => 'String',   // @var
89
-        'STRING' => 'STRING',   // @var
90
-        'true' => 'bool',       // @var
88
+        'String' => 'String', // @var
89
+        'STRING' => 'STRING', // @var
90
+        'true' => 'bool', // @var
91 91
     ];
92 92
 
93 93
     /**
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
      */
563 563
     public function load($id)
564 564
     {
565
-        $statement = $this->cache(__FUNCTION__, function () {
565
+        $statement = $this->cache(__FUNCTION__, function() {
566 566
             return $this->select()->where('id = ?')->prepare();
567 567
         });
568 568
         if ($id instanceof EntityInterface) {
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
      */
590 590
     public function loadAll()
591 591
     {
592
-        return $this->select()->setFetcher(function (Statement $statement) {
592
+        return $this->select()->setFetcher(function(Statement $statement) {
593 593
             yield from $this->fetchEach($statement);
594 594
         });
595 595
     }
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
      */
649 649
     protected function saveInsert(EntityInterface $entity): void
650 650
     {
651
-        $statement = $this->cache(__FUNCTION__, function () {
651
+        $statement = $this->cache(__FUNCTION__, function() {
652 652
             $slots = $this->db->slots(array_keys($this->columns));
653 653
             unset($slots['id']);
654 654
             $columns = implode(',', array_keys($slots));
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
      */
669 669
     protected function saveUpdate(EntityInterface $entity): void
670 670
     {
671
-        $statement = $this->cache(__FUNCTION__, function () {
671
+        $statement = $this->cache(__FUNCTION__, function() {
672 672
             $slots = $this->db->slotsEqual(array_keys($this->columns));
673 673
             unset($slots['id']);
674 674
             $slots = implode(', ', $slots);
Please login to merge, or discard this patch.