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
*
* @return Spreadsheet
* @return \PhpOffice\PhpSpreadsheet\Spreadsheet
*/
public function load($pFilename);
}

View File

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