From 4635d39b4ab341904562e0079d054e117fc56341 Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Tue, 9 Jan 2018 14:22:03 +0900 Subject: [PATCH] PHP 7.2 compatibility --- samples/Chart/33_Chart_create_composite.php | 4 ++-- src/PhpSpreadsheet/Chart/DataSeries.php | 25 +++++++++++---------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/samples/Chart/33_Chart_create_composite.php b/samples/Chart/33_Chart_create_composite.php index 98631465..272048d2 100644 --- a/samples/Chart/33_Chart_create_composite.php +++ b/samples/Chart/33_Chart_create_composite.php @@ -100,7 +100,7 @@ $series2 = new DataSeries( DataSeries::GROUPING_STANDARD, // plotGrouping range(0, count($dataSeriesValues2) - 1), // plotOrder $dataSeriesLabels2, // plotLabel - null, // plotCategory + [], // plotCategory $dataSeriesValues2 // plotValues ); @@ -121,7 +121,7 @@ $series3 = new DataSeries( DataSeries::GROUPING_STANDARD, // plotGrouping range(0, count($dataSeriesValues2) - 1), // plotOrder $dataSeriesLabels3, // plotLabel - null, // plotCategory + [], // plotCategory $dataSeriesValues3 // plotValues ); diff --git a/src/PhpSpreadsheet/Chart/DataSeries.php b/src/PhpSpreadsheet/Chart/DataSeries.php index 1f434ae2..2bda0c92 100644 --- a/src/PhpSpreadsheet/Chart/DataSeries.php +++ b/src/PhpSpreadsheet/Chart/DataSeries.php @@ -64,7 +64,7 @@ class DataSeries /** * Plot Style. * - * @var string + * @var null|string */ private $plotStyle; @@ -108,15 +108,15 @@ class DataSeries * * @param null|mixed $plotType * @param null|mixed $plotGrouping - * @param mixed $plotOrder - * @param mixed $plotLabel - * @param mixed $plotCategory - * @param mixed $plotValues - * @param null|mixed $plotDirection - * @param null|mixed $smoothLine - * @param null|mixed $plotStyle + * @param int[] $plotOrder + * @param DataSeriesValues[] $plotLabel + * @param DataSeriesValues[] $plotCategory + * @param DataSeriesValues[] $plotValues + * @param null|string $plotDirection + * @param bool $smoothLine + * @param null|string $plotStyle */ - public function __construct($plotType = null, $plotGrouping = null, $plotOrder = [], $plotLabel = [], $plotCategory = [], $plotValues = [], $plotDirection = null, $smoothLine = null, $plotStyle = null) + public function __construct($plotType = null, $plotGrouping = null, array $plotOrder = [], array $plotLabel = [], array $plotCategory = [], array $plotValues = [], $plotDirection = null, $smoothLine = false, $plotStyle = null) { $this->plotType = $plotType; $this->plotGrouping = $plotGrouping; @@ -126,12 +126,13 @@ class DataSeries if ((count($plotLabel) == 0) || ($plotLabel[$keys[0]] === null)) { $plotLabel[$keys[0]] = new DataSeriesValues(); } - $this->plotLabel = $plotLabel; + if ((count($plotCategory) == 0) || ($plotCategory[$keys[0]] === null)) { $plotCategory[$keys[0]] = new DataSeriesValues(); } $this->plotCategory = $plotCategory; + $this->smoothLine = $smoothLine; $this->plotStyle = $plotStyle; @@ -284,7 +285,7 @@ class DataSeries /** * Get Plot Style. * - * @return string + * @return null|string */ public function getPlotStyle() { @@ -294,7 +295,7 @@ class DataSeries /** * Set Plot Style. * - * @param string $plotStyle + * @param null|string $plotStyle * * @return DataSeries */