From 06a451410b2598b79a7f2e3dcbe8e70a1e21a77e Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 1 Dec 2023 15:14:09 +0100 Subject: [PATCH] Fixed CI --- docs/changes/1.1.0.md | 10 +++++++--- src/PhpPresentation/Reader/PowerPoint2007.php | 18 +++++++++--------- src/PhpPresentation/Reader/PowerPoint97.php | 13 ++++++------- src/PhpPresentation/Shape/Chart/Series.php | 8 ++++---- src/PhpPresentation/Slide/Iterator.php | 2 ++ .../Writer/ODPresentation/Content.php | 2 +- .../Writer/ODPresentation/ContentTest.php | 2 +- 7 files changed, 30 insertions(+), 25 deletions(-) diff --git a/docs/changes/1.1.0.md b/docs/changes/1.1.0.md index 47613d194..f92efb567 100644 --- a/docs/changes/1.1.0.md +++ b/docs/changes/1.1.0.md @@ -1,11 +1,15 @@ -# 1.0.0 - WIP +# 1.1.0 - WIP ## Features -- Support for axis options - [@mindline](https://github.com/mindline-analytics) GH-676 +- Support for axis options - [@mindline](https://github.com/mindline-analytics) in [#676](https://github.com/PHPOffice/PHPPresentatio /pull/676) - Axis intersection point (axis crossing) through `setCrossesAt`/ `getCrossesAt` - Reverse axis order through `setIsReversedOrder`/ `isReversedOrder` - PowerPoint2007 Writer -- Support for Hyperlink Text Color - [@MartynasJanu](https://github.com/MartynasJanu) & [@Progi1984](https://github.com/Progi1984) GH-682 +- Support for Hyperlink Text Color - [@MartynasJanu](https://github.com/MartynasJanu) & [@Progi1984](https://github.com/Progi1984) in [#682](https://github.com/PHPOffice/PHPPresentatio /pull/682) - PowerPoint2007 Reader - PowerPoint2007 Writer + +## Bugfixes + +- Fixed CI - [@Progi1984](https://github.com/Progi1984) in [#766](https://github.com/PHPOffice/PHPPresentatio /pull/766) \ No newline at end of file diff --git a/src/PhpPresentation/Reader/PowerPoint2007.php b/src/PhpPresentation/Reader/PowerPoint2007.php index ef065587c..b693efee0 100644 --- a/src/PhpPresentation/Reader/PowerPoint2007.php +++ b/src/PhpPresentation/Reader/PowerPoint2007.php @@ -334,7 +334,7 @@ protected function loadViewProperties(string $sPart): void $oElement = $xmlReader->getElement($pathZoom); if ($oElement instanceof DOMElement) { if ($oElement->hasAttribute('d') && $oElement->hasAttribute('n')) { - $this->oPhpPresentation->getPresentationProperties()->setZoom($oElement->getAttribute('n') / $oElement->getAttribute('d')); + $this->oPhpPresentation->getPresentationProperties()->setZoom((int) $oElement->getAttribute('n') / (int) $oElement->getAttribute('d')); } } } @@ -557,7 +557,7 @@ protected function loadMasterSlide(string $sPart, string $baseFile): void $oElementLvlDefRPR = $xmlReader->getElement('a:defRPr', $oElementLvl); if ($oElementLvlDefRPR instanceof DOMElement) { if ($oElementLvlDefRPR->hasAttribute('sz')) { - $oRTParagraph->getFont()->setSize((int) ($oElementLvlDefRPR->getAttribute('sz') / 100)); + $oRTParagraph->getFont()->setSize(intval((int) $oElementLvlDefRPR->getAttribute('sz') / 100)); } if ($oElementLvlDefRPR->hasAttribute('b') && 1 == $oElementLvlDefRPR->getAttribute('b')) { $oRTParagraph->getFont()->setBold(true); @@ -1115,20 +1115,20 @@ protected function loadParagraph(XMLReader $document, DOMElement $oElement, $oSh $oElementLineSpacingPoints = $document->getElement('a:lnSpc/a:spcPts', $oSubElement); if ($oElementLineSpacingPoints instanceof DOMElement) { $oParagraph->setLineSpacingMode(Paragraph::LINE_SPACING_MODE_POINT); - $oParagraph->setLineSpacing($oElementLineSpacingPoints->getAttribute('val') / 100); + $oParagraph->setLineSpacing((int) $oElementLineSpacingPoints->getAttribute('val') / 100); } $oElementLineSpacingPercent = $document->getElement('a:lnSpc/a:spcPct', $oSubElement); if ($oElementLineSpacingPercent instanceof DOMElement) { $oParagraph->setLineSpacingMode(Paragraph::LINE_SPACING_MODE_PERCENT); - $oParagraph->setLineSpacing($oElementLineSpacingPercent->getAttribute('val') / 1000); + $oParagraph->setLineSpacing((int) $oElementLineSpacingPercent->getAttribute('val') / 1000); } $oElementSpacingBefore = $document->getElement('a:spcBef/a:spcPts', $oSubElement); if ($oElementSpacingBefore instanceof DOMElement) { - $oParagraph->setSpacingBefore($oElementSpacingBefore->getAttribute('val') / 100); + $oParagraph->setSpacingBefore((int) $oElementSpacingBefore->getAttribute('val') / 100); } $oElementSpacingAfter = $document->getElement('a:spcAft/a:spcPts', $oSubElement); if ($oElementSpacingAfter instanceof DOMElement) { - $oParagraph->setSpacingAfter($oElementSpacingAfter->getAttribute('val') / 100); + $oParagraph->setSpacingAfter((int) $oElementSpacingAfter->getAttribute('val') / 100); } $oParagraph->getBulletStyle()->setBulletType(Bullet::TYPE_NONE); @@ -1194,7 +1194,7 @@ protected function loadParagraph(XMLReader $document, DOMElement $oElement, $oSh $oText->getFont()->setStrikethrough('noStrike' == $oElementrPr->getAttribute('strike') ? false : true); } if ($oElementrPr->hasAttribute('sz')) { - $oText->getFont()->setSize((int) ($oElementrPr->getAttribute('sz') / 100)); + $oText->getFont()->setSize(intval((int) $oElementrPr->getAttribute('sz') / 100)); } if ($oElementrPr->hasAttribute('u')) { $oText->getFont()->setUnderline($oElementrPr->getAttribute('u')); @@ -1264,7 +1264,7 @@ protected function loadHyperlink(XMLReader $xmlReader, DOMElement $element, Hype protected function loadStyleBorder(XMLReader $xmlReader, DOMElement $oElement, Border $oBorder): void { if ($oElement->hasAttribute('w')) { - $oBorder->setLineWidth((int) ($oElement->getAttribute('w') / 12700)); + $oBorder->setLineWidth(intval((int) $oElement->getAttribute('w') / 12700)); } if ($oElement->hasAttribute('cmpd')) { $oBorder->setLineStyle($oElement->getAttribute('cmpd')); @@ -1292,7 +1292,7 @@ protected function loadStyleColor(XMLReader $xmlReader, DOMElement $oElement): C $oColor->setRGB($oElement->getAttribute('val')); $oElementAlpha = $xmlReader->getElement('a:alpha', $oElement); if ($oElementAlpha instanceof DOMElement && $oElementAlpha->hasAttribute('val')) { - $alpha = strtoupper(dechex((($oElementAlpha->getAttribute('val') / 1000) / 100) * 255)); + $alpha = strtoupper(dechex((((int) $oElementAlpha->getAttribute('val') / 1000) / 100) * 255)); $oColor->setRGB($oElement->getAttribute('val'), $alpha); } diff --git a/src/PhpPresentation/Reader/PowerPoint97.php b/src/PhpPresentation/Reader/PowerPoint97.php index b28b9fa4f..702946674 100644 --- a/src/PhpPresentation/Reader/PowerPoint97.php +++ b/src/PhpPresentation/Reader/PowerPoint97.php @@ -491,12 +491,11 @@ private function loadPicturesStream(): void // OfficeArtFBSE throw new FeatureNotImplementedException(); } - if ($arrayRH['recType'] >= 0xF018 && $arrayRH['recType'] <= 0xF117) { - $arrayRecord = $this->readRecordOfficeArtBlip($stream, $pos - 8); - if ($arrayRecord['length'] > 0) { - $pos += $arrayRecord['length']; - $this->arrayPictures[] = $arrayRecord['picture']; - } + // $arrayRH['recType'] >= 0xF018 && $arrayRH['recType'] <= 0xF117 + $arrayRecord = $this->readRecordOfficeArtBlip($stream, $pos - 8); + if ($arrayRecord['length'] > 0) { + $pos += $arrayRecord['length']; + $this->arrayPictures[] = $arrayRecord['picture']; } $readSuccess = true; } @@ -535,7 +534,7 @@ private function loadCurrentUserStream(): void // headerToken $headerToken = self::getInt4d($this->streamCurrentUser, $pos); $pos += 4; - if (0xF3D1C4DF == $headerToken && 0xE391C05F != $headerToken) { + if (0xF3D1C4DF == $headerToken) { // Encrypted file throw new FeatureNotImplementedException(); } diff --git a/src/PhpPresentation/Shape/Chart/Series.php b/src/PhpPresentation/Shape/Chart/Series.php index ea1bf4996..ede269d5a 100644 --- a/src/PhpPresentation/Shape/Chart/Series.php +++ b/src/PhpPresentation/Shape/Chart/Series.php @@ -50,7 +50,7 @@ class Series implements ComparableInterface * * @var string */ - protected $DlblNumFormat = ''; + protected $dlblNumFormat = ''; /** * @var string|null @@ -184,7 +184,7 @@ public function setTitle(string $value = 'Series Title'): self */ public function getDlblNumFormat(): string { - return $this->DlblNumFormat; + return $this->dlblNumFormat; } /** @@ -192,7 +192,7 @@ public function getDlblNumFormat(): string */ public function hasDlblNumFormat(): bool { - return !empty($this->DlblNumFormat); + return !empty($this->dlblNumFormat); } /** @@ -200,7 +200,7 @@ public function hasDlblNumFormat(): bool */ public function setDlblNumFormat(string $value = ''): self { - $this->DlblNumFormat = $value; + $this->dlblNumFormat = $value; return $this; } diff --git a/src/PhpPresentation/Slide/Iterator.php b/src/PhpPresentation/Slide/Iterator.php index d761be9a7..6fed10ec1 100644 --- a/src/PhpPresentation/Slide/Iterator.php +++ b/src/PhpPresentation/Slide/Iterator.php @@ -70,6 +70,7 @@ public function rewind() * * @return \PhpOffice\PhpPresentation\Slide */ + #[\ReturnTypeWillChange] public function current() { return $this->subject->getSlide($this->position); @@ -80,6 +81,7 @@ public function current() * * @return int */ + #[\ReturnTypeWillChange] public function key() { return $this->position; diff --git a/src/PhpPresentation/Writer/ODPresentation/Content.php b/src/PhpPresentation/Writer/ODPresentation/Content.php index bf9fc5b65..ff3ff395f 100644 --- a/src/PhpPresentation/Writer/ODPresentation/Content.php +++ b/src/PhpPresentation/Writer/ODPresentation/Content.php @@ -549,7 +549,7 @@ protected function writeShapeTxt(XMLWriter $objWriter, RichText $shape): void } elseif ('bullet' == $paragraph->getBulletStyle()->getBulletType()) { $bCstShpHasBullet = true; // Open the bullet list - if ('bullet' != $sCstShpLastBullet || ($sCstShpLastBullet == $paragraph->getBulletStyle()->getBulletType() && $iCstShpLastBulletLvl < $paragraph->getAlignment()->getLevel())) { + if ('bullet' != $sCstShpLastBullet || $iCstShpLastBulletLvl < $paragraph->getAlignment()->getLevel()) { // text:list $objWriter->startElement('text:list'); $objWriter->writeAttribute('text:style-name', 'L_' . $paragraph->getBulletStyle()->getHashCode()); diff --git a/tests/PhpPresentation/Tests/Writer/ODPresentation/ContentTest.php b/tests/PhpPresentation/Tests/Writer/ODPresentation/ContentTest.php index c67a78bc9..40269c155 100644 --- a/tests/PhpPresentation/Tests/Writer/ODPresentation/ContentTest.php +++ b/tests/PhpPresentation/Tests/Writer/ODPresentation/ContentTest.php @@ -539,7 +539,7 @@ public function testRichTextShadow(): void if (0 == $inc || 180 == $inc || 360 == $inc) { $this->assertZipXmlAttributeEquals('content.xml', $element, 'draw:shadow-offset-y', '0cm'); } else { - if (($inc > 0 && $inc < 180) || 360 == $inc) { + if ($inc < 180) { $this->assertZipXmlAttributeEquals('content.xml', $element, 'draw:shadow-offset-y', Drawing::pixelsToCentimeters((int) $randDistance) . 'cm'); } else { $this->assertZipXmlAttributeEquals('content.xml', $element, 'draw:shadow-offset-y', '-' . Drawing::pixelsToCentimeters((int) $randDistance) . 'cm');