From 3b8092272be26bf34126f15dc6cfbef9eed6f075 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com> Date: Fri, 19 Jan 2024 09:58:02 +1300 Subject: [PATCH] ENH Add generic types (#739) --- src/Model/Blog.php | 4 ++-- src/Model/BlogCommentExtension.php | 3 +++ src/Model/BlogController.php | 13 +++++++------ src/Model/BlogFilter.php | 1 - src/Model/BlogMemberExtension.php | 2 ++ src/Model/BlogObject.php | 2 +- src/Model/BlogPostController.php | 3 +++ src/Model/BlogPostFeaturedExtension.php | 2 ++ src/Model/BlogPostFilter.php | 1 + src/Model/BlogPostNotifications.php | 2 ++ src/Widgets/BlogArchiveWidget.php | 2 +- src/Widgets/BlogCategoriesWidget.php | 3 ++- src/Widgets/BlogTagsWidget.php | 3 ++- 13 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/Model/Blog.php b/src/Model/Blog.php index a193731..d3aeec9 100644 --- a/src/Model/Blog.php +++ b/src/Model/Blog.php @@ -533,7 +533,7 @@ class Blog extends Page implements PermissionProvider * @param null|int $month * @param null|int $day * - * @return DataList + * @return DataList */ public function getArchivedBlogPosts($year, $month = null, $day = null) { @@ -574,7 +574,7 @@ class Blog extends Page implements PermissionProvider /** * Return blog posts. * - * @return DataList of BlogPost objects + * @return DataList of BlogPost objects */ public function getBlogPosts() { diff --git a/src/Model/BlogCommentExtension.php b/src/Model/BlogCommentExtension.php index e8c9d20..ef72640 100644 --- a/src/Model/BlogCommentExtension.php +++ b/src/Model/BlogCommentExtension.php @@ -2,10 +2,13 @@ namespace SilverStripe\Blog\Model; +use SilverStripe\Comments\Model\Comment; use SilverStripe\ORM\DataExtension; /** * Adds Blog specific behaviour to Comment. + * + * @extends DataExtension */ class BlogCommentExtension extends DataExtension { diff --git a/src/Model/BlogController.php b/src/Model/BlogController.php index 99a9fec..352736f 100644 --- a/src/Model/BlogController.php +++ b/src/Model/BlogController.php @@ -15,7 +15,11 @@ use SilverStripe\Blog\Model\BlogTag; use SilverStripe\Blog\Model\BlogCategory; use SilverStripe\View\Parsers\URLSegmentFilter; use SilverStripe\Control\HTTPRequest; +use SilverStripe\ORM\SS_List; +/** + * @extends PageController + */ class BlogController extends PageController { /** @@ -58,7 +62,7 @@ class BlogController extends PageController /** * The current Blog Post DataList query. * - * @var DataList + * @var DataList */ protected $blogPosts; @@ -67,9 +71,6 @@ class BlogController extends PageController */ public function index(HTTPRequest $request) { - /** - * @var Blog $dataRecord - */ $dataRecord = $this->dataRecord; $this->blogPosts = $dataRecord->getBlogPosts(); @@ -128,7 +129,7 @@ class BlogController extends PageController /** * Get posts related to the current Member profile. * - * @return null|DataList + * @return null|DataList */ public function getCurrentProfilePosts() { @@ -443,7 +444,7 @@ class BlogController extends PageController /** * Returns a list of paginated blog posts based on the BlogPost dataList. * - * @return PaginatedList + * @return PaginatedList */ public function PaginatedList() { diff --git a/src/Model/BlogFilter.php b/src/Model/BlogFilter.php index 89d348e..62e5801 100644 --- a/src/Model/BlogFilter.php +++ b/src/Model/BlogFilter.php @@ -16,7 +16,6 @@ use SilverStripe\Versioned\Versioned; /** * This class is responsible for filtering the SiteTree when necessary and also overlaps into * filtering only published posts. - * */ class BlogFilter extends Lumberjack { diff --git a/src/Model/BlogMemberExtension.php b/src/Model/BlogMemberExtension.php index ed453f6..c5c104a 100644 --- a/src/Model/BlogMemberExtension.php +++ b/src/Model/BlogMemberExtension.php @@ -19,6 +19,8 @@ use SilverStripe\View\Requirements; * * @method SilverStripe\ORM\ManyManyList BlogPosts() * @method Image BlogProfileImage() + * + * @extends DataExtension */ class BlogMemberExtension extends DataExtension { diff --git a/src/Model/BlogObject.php b/src/Model/BlogObject.php index af53dc8..677a974 100644 --- a/src/Model/BlogObject.php +++ b/src/Model/BlogObject.php @@ -21,7 +21,7 @@ trait BlogObject { /** * @param int|array|null $id Optional ID(s) for parent of this relation, if not the current record - * @return DataList + * @return DataList */ public function BlogPosts($id = null) { diff --git a/src/Model/BlogPostController.php b/src/Model/BlogPostController.php index 706ec46..6a05e5a 100644 --- a/src/Model/BlogPostController.php +++ b/src/Model/BlogPostController.php @@ -4,6 +4,9 @@ namespace SilverStripe\Blog\Model; use PageController; +/** + * @extends PageController + */ class BlogPostController extends PageController { diff --git a/src/Model/BlogPostFeaturedExtension.php b/src/Model/BlogPostFeaturedExtension.php index 80128d8..e98dd0d 100644 --- a/src/Model/BlogPostFeaturedExtension.php +++ b/src/Model/BlogPostFeaturedExtension.php @@ -8,6 +8,8 @@ use SilverStripe\Forms\CheckboxField; /** * Adds a checkbox field for featured blog posts widget. + * + * @extends DataExtension */ class BlogPostFeaturedExtension extends DataExtension { diff --git a/src/Model/BlogPostFilter.php b/src/Model/BlogPostFilter.php index e296864..f589654 100644 --- a/src/Model/BlogPostFilter.php +++ b/src/Model/BlogPostFilter.php @@ -17,6 +17,7 @@ use SilverStripe\Versioned\Versioned; * This is responsible for filtering only published posts to users who do not have permission to * view non-published posts. * + * @extends DataExtension */ class BlogPostFilter extends DataExtension { diff --git a/src/Model/BlogPostNotifications.php b/src/Model/BlogPostNotifications.php index eca2f7c..26a17d6 100644 --- a/src/Model/BlogPostNotifications.php +++ b/src/Model/BlogPostNotifications.php @@ -12,6 +12,8 @@ use SilverStripe\Security\Member; * Customise blog post to support comment notifications. * * Extends {@see BlogPost} with extensions to {@see CommentNotifiable}. + * + * @extends DataExtension */ class BlogPostNotifications extends DataExtension { diff --git a/src/Widgets/BlogArchiveWidget.php b/src/Widgets/BlogArchiveWidget.php index 4ee27bb..39c611e 100644 --- a/src/Widgets/BlogArchiveWidget.php +++ b/src/Widgets/BlogArchiveWidget.php @@ -108,7 +108,7 @@ class BlogArchiveWidget extends Widget /** * Returns a list of months where blog posts are present. * - * @return ArrayList + * @return ArrayList */ public function getArchive() { diff --git a/src/Widgets/BlogCategoriesWidget.php b/src/Widgets/BlogCategoriesWidget.php index 215ddaf..6736397 100644 --- a/src/Widgets/BlogCategoriesWidget.php +++ b/src/Widgets/BlogCategoriesWidget.php @@ -3,6 +3,7 @@ namespace SilverStripe\Blog\Widgets; use SilverStripe\Blog\Model\Blog; +use SilverStripe\Blog\Model\BlogCategory; use SilverStripe\Core\Convert; use SilverStripe\Forms\DropdownField; use SilverStripe\Forms\FieldList; @@ -106,7 +107,7 @@ class BlogCategoriesWidget extends Widget } /** - * @return DataList + * @return DataList */ public function getCategories() { diff --git a/src/Widgets/BlogTagsWidget.php b/src/Widgets/BlogTagsWidget.php index cf178ea..15a329f 100644 --- a/src/Widgets/BlogTagsWidget.php +++ b/src/Widgets/BlogTagsWidget.php @@ -3,6 +3,7 @@ namespace SilverStripe\Blog\Widgets; use SilverStripe\Blog\Model\Blog; +use SilverStripe\Blog\Model\BlogTag; use SilverStripe\Core\Convert; use SilverStripe\Forms\DropdownField; use SilverStripe\Forms\FieldList; @@ -106,7 +107,7 @@ class BlogTagsWidget extends Widget } /** - * @return DataList + * @return DataList */ public function getTags() {