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 23, 2024
1 parent ae4de03 commit 0f4ac01
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/Extensions/CustomSiteConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<SiteConfig>
*/
class CustomSiteConfig extends DataExtension
{
Expand Down
3 changes: 2 additions & 1 deletion src/Extensions/CwpCommentingExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

namespace CWP\CWP\Extensions;

use SilverStripe\Comments\Controllers\CommentingController;
use SilverStripe\Control\Email\Email;
use SilverStripe\Core\Extension;
use SilverStripe\Forms\Form;

/**
* Customises the comment form to conform to government usability standards
*
* {@see CommentingController}
* @extends Extension<CommentingController>
*/
class CwpCommentingExtension extends Extension
{
Expand Down
4 changes: 4 additions & 0 deletions src/Extensions/CwpSiteTreeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<SiteTree>
*/
class CwpSiteTreeExtension extends DataExtension
{
private static $db = array(
Expand Down
5 changes: 4 additions & 1 deletion src/Extensions/CwpSiteTreeFileExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<File>
*/
class CwpSiteTreeFileExtension extends DataExtension
{

public function updateCMSFields(FieldList $fields)
{
Requirements::css('cwp/cwp:css/fieldDescriptionToggle.css');
Expand Down
2 changes: 2 additions & 0 deletions src/Extensions/CwpWorkflowDefinitionExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

/**
* Ensures that the default template is created
*
* @extends DataExtension<WorkflowDefinition>
*/
class CwpWorkflowDefinitionExtension extends DataExtension
{
Expand Down
4 changes: 4 additions & 0 deletions src/Extensions/MaintenanceProxyExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
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;

/**
* 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<ComposerLoader|ApiLoader>
*/
class MaintenanceProxyExtension extends Extension
{
Expand Down
5 changes: 4 additions & 1 deletion src/Extensions/TaxonomyTermExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
use SilverStripe\ORM\DataExtension;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\GridField\GridFieldAddNewButton;
use SilverStripe\Taxonomy\TaxonomyTerm;

/**
* @extends DataExtension<TaxonomyTerm>
*/
class TaxonomyTermExtension extends DataExtension
{

private static $api_access = true;

private static $belongs_many_many = array(
Expand Down
4 changes: 4 additions & 0 deletions src/PageTypes/BaseHomePageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

use PageController;

/**
* @template T of BaseHomePage
* @extends PageController<T>
*/
class BaseHomePageController extends PageController
{
public function getNewsPage()
Expand Down
4 changes: 4 additions & 0 deletions src/PageTypes/BasePageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
use SilverStripe\CMS\Controllers\ContentController;
use SilverStripe\ORM\FieldType\DBDatetime;

/**
* @template T of BasePage
* @extends ContentController<T>
*/
class BasePageController extends ContentController
{
/**
Expand Down
3 changes: 3 additions & 0 deletions src/PageTypes/DatedUpdateHolderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>
*/
class DatedUpdateHolderController extends PageController
{
Expand Down
2 changes: 2 additions & 0 deletions src/PageTypes/EventHolderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<EventHolder>
*/
class EventHolderController extends DatedUpdateHolderController
{
Expand Down
3 changes: 3 additions & 0 deletions src/PageTypes/EventPageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

use PageController;

/**
* @extends PageController<EventPage>
*/
class EventPageController extends PageController
{

Expand Down
3 changes: 3 additions & 0 deletions src/PageTypes/NewsHolderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
use CWP\Core\Feed\CwpAtomFeed;
use SilverStripe\Control\RSS\RSSFeed;

/**
* @extends DatedUpdateHolderController<NewsHolder>
*/
class NewsHolderController extends DatedUpdateHolderController
{
private static $allowed_actions = [
Expand Down
3 changes: 3 additions & 0 deletions src/PageTypes/SitemapPageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
use PageController;
use SilverStripe\CMS\Model\SiteTree;

/**
* @extends PageController<SitemapPage>
*/
class SitemapPageController extends PageController
{
private static $allowed_actions = [
Expand Down

0 comments on commit 0f4ac01

Please sign in to comment.