From ad08d7632c4db63d59f361f92002d2a87af102f6 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com> Date: Fri, 19 Jan 2024 10:24:26 +1300 Subject: [PATCH] ENH Add generic types (#319) --- src/ArchiveAdmin.php | 5 +---- src/Controllers/CMSPageHistoryViewerController.php | 4 ---- src/Controllers/HistoryViewerController.php | 2 -- src/Extensions/ArchiveRestoreAction.php | 3 +++ src/Extensions/BlockArchiveExtension.php | 2 ++ src/Extensions/FileArchiveExtension.php | 2 ++ src/Extensions/SiteTreeArchiveExtension.php | 2 ++ src/Extensions/UsedOnTableExtension.php | 5 ++++- 8 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/ArchiveAdmin.php b/src/ArchiveAdmin.php index a7451a32..4542f048 100644 --- a/src/ArchiveAdmin.php +++ b/src/ArchiveAdmin.php @@ -293,9 +293,6 @@ public function getOtherModelSelectorField($currentModel = '') /** * Use 'Archive' as the top title rather than the model title - * - * @param bool $unlinked - * @return ArrayList */ public function Breadcrumbs($unlinked = false) { @@ -327,7 +324,7 @@ public function getManagedModels() /** * Add the special 'Others' tab * - * @return ArrayList An ArrayList of all managed models to build the tabs for this ModelAdmin + * @return ArrayList An ArrayList of all managed models to build the tabs for this ModelAdmin */ public function getManagedModelTabs() { diff --git a/src/Controllers/CMSPageHistoryViewerController.php b/src/Controllers/CMSPageHistoryViewerController.php index 30ccbb96..ca04f154 100644 --- a/src/Controllers/CMSPageHistoryViewerController.php +++ b/src/Controllers/CMSPageHistoryViewerController.php @@ -4,9 +4,7 @@ use SilverStripe\CMS\Controllers\CMSMain; use SilverStripe\Forms\FieldList; -use SilverStripe\Forms\Form; use SilverStripe\Forms\HiddenField; -use SilverStripe\ORM\DataObject; use SilverStripe\VersionedAdmin\Forms\HistoryViewerField; if (!class_exists(CMSMain::class)) { @@ -30,10 +28,8 @@ class CMSPageHistoryViewerController extends CMSMain public function getEditForm($id = null, $fields = null) { - /** @var DataObject $record */ $record = $this->getRecord($id ?: $this->currentPageID()); - /** @var Form $form */ $form = parent::getEditForm($id); $form->addExtraClass('history-viewer__form'); // Disable default CMS preview diff --git a/src/Controllers/HistoryViewerController.php b/src/Controllers/HistoryViewerController.php index 2cb87b8f..404d9f77 100644 --- a/src/Controllers/HistoryViewerController.php +++ b/src/Controllers/HistoryViewerController.php @@ -9,7 +9,6 @@ use SilverStripe\Control\HTTPResponse; use SilverStripe\Core\Injector\Injector; use SilverStripe\Forms\Form; -use SilverStripe\Forms\FormFactory; use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\FieldType\DBDatetime; @@ -332,7 +331,6 @@ protected function validateInput(array $context, array $requiredFields = []) */ protected function scaffoldForm($formName, array $context = [], array $extra = []) { - /** @var FormFactory $scaffolder */ $scaffolder = Injector::inst()->get(DataObjectVersionFormFactory::class); $form = $scaffolder->getForm($this, $formName, $context); diff --git a/src/Extensions/ArchiveRestoreAction.php b/src/Extensions/ArchiveRestoreAction.php index a68f8d2b..650894e6 100644 --- a/src/Extensions/ArchiveRestoreAction.php +++ b/src/Extensions/ArchiveRestoreAction.php @@ -12,10 +12,13 @@ use SilverStripe\ORM\ValidationResult; use SilverStripe\Versioned\RestoreAction; use SilverStripe\Versioned\Versioned; +use SilverStripe\Versioned\VersionedGridFieldItemRequest; use SilverStripe\VersionedAdmin\ArchiveAdmin; /** * Adds a restore action to the item edit form of ArchiveAdmin + * + * @extends DataExtension */ class ArchiveRestoreAction extends DataExtension { diff --git a/src/Extensions/BlockArchiveExtension.php b/src/Extensions/BlockArchiveExtension.php index 7c5429a6..d839d259 100644 --- a/src/Extensions/BlockArchiveExtension.php +++ b/src/Extensions/BlockArchiveExtension.php @@ -12,6 +12,8 @@ /** * Adds a archive view for Elemental blocks + * + * @extends DataExtension */ class BlockArchiveExtension extends DataExtension implements ArchiveViewProvider { diff --git a/src/Extensions/FileArchiveExtension.php b/src/Extensions/FileArchiveExtension.php index 8c212ec4..cc102c60 100644 --- a/src/Extensions/FileArchiveExtension.php +++ b/src/Extensions/FileArchiveExtension.php @@ -15,6 +15,8 @@ /** * Adds a archive view for Files + * + * @extends DataExtension */ class FileArchiveExtension extends DataExtension implements ArchiveViewProvider { diff --git a/src/Extensions/SiteTreeArchiveExtension.php b/src/Extensions/SiteTreeArchiveExtension.php index 1b34291c..3debea3a 100644 --- a/src/Extensions/SiteTreeArchiveExtension.php +++ b/src/Extensions/SiteTreeArchiveExtension.php @@ -12,6 +12,8 @@ /** * Adds a archive view for Pages + * + * @extends DataExtension */ class SiteTreeArchiveExtension extends DataExtension implements ArchiveViewProvider { diff --git a/src/Extensions/UsedOnTableExtension.php b/src/Extensions/UsedOnTableExtension.php index 4aec3cab..7aa55a80 100644 --- a/src/Extensions/UsedOnTableExtension.php +++ b/src/Extensions/UsedOnTableExtension.php @@ -2,12 +2,15 @@ namespace SilverStripe\VersionedAdmin\Extensions; +use SilverStripe\Admin\Forms\UsedOnTable; use SilverStripe\Core\Extension; use SilverStripe\Versioned\ChangeSetItem; +/** + * @extends Extension + */ class UsedOnTableExtension extends Extension { - /** * @var array $excludedClasses */