From 2c1bb7e3fcb0b8f677562e18cf5afc91b8113296 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Fri, 17 May 2024 15:30:25 +1200 Subject: [PATCH] API Set extension hook implementation visibility to protected --- code/AdminErrorExtension.php | 2 +- code/Forms/GridFieldDetailFormPreviewExtension.php | 2 +- code/Forms/GridFieldPrintButtonExtension.php | 2 +- code/Forms/UsedOnTable.php | 2 +- code/LeftAndMainExtension.php | 4 ++-- code/ModelAdmin.php | 2 +- tests/behat/src/Extension/MemberEmailLinkExtension.php | 2 +- tests/php/ModelAdminTest/ModelAdminExtension.php | 4 ++-- tests/php/UsedOnTableTest/ExtTest_Extension.php | 4 ++-- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/code/AdminErrorExtension.php b/code/AdminErrorExtension.php index f8d38e160..a72a51821 100644 --- a/code/AdminErrorExtension.php +++ b/code/AdminErrorExtension.php @@ -16,7 +16,7 @@ class AdminErrorExtension extends Extension /** * Used by {@see RequestHandler::httpError} */ - public function onBeforeHTTPError($statusCode, HTTPRequest $request, $errorMessage = null) + protected function onBeforeHTTPError($statusCode, HTTPRequest $request, $errorMessage = null) { $controller = $this->getAdminController(); if (!$controller || Director::is_ajax($request) || $errorMessage === null) { diff --git a/code/Forms/GridFieldDetailFormPreviewExtension.php b/code/Forms/GridFieldDetailFormPreviewExtension.php index a821614ed..68d87c346 100644 --- a/code/Forms/GridFieldDetailFormPreviewExtension.php +++ b/code/Forms/GridFieldDetailFormPreviewExtension.php @@ -17,7 +17,7 @@ */ class GridFieldDetailFormPreviewExtension extends Extension { - public function updateItemEditForm(Form $form): void + protected function updateItemEditForm(Form $form): void { $record = $this->owner->getRecord(); // See LeftAndMain::getEditForm() diff --git a/code/Forms/GridFieldPrintButtonExtension.php b/code/Forms/GridFieldPrintButtonExtension.php index ccd48f874..9e808ae92 100644 --- a/code/Forms/GridFieldPrintButtonExtension.php +++ b/code/Forms/GridFieldPrintButtonExtension.php @@ -11,7 +11,7 @@ */ class GridFieldPrintButtonExtension extends Extension { - public function updatePrintData($data) + protected function updatePrintData($data) { Requirements::css('silverstripe/admin:client/dist/styles/GridField_print.css'); } diff --git a/code/Forms/UsedOnTable.php b/code/Forms/UsedOnTable.php index ea5ef2108..0521d3a35 100644 --- a/code/Forms/UsedOnTable.php +++ b/code/Forms/UsedOnTable.php @@ -83,7 +83,7 @@ public function usage(HTTPRequest $request) // Legacy extension hook kept for backwards compatibility // Use 'updateUsageExcludedClasses' extension hook instead which prevents database from being queried // - // Example: public function updateUsage(ArrayList &$usage, DataObject &$record) + // Example: protected function updateUsage(ArrayList &$usage, DataObject &$record) // $dataObjects = $usage->exclude('ClassName', MyDataObject::class); $this->extend('updateUsage', $usage, $record); } diff --git a/code/LeftAndMainExtension.php b/code/LeftAndMainExtension.php index 62835f1e4..a13037656 100644 --- a/code/LeftAndMainExtension.php +++ b/code/LeftAndMainExtension.php @@ -17,11 +17,11 @@ public function init() { } - public function accessedCMS() + protected function accessedCMS() { } - public function augmentNewSiteTreeItem(&$item) + protected function augmentNewSiteTreeItem(&$item) { } } diff --git a/code/ModelAdmin.php b/code/ModelAdmin.php index 5af2b9c1c..6e9158757 100644 --- a/code/ModelAdmin.php +++ b/code/ModelAdmin.php @@ -381,7 +381,7 @@ public function getExportFields() * Archived flag is set to false. That would be best done as an extension, for example: * * - * public function updateList(\SilverStripe\ORM\DataList $list) + * protected function updateList(\SilverStripe\ORM\DataList $list) * { * return $list->filter('Archived', false); * } diff --git a/tests/behat/src/Extension/MemberEmailLinkExtension.php b/tests/behat/src/Extension/MemberEmailLinkExtension.php index d2e6d22ec..db09690ab 100644 --- a/tests/behat/src/Extension/MemberEmailLinkExtension.php +++ b/tests/behat/src/Extension/MemberEmailLinkExtension.php @@ -15,7 +15,7 @@ */ class MemberEmailLinkExtension extends Extension implements TestOnly { - public function updateGridField(GridField $gridField) + protected function updateGridField(GridField $gridField) { if (is_a($this->getOwner()->getModelClass(), Member::class, true)) { $columns = $gridField->getConfig()->getComponentByType(GridFieldDataColumns::class); diff --git a/tests/php/ModelAdminTest/ModelAdminExtension.php b/tests/php/ModelAdminTest/ModelAdminExtension.php index 384f79050..94ce4d25f 100644 --- a/tests/php/ModelAdminTest/ModelAdminExtension.php +++ b/tests/php/ModelAdminTest/ModelAdminExtension.php @@ -15,13 +15,13 @@ class ModelAdminExtension extends Extension implements TestOnly { - public function updateGridField(GridField &$field) + protected function updateGridField(GridField &$field) { $this->getOwner()->calls[__FUNCTION__]++; $field->setAttribute('ModelAdminExtension', 'called'); } - public function updateGridFieldConfig(GridFieldConfig &$config) + protected function updateGridFieldConfig(GridFieldConfig &$config) { $this->getOwner()->calls[__FUNCTION__]++; $config->removeComponentsByType(GridFieldExportButton::class); diff --git a/tests/php/UsedOnTableTest/ExtTest_Extension.php b/tests/php/UsedOnTableTest/ExtTest_Extension.php index 46208b04f..46f8f3f5e 100644 --- a/tests/php/UsedOnTableTest/ExtTest_Extension.php +++ b/tests/php/UsedOnTableTest/ExtTest_Extension.php @@ -9,12 +9,12 @@ class ExtTest_Extension extends Extension implements TestOnly { - public function updateUsageExcludedClasses(array &$excludedClasses) + protected function updateUsageExcludedClasses(array &$excludedClasses) { $excludedClasses[] = ExtTest_Middle::class; } - public function updateUsageAncestorDataObjects(array &$ancestorDataObjects, DataObject $dataObject) + protected function updateUsageAncestorDataObjects(array &$ancestorDataObjects, DataObject $dataObject) { if (!($dataObject instanceof ExtTest_Outer)) { return;