Scrutinizer Changes (#3060)
* Scrutinizer Changes Scrutinizer appears to be working again. But the PRs that have used it have neither added new issues nor fixed existing ones. This PR should fix some exisiting; let's see what Scrutinizer does with it. * Address Some False Positives In Reader/Xlsx/Chart.
This commit is contained in:
parent
90422bf1d2
commit
b7fa470138
|
|
@ -14,6 +14,7 @@ use PhpOffice\PhpSpreadsheet\Chart\PlotArea;
|
|||
use PhpOffice\PhpSpreadsheet\Chart\Properties as ChartProperties;
|
||||
use PhpOffice\PhpSpreadsheet\Chart\Title;
|
||||
use PhpOffice\PhpSpreadsheet\Chart\TrendLine;
|
||||
use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
|
||||
use PhpOffice\PhpSpreadsheet\RichText\RichText;
|
||||
use PhpOffice\PhpSpreadsheet\Style\Font;
|
||||
use SimpleXMLElement;
|
||||
|
|
@ -94,7 +95,7 @@ class Chart
|
|||
break;
|
||||
case 'chart':
|
||||
foreach ($chartElement as $chartDetailsKey => $chartDetails) {
|
||||
$chartDetailsC = $chartDetails->children($this->cNamespace);
|
||||
$chartDetails = Xlsx::testSimpleXml($chartDetails);
|
||||
switch ($chartDetailsKey) {
|
||||
case 'autoTitleDeleted':
|
||||
/** @var bool */
|
||||
|
|
@ -113,8 +114,8 @@ class Chart
|
|||
$plotSeries = $plotAttributes = [];
|
||||
$catAxRead = false;
|
||||
$plotNoFill = false;
|
||||
/** @var SimpleXMLElement $chartDetail */
|
||||
foreach ($chartDetails as $chartDetailKey => $chartDetail) {
|
||||
$chartDetail = Xlsx::testSimpleXml($chartDetail);
|
||||
switch ($chartDetailKey) {
|
||||
case 'spPr':
|
||||
$possibleNoFill = $chartDetails->spPr->children($this->aNamespace);
|
||||
|
|
@ -122,8 +123,8 @@ class Chart
|
|||
$plotNoFill = true;
|
||||
}
|
||||
if (isset($possibleNoFill->gradFill->gsLst)) {
|
||||
/** @var SimpleXMLElement $gradient */
|
||||
foreach ($possibleNoFill->gradFill->gsLst->gs as $gradient) {
|
||||
$gradient = Xlsx::testSimpleXml($gradient);
|
||||
/** @var float */
|
||||
$pos = self::getAttribute($gradient, 'pos', 'float');
|
||||
$gradientArray[] = [
|
||||
|
|
@ -348,6 +349,7 @@ class Chart
|
|||
$legendLayout = null;
|
||||
$legendOverlay = false;
|
||||
foreach ($chartDetails as $chartDetailKey => $chartDetail) {
|
||||
$chartDetail = Xlsx::testSimpleXml($chartDetail);
|
||||
switch ($chartDetailKey) {
|
||||
case 'legendPos':
|
||||
$legendPos = self::getAttribute($chartDetail, 'val', 'string');
|
||||
|
|
@ -399,11 +401,13 @@ class Chart
|
|||
$caption = [];
|
||||
$titleLayout = null;
|
||||
foreach ($titleDetails as $titleDetailKey => $chartDetail) {
|
||||
$chartDetail = Xlsx::testSimpleXml($chartDetail);
|
||||
switch ($titleDetailKey) {
|
||||
case 'tx':
|
||||
if (isset($chartDetail->rich)) {
|
||||
$titleDetails = $chartDetail->rich->children($this->aNamespace);
|
||||
foreach ($titleDetails as $titleKey => $titleDetail) {
|
||||
$titleDetail = Xlsx::testSimpleXml($titleDetail);
|
||||
switch ($titleKey) {
|
||||
case 'p':
|
||||
$titleDetailPart = $titleDetail->children($this->aNamespace);
|
||||
|
|
@ -440,6 +444,7 @@ class Chart
|
|||
}
|
||||
$layout = [];
|
||||
foreach ($details as $detailKey => $detail) {
|
||||
$detail = Xlsx::testSimpleXml($detail);
|
||||
$layout[$detailKey] = self::getAttribute($detail, 'val', 'string');
|
||||
}
|
||||
|
||||
|
|
@ -472,8 +477,8 @@ class Chart
|
|||
$lineStyle = null;
|
||||
$labelLayout = null;
|
||||
$trendLines = [];
|
||||
/** @var SimpleXMLElement $seriesDetail */
|
||||
foreach ($seriesDetails as $seriesKey => $seriesDetail) {
|
||||
$seriesDetail = Xlsx::testSimpleXml($seriesDetail);
|
||||
switch ($seriesKey) {
|
||||
case 'idx':
|
||||
$seriesIndex = self::getAttribute($seriesDetail, 'val', 'integer');
|
||||
|
|
@ -786,6 +791,7 @@ class Chart
|
|||
$pointCount = 0;
|
||||
|
||||
foreach ($seriesValueSet as $seriesValueIdx => $seriesValue) {
|
||||
$seriesValue = Xlsx::testSimpleXml($seriesValue);
|
||||
switch ($seriesValueIdx) {
|
||||
case 'ptCount':
|
||||
$pointCount = self::getAttribute($seriesValue, 'val', 'integer');
|
||||
|
|
@ -858,7 +864,6 @@ class Chart
|
|||
private function parseRichText(SimpleXMLElement $titleDetailPart): RichText
|
||||
{
|
||||
$value = new RichText();
|
||||
$objText = null;
|
||||
$defaultFontSize = null;
|
||||
$defaultBold = null;
|
||||
$defaultItalic = null;
|
||||
|
|
|
|||
|
|
@ -1461,9 +1461,6 @@ class Html extends BaseWriter
|
|||
foreach ($values as $cellAddress) {
|
||||
[$cell, $cssClass, $coordinate] = $this->generateRowCellCss($worksheet, $cellAddress, $row, $colNum);
|
||||
|
||||
$colSpan = 1;
|
||||
$rowSpan = 1;
|
||||
|
||||
// Cell Data
|
||||
$cellData = $this->generateRowCellData($worksheet, $cell, $cssClass, $cellType);
|
||||
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ class AutoFilter2Test extends TestCase
|
|||
self::assertCount(1, $columns);
|
||||
$column = $columns['A'] ?? null;
|
||||
self::assertNotNull($column);
|
||||
/** @scrutinizer ignore-call */
|
||||
$ruleset = $column->getRules();
|
||||
self::assertCount(1, $ruleset);
|
||||
$rule = $ruleset[0];
|
||||
|
|
|
|||
Loading…
Reference in New Issue