From a777c44cb43a4a53882103dc9904cf18c67ba11b Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Sun, 9 Jun 2019 23:33:38 +0800 Subject: [PATCH] Remove typehints for database template methods. Instead check the CmsObject class inheritence in the methods. Fixes #4376 --- modules/cms/controllers/Index.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/cms/controllers/Index.php b/modules/cms/controllers/Index.php index c31aa95be..e01f34bd3 100644 --- a/modules/cms/controllers/Index.php +++ b/modules/cms/controllers/Index.php @@ -441,11 +441,11 @@ class Index extends Controller /** * Get the response to return in an AJAX request that updates a template * - * @param CmsObject $template The template that has been affected + * @param object $template The template that has been affected * @param string $type The type of template being affected * @return array $result; */ - protected function getUpdateResponse(CmsObject $template, string $type) + protected function getUpdateResponse($template, string $type) { $result = [ 'templatePath' => $template->fileName, @@ -483,8 +483,12 @@ class Index extends Controller * @param CmsObject $template * @return boolean */ - protected function canCommitTemplate(CmsObject $template) + protected function canCommitTemplate($template) { + if ($template instanceof Cms\Contracts\CmsObject === false) { + return false; + } + $result = false; if (Config::get('app.debug', false) && @@ -504,8 +508,12 @@ class Index extends Controller * @param CmsObject $template * @return boolean */ - protected function canResetTemplate(CmsObject $template) + protected function canResetTemplate($template) { + if ($template instanceof Cms\Contracts\CmsObject === false) { + return false; + } + $result = false; if (Theme::databaseLayerEnabled()) {