Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH Add generic types #319

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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