From f6b467039f443d47d64c1cc112f4222a3da72821 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com> Date: Wed, 24 Jan 2024 09:39:03 +1300 Subject: [PATCH] ENH Add generic types (#336) --- src/Extensions/CustomSiteConfig.php | 3 +++ src/Extensions/CwpCommentingExtension.php | 3 ++- src/Extensions/CwpSiteTreeExtension.php | 4 ++++ src/Extensions/CwpSiteTreeFileExtension.php | 5 ++++- src/Extensions/CwpWorkflowDefinitionExtension.php | 2 ++ src/Extensions/MaintenanceProxyExtension.php | 4 ++++ src/Extensions/TaxonomyTermExtension.php | 5 ++++- src/PageTypes/BaseHomePageController.php | 4 ++++ src/PageTypes/BasePageController.php | 4 ++++ src/PageTypes/DatedUpdateHolderController.php | 3 +++ src/PageTypes/EventHolderController.php | 2 ++ src/PageTypes/EventPageController.php | 3 +++ src/PageTypes/NewsHolderController.php | 3 +++ src/PageTypes/SitemapPageController.php | 3 +++ 14 files changed, 45 insertions(+), 3 deletions(-) diff --git a/src/Extensions/CustomSiteConfig.php b/src/Extensions/CustomSiteConfig.php index cc15c60a..9ca1b203 100644 --- a/src/Extensions/CustomSiteConfig.php +++ b/src/Extensions/CustomSiteConfig.php @@ -6,9 +6,12 @@ use SilverStripe\Forms\TextField; use SilverStripe\ORM\DataExtension; use SilverStripe\ORM\FieldType\DBField; +use SilverStripe\SiteConfig\SiteConfig; /** * Adds new global settings. + * + * @extends DataExtension */ class CustomSiteConfig extends DataExtension { diff --git a/src/Extensions/CwpCommentingExtension.php b/src/Extensions/CwpCommentingExtension.php index b5cad6e7..eb763fe9 100644 --- a/src/Extensions/CwpCommentingExtension.php +++ b/src/Extensions/CwpCommentingExtension.php @@ -2,6 +2,7 @@ namespace CWP\CWP\Extensions; +use SilverStripe\Comments\Controllers\CommentingController; use SilverStripe\Control\Email\Email; use SilverStripe\Core\Extension; use SilverStripe\Forms\Form; @@ -9,7 +10,7 @@ /** * Customises the comment form to conform to government usability standards * - * {@see CommentingController} + * @extends Extension */ class CwpCommentingExtension extends Extension { diff --git a/src/Extensions/CwpSiteTreeExtension.php b/src/Extensions/CwpSiteTreeExtension.php index c6e742fc..c6ef8869 100644 --- a/src/Extensions/CwpSiteTreeExtension.php +++ b/src/Extensions/CwpSiteTreeExtension.php @@ -2,11 +2,15 @@ namespace CWP\CWP\Extensions; +use SilverStripe\CMS\Model\SiteTree; use SilverStripe\Forms\CheckboxField; use SilverStripe\Forms\FieldList; use SilverStripe\Forms\LiteralField; use SilverStripe\ORM\DataExtension; +/** + * @extends DataExtension + */ class CwpSiteTreeExtension extends DataExtension { private static $db = array( diff --git a/src/Extensions/CwpSiteTreeFileExtension.php b/src/Extensions/CwpSiteTreeFileExtension.php index 3017e7aa..112bc582 100644 --- a/src/Extensions/CwpSiteTreeFileExtension.php +++ b/src/Extensions/CwpSiteTreeFileExtension.php @@ -2,15 +2,18 @@ namespace CWP\CWP\Extensions; +use SilverStripe\Assets\File; use SilverStripe\Core\Convert; use SilverStripe\Forms\FieldList; use SilverStripe\Forms\ReadonlyField; use SilverStripe\ORM\DataExtension; use SilverStripe\View\Requirements; +/** + * @extends DataExtension + */ class CwpSiteTreeFileExtension extends DataExtension { - public function updateCMSFields(FieldList $fields) { Requirements::css('cwp/cwp:css/fieldDescriptionToggle.css'); diff --git a/src/Extensions/CwpWorkflowDefinitionExtension.php b/src/Extensions/CwpWorkflowDefinitionExtension.php index 565dcb69..944e34e0 100644 --- a/src/Extensions/CwpWorkflowDefinitionExtension.php +++ b/src/Extensions/CwpWorkflowDefinitionExtension.php @@ -9,6 +9,8 @@ /** * Ensures that the default template is created + * + * @extends DataExtension */ class CwpWorkflowDefinitionExtension extends DataExtension { diff --git a/src/Extensions/MaintenanceProxyExtension.php b/src/Extensions/MaintenanceProxyExtension.php index 9f327727..d538e182 100644 --- a/src/Extensions/MaintenanceProxyExtension.php +++ b/src/Extensions/MaintenanceProxyExtension.php @@ -3,6 +3,8 @@ namespace CWP\CWP\Extension; use BringYourOwnIdeas\Maintenance\Reports\SiteSummary; +use BringYourOwnIdeas\Maintenance\Util\ApiLoader; +use BringYourOwnIdeas\Maintenance\Util\ComposerLoader; use SilverStripe\Core\Environment; use SilverStripe\Core\Extension; @@ -10,6 +12,8 @@ * Used to configure proxy settings for bringyourownideas/silverstripe-maintenance and its related modules * * @see https://www.cwp.govt.nz/developer-docs/en/2/how_tos/external_http_requests_with_proxy + * + * @extends Extension */ class MaintenanceProxyExtension extends Extension { diff --git a/src/Extensions/TaxonomyTermExtension.php b/src/Extensions/TaxonomyTermExtension.php index 3567f382..0b230d29 100644 --- a/src/Extensions/TaxonomyTermExtension.php +++ b/src/Extensions/TaxonomyTermExtension.php @@ -6,10 +6,13 @@ use SilverStripe\ORM\DataExtension; use SilverStripe\Forms\FieldList; use SilverStripe\Forms\GridField\GridFieldAddNewButton; +use SilverStripe\Taxonomy\TaxonomyTerm; +/** + * @extends DataExtension + */ class TaxonomyTermExtension extends DataExtension { - private static $api_access = true; private static $belongs_many_many = array( diff --git a/src/PageTypes/BaseHomePageController.php b/src/PageTypes/BaseHomePageController.php index 92a637d9..c36fdd25 100644 --- a/src/PageTypes/BaseHomePageController.php +++ b/src/PageTypes/BaseHomePageController.php @@ -4,6 +4,10 @@ use PageController; +/** + * @template T of BaseHomePage + * @extends PageController + */ class BaseHomePageController extends PageController { public function getNewsPage() diff --git a/src/PageTypes/BasePageController.php b/src/PageTypes/BasePageController.php index 032c577d..3e550e58 100644 --- a/src/PageTypes/BasePageController.php +++ b/src/PageTypes/BasePageController.php @@ -5,6 +5,10 @@ use SilverStripe\CMS\Controllers\ContentController; use SilverStripe\ORM\FieldType\DBDatetime; +/** + * @template T of BasePage + * @extends ContentController + */ class BasePageController extends ContentController { /** diff --git a/src/PageTypes/DatedUpdateHolderController.php b/src/PageTypes/DatedUpdateHolderController.php index d721ffa1..19bf1c16 100644 --- a/src/PageTypes/DatedUpdateHolderController.php +++ b/src/PageTypes/DatedUpdateHolderController.php @@ -32,6 +32,9 @@ * * When the user clicks on a month, pagination will be reset, but tags retained. Pagination retains all other * parameters. + * + * @template T of DatedUpdateHolder + * @extends PageController */ class DatedUpdateHolderController extends PageController { diff --git a/src/PageTypes/EventHolderController.php b/src/PageTypes/EventHolderController.php index 7bf676cd..904af165 100644 --- a/src/PageTypes/EventHolderController.php +++ b/src/PageTypes/EventHolderController.php @@ -16,6 +16,8 @@ * * When the user clicks on a month, pagination will be reset, but tags retained. Pagination retains all other * parameters. + * + * @extends DatedUpdateHolderController */ class EventHolderController extends DatedUpdateHolderController { diff --git a/src/PageTypes/EventPageController.php b/src/PageTypes/EventPageController.php index 6d5eab64..d24c89bf 100644 --- a/src/PageTypes/EventPageController.php +++ b/src/PageTypes/EventPageController.php @@ -4,6 +4,9 @@ use PageController; +/** + * @extends PageController + */ class EventPageController extends PageController { diff --git a/src/PageTypes/NewsHolderController.php b/src/PageTypes/NewsHolderController.php index 261ef6db..a9fed0d7 100644 --- a/src/PageTypes/NewsHolderController.php +++ b/src/PageTypes/NewsHolderController.php @@ -5,6 +5,9 @@ use CWP\Core\Feed\CwpAtomFeed; use SilverStripe\Control\RSS\RSSFeed; +/** + * @extends DatedUpdateHolderController + */ class NewsHolderController extends DatedUpdateHolderController { private static $allowed_actions = [ diff --git a/src/PageTypes/SitemapPageController.php b/src/PageTypes/SitemapPageController.php index 5e2b3106..a947bf20 100644 --- a/src/PageTypes/SitemapPageController.php +++ b/src/PageTypes/SitemapPageController.php @@ -5,6 +5,9 @@ use PageController; use SilverStripe\CMS\Model\SiteTree; +/** + * @extends PageController + */ class SitemapPageController extends PageController { private static $allowed_actions = [