Fix applyNumberFormat default value for XLSX

When extract style attribute, a missing "applyNumberFormat" attribute would lead to a bool value being filled with `null`. This value would then be used for comparison (`if ($applyNumberFormat === false)`). This does not take into account the nullable aspect of the value.
There is no reason to keep this value as nullable. If the attribute does not exist, then we should default to "false" (as in "Do not try to apply number format here").
This commit is contained in:
Adrien Loison 2021-05-12 22:59:11 +02:00
parent 0837d49c2b
commit 883b9cfd56

View File

@ -175,7 +175,7 @@ class StyleManager
$normalizedNumFmtId = ($numFmtId !== null) ? (int) $numFmtId : null; $normalizedNumFmtId = ($numFmtId !== null) ? (int) $numFmtId : null;
$applyNumberFormat = $xmlReader->getAttribute(self::XML_ATTRIBUTE_APPLY_NUMBER_FORMAT); $applyNumberFormat = $xmlReader->getAttribute(self::XML_ATTRIBUTE_APPLY_NUMBER_FORMAT);
$normalizedApplyNumberFormat = ($applyNumberFormat !== null) ? (bool) $applyNumberFormat : null; $normalizedApplyNumberFormat = ($applyNumberFormat !== null) ? (bool) $applyNumberFormat : false;
$this->stylesAttributes[] = [ $this->stylesAttributes[] = [
self::XML_ATTRIBUTE_NUM_FMT_ID => $normalizedNumFmtId, self::XML_ATTRIBUTE_NUM_FMT_ID => $normalizedNumFmtId,