From d6b4f23cce4f7de7efc44bcb10d277d47e4f7d65 Mon Sep 17 00:00:00 2001 From: kw-pr <9133572+kw-pr@users.noreply.github.com> Date: Wed, 27 Nov 2024 14:23:11 +0100 Subject: [PATCH 1/5] BUGFIX #820 createDrawingShape stopped working in 1.1.0 Added setContainer in ShapeCollection::addShape(). --- src/PhpPresentation/Traits/ShapeCollection.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/PhpPresentation/Traits/ShapeCollection.php b/src/PhpPresentation/Traits/ShapeCollection.php index 6c7582cb1..0a2d1c5c3 100644 --- a/src/PhpPresentation/Traits/ShapeCollection.php +++ b/src/PhpPresentation/Traits/ShapeCollection.php @@ -81,6 +81,10 @@ public function addShape(AbstractShape $shape) { $this->shapeCollection[] = $shape; + if (method_exists($shape, 'setContainer') && $shape->getContainer() === null) { + $shape->setContainer($this); + } + return $this; } From b08eb11550ee6bcf767fb74e727bafd17ef12e7d Mon Sep 17 00:00:00 2001 From: kw-pr <9133572+kw-pr@users.noreply.github.com> Date: Wed, 27 Nov 2024 14:47:37 +0100 Subject: [PATCH 2/5] Chore: Updated 1.2.0 changelog --- docs/changes/1.2.0.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changes/1.2.0.md b/docs/changes/1.2.0.md index f213e90a9..0c714de64 100644 --- a/docs/changes/1.2.0.md +++ b/docs/changes/1.2.0.md @@ -10,6 +10,7 @@ ## Bug fixes - Word2007 Reader: Fixed cast of spacing fixing [#729](https://github.com/PHPOffice/PHPPresentation/pull/729), [#796](https://github.com/PHPOffice/PHPPresentation/pull/796) in [#818](https://github.com/PHPOffice/PHPPresentation/pull/818) +- Word2007 Writer: Fixed missing images [#829](https://github.com/PHPOffice/PHPPresentation/pull/829) by [@kw-pr](https://github.com/kw-pr) ## Miscellaneous From 6a549ba8d6d1a668bac024fac01f1a2a14af366c Mon Sep 17 00:00:00 2001 From: kw-pr <9133572+kw-pr@users.noreply.github.com> Date: Wed, 27 Nov 2024 21:11:25 +0100 Subject: [PATCH 3/5] fix #820 ShapeCollection::addShape with instanceof and @throws --- src/PhpPresentation/Traits/ShapeCollection.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/PhpPresentation/Traits/ShapeCollection.php b/src/PhpPresentation/Traits/ShapeCollection.php index 0a2d1c5c3..ea71fa581 100644 --- a/src/PhpPresentation/Traits/ShapeCollection.php +++ b/src/PhpPresentation/Traits/ShapeCollection.php @@ -20,6 +20,7 @@ namespace PhpOffice\PhpPresentation\Traits; use PhpOffice\PhpPresentation\AbstractShape; +use PhpOffice\PhpPresentation\ShapeContainerInterface; trait ShapeCollection { @@ -76,12 +77,13 @@ public function setShapeCollection(array $shapeCollection = []): self /** * @return static + * @throws ShapeContainerAlreadyAssignedException */ public function addShape(AbstractShape $shape) { $this->shapeCollection[] = $shape; - if (method_exists($shape, 'setContainer') && $shape->getContainer() === null) { + if ($this instanceof ShapeContainerInterface && $shape->getContainer() === null) { $shape->setContainer($this); } From e00fd03f87af890f040a1fe59d48584cc2ae9843 Mon Sep 17 00:00:00 2001 From: kw-pr <9133572+kw-pr@users.noreply.github.com> Date: Thu, 28 Nov 2024 08:47:34 +0100 Subject: [PATCH 4/5] Chore: throws Throwable --- src/PhpPresentation/Traits/ShapeCollection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpPresentation/Traits/ShapeCollection.php b/src/PhpPresentation/Traits/ShapeCollection.php index ea71fa581..78e6acbda 100644 --- a/src/PhpPresentation/Traits/ShapeCollection.php +++ b/src/PhpPresentation/Traits/ShapeCollection.php @@ -77,7 +77,7 @@ public function setShapeCollection(array $shapeCollection = []): self /** * @return static - * @throws ShapeContainerAlreadyAssignedException + * @throws ShapeContainerAlreadyAssignedException&Throwable */ public function addShape(AbstractShape $shape) { From c2f78ff16c99480e19b241ffefda291b97a3d61b Mon Sep 17 00:00:00 2001 From: kw-pr <9133572+kw-pr@users.noreply.github.com> Date: Thu, 28 Nov 2024 08:53:45 +0100 Subject: [PATCH 5/5] Chore: @throws \Throwable --- src/PhpPresentation/Traits/ShapeCollection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpPresentation/Traits/ShapeCollection.php b/src/PhpPresentation/Traits/ShapeCollection.php index 78e6acbda..c064beee0 100644 --- a/src/PhpPresentation/Traits/ShapeCollection.php +++ b/src/PhpPresentation/Traits/ShapeCollection.php @@ -77,7 +77,7 @@ public function setShapeCollection(array $shapeCollection = []): self /** * @return static - * @throws ShapeContainerAlreadyAssignedException&Throwable + * @throws ShapeContainerAlreadyAssignedException&\Throwable */ public function addShape(AbstractShape $shape) {