From bc7be3f136c22c56b87bd9d87ae9a9a3f8e53949 Mon Sep 17 00:00:00 2001 From: Chris Lock Date: Sun, 2 Jul 2023 23:02:15 +0100 Subject: [PATCH] Declare visibility --- src/GridFieldAddNewInlineButton.php | 2 +- src/GridFieldAddNewMultiClass.php | 2 +- src/GridFieldConfigurablePaginator.php | 2 +- src/GridFieldEditableColumns.php | 2 +- src/GridFieldRequestHandler.php | 33 +++++++------------------- src/GridFieldTitleHeader.php | 6 ++--- 6 files changed, 16 insertions(+), 31 deletions(-) diff --git a/src/GridFieldAddNewInlineButton.php b/src/GridFieldAddNewInlineButton.php index a7f0d7d..9043269 100755 --- a/src/GridFieldAddNewInlineButton.php +++ b/src/GridFieldAddNewInlineButton.php @@ -29,7 +29,7 @@ class GridFieldAddNewInlineButton extends AbstractGridFieldComponent implements /** * @skipUpgrade */ - const POST_KEY = 'GridFieldAddNewInlineButton'; + private const POST_KEY = 'GridFieldAddNewInlineButton'; private string $fragment; private string $title; diff --git a/src/GridFieldAddNewMultiClass.php b/src/GridFieldAddNewMultiClass.php index 7275a6d..bc6c7e7 100755 --- a/src/GridFieldAddNewMultiClass.php +++ b/src/GridFieldAddNewMultiClass.php @@ -31,7 +31,7 @@ class GridFieldAddNewMultiClass extends AbstractGridFieldComponent implements /** * @skipUpgrade */ - const POST_KEY = 'GridFieldAddNewMultiClass'; + private const POST_KEY = 'GridFieldAddNewMultiClass'; private static $allowed_actions = array( 'handleAdd' diff --git a/src/GridFieldConfigurablePaginator.php b/src/GridFieldConfigurablePaginator.php index aa85fc6..3cad1cd 100644 --- a/src/GridFieldConfigurablePaginator.php +++ b/src/GridFieldConfigurablePaginator.php @@ -28,7 +28,7 @@ class GridFieldConfigurablePaginator extends GridFieldPaginator * @config * @var int */ - private static $default_page_sizes = array(15, 30, 60); + private static $default_page_sizes = [15, 30, 60]; /** * @var GridField diff --git a/src/GridFieldEditableColumns.php b/src/GridFieldEditableColumns.php index c48eb16..22e9731 100644 --- a/src/GridFieldEditableColumns.php +++ b/src/GridFieldEditableColumns.php @@ -43,7 +43,7 @@ class GridFieldEditableColumns extends GridFieldDataColumns implements /** * @skipUpgrade */ - const POST_KEY = 'GridFieldEditableColumns'; + private const POST_KEY = 'GridFieldEditableColumns'; private static $allowed_actions = array( 'handleForm' diff --git a/src/GridFieldRequestHandler.php b/src/GridFieldRequestHandler.php index 50a4400..3726b49 100644 --- a/src/GridFieldRequestHandler.php +++ b/src/GridFieldRequestHandler.php @@ -28,27 +28,12 @@ abstract class GridFieldRequestHandler extends RequestHandler 'Form' ); - /** - * @var GridField - */ - protected $grid; + protected GridField $grid; + protected GridFieldComponent $component; + protected string $name; + protected string $template = __CLASS__; - /** - * @var GridFieldComponent - */ - protected $component; - - /** - * @var string - */ - protected $name; - - /** - * @var string - */ - protected $template = __CLASS__; - - public function __construct(GridField $grid, GridFieldComponent $component, $name) + public function __construct(GridField $grid, GridFieldComponent $component, string $name) { $this->grid = $grid; $this->component = $component; @@ -112,7 +97,7 @@ abstract class GridFieldRequestHandler extends RequestHandler /** * @param string $template */ - public function setTemplate($template) + public function setTemplate(string $template) { $this->template = $template; } @@ -120,7 +105,7 @@ abstract class GridFieldRequestHandler extends RequestHandler /** * @return string */ - public function getTemplate() + public function getTemplate(): string { return $this->template; } @@ -128,7 +113,7 @@ abstract class GridFieldRequestHandler extends RequestHandler /** * @return ArrayList */ - public function getBreadcrumbs() + public function getBreadcrumbs(): ArrayList { $controller = $this->getController(); @@ -142,7 +127,7 @@ abstract class GridFieldRequestHandler extends RequestHandler /** * @return string */ - protected function getBackLink() + protected function getBackLink(): string { $controller = $this->getTopLevelController(); diff --git a/src/GridFieldTitleHeader.php b/src/GridFieldTitleHeader.php index e274eff..d549d04 100644 --- a/src/GridFieldTitleHeader.php +++ b/src/GridFieldTitleHeader.php @@ -12,7 +12,7 @@ use SilverStripe\View\ArrayData; */ class GridFieldTitleHeader extends AbstractGridFieldComponent implements GridField_HTMLProvider { - public function getHTMLFragments($grid) + public function getHTMLFragments($grid): array { $cols = ArrayList::create(); @@ -25,8 +25,8 @@ class GridFieldTitleHeader extends AbstractGridFieldComponent implements GridFie ))); } - return array( + return [ 'header' => $cols->renderWith(__CLASS__) - ); + ]; } }