Skip to content

Commit a8e179d

Browse files
authored
Scrutinizer Complains Some Samples Class Name Conflict with Jpgraph (#2684)
Jpgraph does not use namespaces. Neither do the Samples members of this project. As a result, Scrutinizer complains about 13 cases of `use PhpOffice\PhpSpreadsheet\Chart\Legend;`, since this theoretically could cause the use of two different Legend classes in the empty namespace. It suggests using a class alias for Legend, which this PR does in every applicable case. It is a regrettable problem, but it is easy to fix.
1 parent f2f626e commit a8e179d

13 files changed

+27
-27
lines changed

samples/Chart/33_Chart_create_area.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use PhpOffice\PhpSpreadsheet\Chart\Chart;
44
use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
55
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
6-
use PhpOffice\PhpSpreadsheet\Chart\Legend;
6+
use PhpOffice\PhpSpreadsheet\Chart\Legend as ChartLegend;
77
use PhpOffice\PhpSpreadsheet\Chart\PlotArea;
88
use PhpOffice\PhpSpreadsheet\Chart\Title;
99
use PhpOffice\PhpSpreadsheet\IOFactory;
@@ -71,7 +71,7 @@
7171
// Set the series in the plot area
7272
$plotArea = new PlotArea(null, [$series]);
7373
// Set the chart legend
74-
$legend = new Legend(Legend::POSITION_TOPRIGHT, null, false);
74+
$legend = new ChartLegend(ChartLegend::POSITION_TOPRIGHT, null, false);
7575

7676
$title = new Title('Test %age-Stacked Area Chart');
7777
$yAxisLabel = new Title('Value ($k)');

samples/Chart/33_Chart_create_bar_stacked.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use PhpOffice\PhpSpreadsheet\Chart\Chart;
44
use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
55
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
6-
use PhpOffice\PhpSpreadsheet\Chart\Legend;
6+
use PhpOffice\PhpSpreadsheet\Chart\Legend as ChartLegend;
77
use PhpOffice\PhpSpreadsheet\Chart\PlotArea;
88
use PhpOffice\PhpSpreadsheet\Chart\Title;
99
use PhpOffice\PhpSpreadsheet\IOFactory;
@@ -74,7 +74,7 @@
7474
// Set the series in the plot area
7575
$plotArea = new PlotArea(null, [$series]);
7676
// Set the chart legend
77-
$legend = new Legend(Legend::POSITION_RIGHT, null, false);
77+
$legend = new ChartLegend(ChartLegend::POSITION_RIGHT, null, false);
7878

7979
$title = new Title('Test Chart');
8080
$yAxisLabel = new Title('Value ($k)');

samples/Chart/33_Chart_create_column.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use PhpOffice\PhpSpreadsheet\Chart\Chart;
44
use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
55
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
6-
use PhpOffice\PhpSpreadsheet\Chart\Legend;
6+
use PhpOffice\PhpSpreadsheet\Chart\Legend as ChartLegend;
77
use PhpOffice\PhpSpreadsheet\Chart\PlotArea;
88
use PhpOffice\PhpSpreadsheet\Chart\Title;
99
use PhpOffice\PhpSpreadsheet\IOFactory;
@@ -74,7 +74,7 @@
7474
// Set the series in the plot area
7575
$plotArea = new PlotArea(null, [$series]);
7676
// Set the chart legend
77-
$legend = new Legend(Legend::POSITION_RIGHT, null, false);
77+
$legend = new ChartLegend(ChartLegend::POSITION_RIGHT, null, false);
7878

7979
$title = new Title('Test Column Chart');
8080
$yAxisLabel = new Title('Value ($k)');

samples/Chart/33_Chart_create_column_2.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use PhpOffice\PhpSpreadsheet\Chart\Chart;
44
use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
55
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
6-
use PhpOffice\PhpSpreadsheet\Chart\Legend;
6+
use PhpOffice\PhpSpreadsheet\Chart\Legend as ChartLegend;
77
use PhpOffice\PhpSpreadsheet\Chart\PlotArea;
88
use PhpOffice\PhpSpreadsheet\Chart\Title;
99
use PhpOffice\PhpSpreadsheet\IOFactory;
@@ -82,7 +82,7 @@
8282
// Set the series in the plot area
8383
$plotArea = new PlotArea(null, [$series]);
8484
// Set the chart legend
85-
$legend = new Legend(Legend::POSITION_BOTTOM, null, false);
85+
$legend = new ChartLegend(ChartLegend::POSITION_BOTTOM, null, false);
8686

8787
$title = new Title('Test Grouped Column Chart');
8888
$xAxisLabel = new Title('Financial Period');

samples/Chart/33_Chart_create_composite.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use PhpOffice\PhpSpreadsheet\Chart\Chart;
44
use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
55
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
6-
use PhpOffice\PhpSpreadsheet\Chart\Legend;
6+
use PhpOffice\PhpSpreadsheet\Chart\Legend as ChartLegend;
77
use PhpOffice\PhpSpreadsheet\Chart\PlotArea;
88
use PhpOffice\PhpSpreadsheet\Chart\Title;
99
use PhpOffice\PhpSpreadsheet\IOFactory;
@@ -128,7 +128,7 @@
128128
// Set the series in the plot area
129129
$plotArea = new PlotArea(null, [$series1, $series2, $series3]);
130130
// Set the chart legend
131-
$legend = new Legend(Legend::POSITION_RIGHT, null, false);
131+
$legend = new ChartLegend(ChartLegend::POSITION_RIGHT, null, false);
132132

133133
$title = new Title('Average Weather Chart for Crete');
134134

samples/Chart/33_Chart_create_line.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use PhpOffice\PhpSpreadsheet\Chart\Chart;
44
use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
55
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
6-
use PhpOffice\PhpSpreadsheet\Chart\Legend;
6+
use PhpOffice\PhpSpreadsheet\Chart\Legend as ChartLegend;
77
use PhpOffice\PhpSpreadsheet\Chart\PlotArea;
88
use PhpOffice\PhpSpreadsheet\Chart\Title;
99
use PhpOffice\PhpSpreadsheet\IOFactory;
@@ -72,7 +72,7 @@
7272
// Set the series in the plot area
7373
$plotArea = new PlotArea(null, [$series]);
7474
// Set the chart legend
75-
$legend = new Legend(Legend::POSITION_TOPRIGHT, null, false);
75+
$legend = new ChartLegend(ChartLegend::POSITION_TOPRIGHT, null, false);
7676

7777
$title = new Title('Test Stacked Line Chart');
7878
$yAxisLabel = new Title('Value ($k)');

samples/Chart/33_Chart_create_multiple_charts.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use PhpOffice\PhpSpreadsheet\Chart\Chart;
44
use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
55
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
6-
use PhpOffice\PhpSpreadsheet\Chart\Legend;
6+
use PhpOffice\PhpSpreadsheet\Chart\Legend as ChartLegend;
77
use PhpOffice\PhpSpreadsheet\Chart\PlotArea;
88
use PhpOffice\PhpSpreadsheet\Chart\Title;
99
use PhpOffice\PhpSpreadsheet\IOFactory;
@@ -71,7 +71,7 @@
7171
// Set the series in the plot area
7272
$plotArea1 = new PlotArea(null, [$series1]);
7373
// Set the chart legend
74-
$legend1 = new Legend(Legend::POSITION_TOPRIGHT, null, false);
74+
$legend1 = new ChartLegend(ChartLegend::POSITION_TOPRIGHT, null, false);
7575

7676
$title1 = new Title('Test %age-Stacked Area Chart');
7777
$yAxisLabel1 = new Title('Value ($k)');
@@ -146,7 +146,7 @@
146146
// Set the series in the plot area
147147
$plotArea2 = new PlotArea(null, [$series2]);
148148
// Set the chart legend
149-
$legend2 = new Legend(Legend::POSITION_RIGHT, null, false);
149+
$legend2 = new ChartLegend(ChartLegend::POSITION_RIGHT, null, false);
150150

151151
$title2 = new Title('Test Column Chart');
152152
$yAxisLabel2 = new Title('Value ($k)');

samples/Chart/33_Chart_create_pie.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
55
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
66
use PhpOffice\PhpSpreadsheet\Chart\Layout;
7-
use PhpOffice\PhpSpreadsheet\Chart\Legend;
7+
use PhpOffice\PhpSpreadsheet\Chart\Legend as ChartLegend;
88
use PhpOffice\PhpSpreadsheet\Chart\PlotArea;
99
use PhpOffice\PhpSpreadsheet\Chart\Title;
1010
use PhpOffice\PhpSpreadsheet\IOFactory;
@@ -73,7 +73,7 @@
7373
// Set the series in the plot area
7474
$plotArea1 = new PlotArea($layout1, [$series1]);
7575
// Set the chart legend
76-
$legend1 = new Legend(Legend::POSITION_RIGHT, null, false);
76+
$legend1 = new ChartLegend(ChartLegend::POSITION_RIGHT, null, false);
7777

7878
$title1 = new Title('Test Pie Chart');
7979

samples/Chart/33_Chart_create_pie_custom_colors.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
55
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
66
use PhpOffice\PhpSpreadsheet\Chart\Layout;
7-
use PhpOffice\PhpSpreadsheet\Chart\Legend;
7+
use PhpOffice\PhpSpreadsheet\Chart\Legend as ChartLegend;
88
use PhpOffice\PhpSpreadsheet\Chart\PlotArea;
99
use PhpOffice\PhpSpreadsheet\Chart\Title;
1010
use PhpOffice\PhpSpreadsheet\IOFactory;
@@ -79,7 +79,7 @@
7979
// Set the series in the plot area
8080
$plotArea1 = new PlotArea($layout1, [$series1]);
8181
// Set the chart legend
82-
$legend1 = new Legend(Legend::POSITION_RIGHT, null, false);
82+
$legend1 = new ChartLegend(ChartLegend::POSITION_RIGHT, null, false);
8383

8484
$title1 = new Title('Test Pie Chart');
8585

samples/Chart/33_Chart_create_radar.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
55
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
66
use PhpOffice\PhpSpreadsheet\Chart\Layout;
7-
use PhpOffice\PhpSpreadsheet\Chart\Legend;
7+
use PhpOffice\PhpSpreadsheet\Chart\Legend as ChartLegend;
88
use PhpOffice\PhpSpreadsheet\Chart\PlotArea;
99
use PhpOffice\PhpSpreadsheet\Chart\Title;
1010
use PhpOffice\PhpSpreadsheet\IOFactory;
@@ -85,7 +85,7 @@
8585
// Set the series in the plot area
8686
$plotArea = new PlotArea($layout, [$series]);
8787
// Set the chart legend
88-
$legend = new Legend(Legend::POSITION_RIGHT, null, false);
88+
$legend = new ChartLegend(ChartLegend::POSITION_RIGHT, null, false);
8989

9090
$title = new Title('Test Radar Chart');
9191

0 commit comments

Comments
 (0)