Skip to content

Commit

Permalink
ENH Add generic types (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli authored Jan 18, 2024
1 parent 21ed224 commit f04e9fa
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
3 changes: 3 additions & 0 deletions src/Extensions/ContentReviewCMSExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use SilverStripe\Admin\LeftAndMain;
use SilverStripe\Admin\LeftAndMainExtension;
use SilverStripe\CMS\Controllers\CMSMain;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\ContentReview\Forms\ReviewContentHandler;
use SilverStripe\ContentReview\Traits\PermissionChecker;
Expand All @@ -17,6 +18,8 @@
/**
* CMSPageEditController extension to receive the additional action button from
* SiteTreeContentReview::updateCMSActions()
*
* @extends LeftAndMainExtension<CMSMain>
*/
class ContentReviewCMSExtension extends LeftAndMainExtension
{
Expand Down
9 changes: 6 additions & 3 deletions src/Extensions/ContentReviewDefaultSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use SilverStripe\Security\Group;
use SilverStripe\Security\Member;
use SilverStripe\Security\Permission;
use SilverStripe\SiteConfig\SiteConfig;

/**
* This extensions add a default schema for new pages and pages without a content
Expand All @@ -22,6 +23,8 @@
* @property int $ReviewPeriodDays
* @method SilverStripe\ORM\ManyManyList<Group> ContentReviewGroups()
* @method SilverStripe\ORM\ManyManyList<Member> ContentReviewUsers()
*
* @extends DataExtension<SiteConfig>
*/
class ContentReviewDefaultSettings extends DataExtension
{
Expand Down Expand Up @@ -88,15 +91,15 @@ public function getOwnerNames()
}

/**
* @return ManyManyList
* @return ManyManyList<Group>
*/
public function OwnerGroups()
{
return $this->owner->getManyManyComponents('ContentReviewGroups');
}

/**
* @return ManyManyList
* @return ManyManyList<Member>
*/
public function OwnerUsers()
{
Expand Down Expand Up @@ -180,7 +183,7 @@ public function updateCMSFields(FieldList $fields)
* Get all Members that are default Content Owners. This includes checking group hierarchy
* and adding any direct users.
*
* @return ArrayList
* @return ArrayList<Group|Member>
*/
public function ContentReviewOwners()
{
Expand Down
4 changes: 4 additions & 0 deletions src/Extensions/ContentReviewLeftAndMainExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

namespace SilverStripe\ContentReview\Extensions;

use SilverStripe\Admin\LeftAndMain;
use SilverStripe\Admin\LeftAndMainExtension;

/**
* @extends LeftAndMainExtension<LeftAndMain>
*/
class ContentReviewLeftAndMainExtension extends LeftAndMainExtension
{
/**
Expand Down
4 changes: 4 additions & 0 deletions src/Extensions/ContentReviewOwner.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Forms\FieldList;
use SilverStripe\ORM\DataExtension;
use SilverStripe\Security\Group;
use SilverStripe\Security\Member;

/**
* @method SilverStripe\ORM\ManyManyList<SiteTree> SiteTreeContentReview()
*
* @extends DataExtension<Group|Member>
*/
class ContentReviewOwner extends DataExtension
{
Expand Down
10 changes: 6 additions & 4 deletions src/Extensions/SiteTreeContentReview.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
* @method SilverStripe\ORM\ManyManyList<Group> ContentReviewGroups()
* @method SilverStripe\ORM\ManyManyList<Member> ContentReviewUsers()
* @method SilverStripe\ORM\HasManyList<ContentReviewLog> ReviewLogs()
*
* @extends DataExtension<SiteTree>
*/
class SiteTreeContentReview extends DataExtension implements PermissionProvider
{
Expand Down Expand Up @@ -119,7 +121,7 @@ public static function get_schedule()
* @param SS_List $groups
* @param SS_List $members
*
* @return ArrayList
* @return ArrayList<Group|Member>
*/
public static function merge_owners(SS_List $groups, SS_List $members)
{
Expand Down Expand Up @@ -293,7 +295,7 @@ public function getEditorName()
* Get all Members that are Content Owners to this page. This includes checking group
* hierarchy and adding any direct users.
*
* @return ArrayList
* @return ArrayList<Group|Member>
*/
public function ContentReviewOwners()
{
Expand All @@ -304,15 +306,15 @@ public function ContentReviewOwners()
}

/**
* @return ManyManyList
* @return ManyManyList<Group>
*/
public function OwnerGroups()
{
return $this->owner->getManyManyComponents("ContentReviewGroups");
}

/**
* @return ManyManyList
* @return ManyManyList<Member>
*/
public function OwnerUsers()
{
Expand Down

0 comments on commit f04e9fa

Please sign in to comment.