Skip to content

Commit

Permalink
ENH Add generic types
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Jan 11, 2024
1 parent e8e40a8 commit 107a26b
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/Model/Blog.php
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ public function canEditContributors($member = null)
* @param null|int $month
* @param null|int $day
*
* @return DataList
* @return DataList<BlogPost>
*/
public function getArchivedBlogPosts($year, $month = null, $day = null)
{
Expand Down Expand Up @@ -574,7 +574,7 @@ public function getArchivedBlogPosts($year, $month = null, $day = null)
/**
* Return blog posts.
*
* @return DataList of BlogPost objects
* @return DataList<BlogPost> of BlogPost objects
*/
public function getBlogPosts()
{
Expand Down
3 changes: 3 additions & 0 deletions src/Model/BlogCommentExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<Comment>
*/
class BlogCommentExtension extends DataExtension
{
Expand Down
12 changes: 6 additions & 6 deletions src/Model/BlogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
use SilverStripe\View\Parsers\URLSegmentFilter;
use SilverStripe\Control\HTTPRequest;

/**
* @extends PageController<Blog>
*/
class BlogController extends PageController
{
/**
Expand Down Expand Up @@ -58,7 +61,7 @@ class BlogController extends PageController
/**
* The current Blog Post DataList query.
*
* @var DataList
* @var DataList<BlogPost>
*/
protected $blogPosts;

Expand All @@ -67,9 +70,6 @@ class BlogController extends PageController
*/
public function index(HTTPRequest $request)
{
/**
* @var Blog $dataRecord
*/
$dataRecord = $this->dataRecord;

$this->blogPosts = $dataRecord->getBlogPosts();
Expand Down Expand Up @@ -128,7 +128,7 @@ public function getCurrentProfile()
/**
* Get posts related to the current Member profile.
*
* @return null|DataList
* @return null|DataList<BlogPost>
*/
public function getCurrentProfilePosts()
{
Expand Down Expand Up @@ -443,7 +443,7 @@ public function getFilterDescription()
/**
* Returns a list of paginated blog posts based on the BlogPost dataList.
*
* @return PaginatedList
* @return PaginatedList<ArrayList, BlogPost>
*/
public function PaginatedList()
{
Expand Down
1 change: 0 additions & 1 deletion src/Model/BlogFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
/**
* This class is responsible for filtering the SiteTree when necessary and also overlaps into
* filtering only published posts.
*
*/
class BlogFilter extends Lumberjack
{
Expand Down
2 changes: 2 additions & 0 deletions src/Model/BlogMemberExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
*
* @method SilverStripe\ORM\ManyManyList<BlogPost> BlogPosts()
* @method Image BlogProfileImage()
*
* @extends DataExtension<Member>
*/
class BlogMemberExtension extends DataExtension
{
Expand Down
3 changes: 3 additions & 0 deletions src/Model/BlogPostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

use PageController;

/**
* @extends PageController<BlogPost>
*/
class BlogPostController extends PageController
{

Expand Down
2 changes: 2 additions & 0 deletions src/Model/BlogPostFeaturedExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

/**
* Adds a checkbox field for featured blog posts widget.
*
* @extends DataExtension<BlogPost>
*/
class BlogPostFeaturedExtension extends DataExtension
{
Expand Down
1 change: 1 addition & 0 deletions src/Model/BlogPostFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* This is responsible for filtering only published posts to users who do not have permission to
* view non-published posts.
*
* @extends DataExtension<BlogPost>
*/
class BlogPostFilter extends DataExtension
{
Expand Down
2 changes: 2 additions & 0 deletions src/Model/BlogPostNotifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* Customise blog post to support comment notifications.
*
* Extends {@see BlogPost} with extensions to {@see CommentNotifiable}.
*
* @extends DataExtension<BlogPost>
*/
class BlogPostNotifications extends DataExtension
{
Expand Down

0 comments on commit 107a26b

Please sign in to comment.