From 06a6117bb8abf254f7a012749c2bfbe8ad788808 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Fri, 27 Nov 2020 22:56:16 +0100 Subject: [PATCH] phpstan fixes --- Controller/ApiController.php | 2 +- Models/NewsArticle.php | 31 +++---------------------------- 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/Controller/ApiController.php b/Controller/ApiController.php index e55c9fb..a230fb6 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -174,7 +174,7 @@ final class ApiController extends Controller ) { /** @var \Modules\Comments\Controller\ApiController $commentApi */ $commnetList = $commentApi->createCommentList(); - $newsArticle->setCommentList($commnetList); + $newsArticle->comments = $commnetList; } if (!empty($tags = $request->getDataJson('tags'))) { diff --git a/Models/NewsArticle.php b/Models/NewsArticle.php index 001052a..b6f11c4 100755 --- a/Models/NewsArticle.php +++ b/Models/NewsArticle.php @@ -17,6 +17,7 @@ namespace Modules\News\Models; use Modules\Admin\Models\Account; use Modules\Admin\Models\NullAccount; use Modules\Tag\Models\Tag; +use Modules\Comments\Models\CommentList; use phpOMS\Contract\ArrayableInterface; use phpOMS\Localization\ISO639x1Enum; use phpOMS\Stdlib\Base\Exception\InvalidEnumValue; @@ -130,10 +131,10 @@ class NewsArticle implements \JsonSerializable, ArrayableInterface /** * Comments * - * @var null|\Modules\Comments\Models\CommentList + * @var null|CommentList * @since 1.0.0 */ - private $comments = null; + public ?CommentList $comments = null; /** * Constructor. @@ -147,32 +148,6 @@ class NewsArticle implements \JsonSerializable, ArrayableInterface $this->publish = new \DateTime('now'); } - /** - * Set comment list - * - * @param int|\Modules\Comments\Models\CommentList $comments Comment list - * - * @return void - * - * @since 1.0.0 - */ - public function setCommentList($comments) : void - { - $this->comments = $comments; - } - - /** - * Get comments - * - * @return null|\Modules\Comments\Models\CommentList - * - * @since 1.0.0 - */ - public function getComments() - { - return $this->comments; - } - /** * Get id *