From 0816fad65bd97d8d478f0487d67023f74833d58b Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Wed, 22 Sep 2021 22:34:58 +0200 Subject: [PATCH] [CLEANUP] Make lazy-loading proxies visible via type annotations (#310) Relates to #291 --- Classes/Domain/Model/Product/Tea.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Classes/Domain/Model/Product/Tea.php b/Classes/Domain/Model/Product/Tea.php index 810520e..265c231 100644 --- a/Classes/Domain/Model/Product/Tea.php +++ b/Classes/Domain/Model/Product/Tea.php @@ -25,7 +25,8 @@ class Tea extends AbstractEntity protected $description = ''; /** - * @var \TYPO3\CMS\Extbase\Domain\Model\FileReference + * @phpstan-var \TYPO3\CMS\Extbase\Domain\Model\FileReference|LazyLoadingProxy|null + * @var \TYPO3\CMS\Extbase\Domain\Model\FileReference|null * @Lazy */ protected $image = null; @@ -53,7 +54,9 @@ class Tea extends AbstractEntity public function getImage(): ?FileReference { if ($this->image instanceof LazyLoadingProxy) { - $this->image = $this->image->_loadRealInstance(); + /** @var FileReference $image */ + $image = $this->image->_loadRealInstance(); + $this->image = $image; } return $this->image;