Completed
Pull Request — master (#1122)
by Rolands
64:17
created
src/PhpSpreadsheet/Calculation/LookupRef.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -536,33 +536,33 @@
 block discarded – undo
536 536
                         $splitString = $lookupValue;
537 537
                         $chars = array_map(function ($i) use ($splitString) {
538 538
                             return mb_substr($splitString, $i, 1);
539
-                        }, range(0, mb_strlen($splitString) -1));
539
+                        }, range(0, mb_strlen($splitString) - 1));
540 540
 
541 541
                         $length = count($chars);
542 542
                         $pattern = '/^';
543 543
                         for ($j = 0; $j < $length; $j++) {
544 544
                             if ($chars[$j] === '~') {
545
-                                if (isset($chars[$j+1])) {
546
-                                    if ($chars[$j+1] === '*') {
547
-                                        $pattern .= preg_quote($chars[$j+1], '/');
545
+                                if (isset($chars[$j + 1])) {
546
+                                    if ($chars[$j + 1] === '*') {
547
+                                        $pattern .= preg_quote($chars[$j + 1], '/');
548 548
                                         $j++;
549
-                                    } elseif ($chars[$j+1] === '?') {
550
-                                        $pattern .= preg_quote($chars[$j+1], '/');
549
+                                    } elseif ($chars[$j + 1] === '?') {
550
+                                        $pattern .= preg_quote($chars[$j + 1], '/');
551 551
                                         $j++;
552 552
                                     }
553 553
                                 } else {
554 554
                                     $pattern .= preg_quote($chars[$j], '/');
555 555
                                 }
556 556
                             } elseif ($chars[$j] === '*') {
557
-                                $pattern .='.*';
557
+                                $pattern .= '.*';
558 558
                             } elseif ($chars[$j] === '?') {
559
-                                $pattern .='.{1}';
559
+                                $pattern .= '.{1}';
560 560
                             } else {
561 561
                                 $pattern .= preg_quote($chars[$j], '/');
562 562
                             }
563 563
                         }
564 564
 
565
-                        $pattern .='$/';
565
+                        $pattern .= '$/';
566 566
                         if ((bool) preg_match($pattern, $lookupArrayValue)) {
567 567
                             // exact match
568 568
                             return $i + 1;
Please login to merge, or discard this patch.
tests/data/Calculation/LookupRef/MATCH.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     [
108 108
         2,
109 109
         'a',
110
-        [false, 'a',1],
110
+        [false, 'a', 1],
111 111
         -1
112 112
     ],
113 113
     [
@@ -125,37 +125,37 @@  discard block
 block discarded – undo
125 125
     [
126 126
         '#N/A', // Expected
127 127
         true,
128
-        [0,1,2],
128
+        [0, 1, 2],
129 129
         -1
130 130
     ],
131 131
     [
132 132
         '#N/A', // Expected
133 133
         true,
134
-        [0,1,2],
134
+        [0, 1, 2],
135 135
         0
136 136
     ],
137 137
     [
138 138
         '#N/A', // Expected
139 139
         true,
140
-        [0,1,2],
140
+        [0, 1, 2],
141 141
         1
142 142
     ],
143 143
     [
144 144
         1, // Expected
145 145
         true,
146
-        [true,true,true],
146
+        [true, true, true],
147 147
         -1
148 148
     ],
149 149
     [
150 150
         1, // Expected
151 151
         true,
152
-        [true,true,true],
152
+        [true, true, true],
153 153
         0
154 154
     ],
155 155
     [
156 156
         3, // Expected
157 157
         true,
158
-        [true,true,true],
158
+        [true, true, true],
159 159
         1
160 160
     ],
161 161
     // lookup stops when value < searched one
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     [
170 170
         '#N/A', // Expected
171 171
         6,
172
-        [true, false, 'a', 'z', 2, 888 ],
172
+        [true, false, 'a', 'z', 2, 888],
173 173
         -1
174 174
     ],
175 175
     [
@@ -230,19 +230,19 @@  discard block
 block discarded – undo
230 230
     [
231 231
         '#N/A', // Expected
232 232
         '?',
233
-        [1, 22,333],
233
+        [1, 22, 333],
234 234
         0
235 235
     ],
236 236
     [
237 237
         3, // Expected
238 238
         '???',
239
-        [1, 22,'aaa'],
239
+        [1, 22, 'aaa'],
240 240
         0
241 241
     ],
242 242
     [
243 243
         3, // Expected
244 244
         '*',
245
-        [1, 22,'aaa'],
245
+        [1, 22, 'aaa'],
246 246
         0
247 247
     ],
248 248
 ];
Please login to merge, or discard this patch.