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 12, 2024
1 parent 64fa5f1 commit 407d8e1
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 11 deletions.
5 changes: 1 addition & 4 deletions src/ArchiveAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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<ArrayData> An ArrayList of all managed models to build the tabs for this ModelAdmin
*/
public function getManagedModelTabs()
{
Expand Down
4 changes: 0 additions & 4 deletions src/Controllers/CMSPageHistoryViewerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/Controllers/HistoryViewerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down
3 changes: 3 additions & 0 deletions src/Extensions/ArchiveRestoreAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<VersionedGridFieldItemRequest>
*/
class ArchiveRestoreAction extends DataExtension
{
Expand Down
2 changes: 2 additions & 0 deletions src/Extensions/BlockArchiveExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

/**
* Adds a archive view for Elemental blocks
*
* @extends DataExtension<BaseElement>
*/
class BlockArchiveExtension extends DataExtension implements ArchiveViewProvider
{
Expand Down
2 changes: 2 additions & 0 deletions src/Extensions/FileArchiveExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

/**
* Adds a archive view for Files
*
* @extends DataExtension<File>
*/
class FileArchiveExtension extends DataExtension implements ArchiveViewProvider
{
Expand Down
2 changes: 2 additions & 0 deletions src/Extensions/SiteTreeArchiveExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

/**
* Adds a archive view for Pages
*
* @extends DataExtension<SiteTree>
*/
class SiteTreeArchiveExtension extends DataExtension implements ArchiveViewProvider
{
Expand Down
5 changes: 4 additions & 1 deletion src/Extensions/UsedOnTableExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

namespace SilverStripe\VersionedAdmin\Extensions;

use SilverStripe\Admin\Forms\UsedOnTable;
use SilverStripe\Core\Extension;
use SilverStripe\Versioned\ChangeSetItem;

/**
* @extends Extension<UsedOnTable>
*/
class UsedOnTableExtension extends Extension
{

/**
* @var array $excludedClasses
*/
Expand Down

0 comments on commit 407d8e1

Please sign in to comment.