Use default values when writing validation in Xls

Fixes the PHP 7.1 bug reported over at PHPOffice/PHPExcel#1110
The behavior should not change since the default value used should behave the same way as the string value in earlier PHP versions.

Fixes a return type in the doc block of IReader.

Closes #165
This commit is contained in:
Mewes Kochheim 2017-05-28 22:20:14 +02:00 committed by Adrien Crivelli
parent 6e4e0a65f5
commit 6aae764920
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
2 changed files with 9 additions and 7 deletions

View File

@ -42,7 +42,7 @@ interface IReader
* *
* @throws Exception * @throws Exception
* *
* @return Spreadsheet * @return \PhpOffice\PhpSpreadsheet\Spreadsheet
*/ */
public function load($pFilename); public function load($pFilename);
} }

View File

@ -2791,6 +2791,8 @@ class Worksheet extends BIFFwriter
/** /**
* Store the DATAVALIDATIONS and DATAVALIDATION records. * Store the DATAVALIDATIONS and DATAVALIDATION records.
*
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/ */
private function writeDataValidity() private function writeDataValidity()
{ {
@ -2823,8 +2825,8 @@ class Worksheet extends BIFFwriter
$options = 0x00000000; $options = 0x00000000;
// data type // data type
$type = $dataValidation->getType(); $type = 0x00;
switch ($type) { switch ($dataValidation->getType()) {
case DataValidation::TYPE_NONE: case DataValidation::TYPE_NONE:
$type = 0x00; $type = 0x00;
break; break;
@ -2854,8 +2856,8 @@ class Worksheet extends BIFFwriter
$options |= $type << 0; $options |= $type << 0;
// error style // error style
$errorStyle = $dataValidation->getErrorStyle(); $errorStyle = 0x00;
switch ($errorStyle) { switch ($dataValidation->getErrorStyle()) {
case DataValidation::STYLE_STOP: case DataValidation::STYLE_STOP:
$errorStyle = 0x00; $errorStyle = 0x00;
break; break;
@ -2887,8 +2889,8 @@ class Worksheet extends BIFFwriter
$options |= $dataValidation->getShowErrorMessage() << 19; $options |= $dataValidation->getShowErrorMessage() << 19;
// condition operator // condition operator
$operator = $dataValidation->getOperator(); $operator = 0x00;
switch ($operator) { switch ($dataValidation->getOperator()) {
case DataValidation::OPERATOR_BETWEEN: case DataValidation::OPERATOR_BETWEEN:
$operator = 0x00; $operator = 0x00;
break; break;