Completed
Pull Request — develop (#257)
by
unknown
23:40
created
src/PhpSpreadsheet/Cell.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -437,7 +437,7 @@
 block discarded – undo
437 437
                     return in_array(strtolower($cellValue), explode(',', strtolower(trim($formula1, '"'))), true);
438 438
 
439 439
                 } else if (strpos($formula1, ':') > 0) {            // values list cells
440
-                    $match_formula = '=MATCH('.$this->getCoordinate().','.$formula1.',0)';
440
+                    $match_formula = '=MATCH(' . $this->getCoordinate() . ',' . $formula1 . ',0)';
441 441
 
442 442
                     try {
443 443
                         $result = Calculation::getInstance(
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -423,15 +423,17 @@
 block discarded – undo
423 423
         $cellValue = $this->getValue();
424 424
         $cellValidation = $this->getDataValidation();
425 425
 
426
-        if (!$cellValidation->getAllowBlank() && (is_null($cellValue) || $cellValue == ""))
427
-            return false;
426
+        if (!$cellValidation->getAllowBlank() && (is_null($cellValue) || $cellValue == "")) {
427
+                    return false;
428
+        }
428 429
 
429 430
         // TODO: write check on all cases
430 431
         switch ($cellValidation->getType()) {
431 432
             case Cell\DataValidation::TYPE_LIST:
432 433
                 $formula1 = $cellValidation->getFormula1();
433
-                if (empty($formula1))
434
-                    break;
434
+                if (empty($formula1)) {
435
+                                    break;
436
+                }
435 437
 
436 438
                 if ($formula1[0] == '"') {                          // inline values list
437 439
                     return in_array(strtolower($cellValue), explode(',', strtolower(trim($formula1, '"'))), true);
Please login to merge, or discard this patch.
tests/PhpSpreadsheetTests/CellTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
         $testCell = $sheet->getCell('A1');
333 333
 
334 334
         $validation = $testCell->getDataValidation();
335
-        $validation->setType( \PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST );
335
+        $validation->setType(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST);
336 336
 
337 337
         // blank value
338 338
         $testCell->setValue("");
@@ -352,11 +352,11 @@  discard block
 block discarded – undo
352 352
         $sheet->getCell('B1')->setValue(5);
353 353
         $sheet->getCell('B2')->setValue(6);
354 354
         $sheet->getCell('B3')->setValue(7);
355
-        $testCell = $sheet->getCell('A1');      // redefine $testCell, because it has broken coordinates after using other cells
355
+        $testCell = $sheet->getCell('A1'); // redefine $testCell, because it has broken coordinates after using other cells
356 356
         $validation->setFormula1('B1:B3');
357 357
         $testCell->setValue("10");
358 358
         self::assertEquals(false, $testCell->hasValidValue(), "cell value ('10') is not allowed");
359
-        $testCell = $sheet->getCell('A1');      // redefine $testCell, because it has broken coordinates after using other cells
359
+        $testCell = $sheet->getCell('A1'); // redefine $testCell, because it has broken coordinates after using other cells
360 360
         $testCell->setValue("5");
361 361
         self::assertEquals(true, $testCell->hasValidValue(), "cell value ('5') has to be allowed");
362 362
     }
Please login to merge, or discard this patch.