Skip to content

Commit

Permalink
fix: Handle null value for $plotGroupingType in writePlotGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
homersimpsons committed Apr 6, 2024
1 parent e63e8a9 commit d9e4f00
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/PhpSpreadsheet/Writer/Xlsx/Chart.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ private function writePlotArea(XMLWriter $objWriter, ?PlotArea $plotArea, ?Title

$chartTypes = self::getChartType($plotArea);
$catIsMultiLevelSeries = $valIsMultiLevelSeries = false;
$plotGroupingType = '';
$plotGroupingType = null;
$chartType = null;
foreach ($chartTypes as $chartType) {
$objWriter->startElement('c:' . $chartType);
Expand Down Expand Up @@ -367,7 +367,7 @@ private function writePlotArea(XMLWriter $objWriter, ?PlotArea $plotArea, ?Title
$objWriter->writeAttribute('val', '150');
$objWriter->endElement();

if ($plotGroupingType == 'percentStacked' || $plotGroupingType == 'stacked') {
if ($plotGroupingType === 'percentStacked' || $plotGroupingType === 'stacked') {
$objWriter->startElement('c:overlap');
$objWriter->writeAttribute('val', '100');
$objWriter->endElement();
Expand Down Expand Up @@ -1110,9 +1110,9 @@ private function writePlotSeriesValuesElement(XMLWriter $objWriter, int $val, ?C
* @param string $groupType Type of plot for dataseries
* @param bool $catIsMultiLevelSeries Is category a multi-series category
* @param bool $valIsMultiLevelSeries Is value set a multi-series set
* @param string $plotGroupingType Type of grouping for multi-series values
* @param string|null $plotGroupingType Type of grouping for multi-series values
*/
private function writePlotGroup(?DataSeries $plotGroup, string $groupType, XMLWriter $objWriter, bool &$catIsMultiLevelSeries, bool &$valIsMultiLevelSeries, string &$plotGroupingType): void
private function writePlotGroup(?DataSeries $plotGroup, string $groupType, XMLWriter $objWriter, bool &$catIsMultiLevelSeries, bool &$valIsMultiLevelSeries, ?string &$plotGroupingType): void
{
if ($plotGroup === null) {
return;
Expand Down

0 comments on commit d9e4f00

Please # to comment.