From 808c8f0ca43c8b48f5a172ddd8e8259ed38068ed Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Sat, 13 Feb 2016 14:41:17 +1100 Subject: [PATCH] Minor tidy and rollback from #1720 --- modules/backend/traits/WidgetMaker.php | 2 -- modules/backend/widgets/Form.php | 8 ++------ modules/system/traits/ConfigMaker.php | 7 +++---- modules/system/traits/ViewMaker.php | 12 +++++------- 4 files changed, 10 insertions(+), 19 deletions(-) diff --git a/modules/backend/traits/WidgetMaker.php b/modules/backend/traits/WidgetMaker.php index 63b3f6ff6..ff6fee6ce 100644 --- a/modules/backend/traits/WidgetMaker.php +++ b/modules/backend/traits/WidgetMaker.php @@ -22,7 +22,6 @@ trait WidgetMaker * @param string $class Widget class name * @param array $widgetConfig An array of config. * @return \Backend\Classes\WidgetBase The widget object - * @throws SystemException */ public function makeWidget($class, $widgetConfig = []) { @@ -45,7 +44,6 @@ trait WidgetMaker * @param mixed $fieldConfig A field name, an array of config or a FormField object. * @param array $widgetConfig An array of config. * @return \Backend\Classes\FormWidgetBase The widget object - * @throws SystemException */ public function makeFormWidget($class, $fieldConfig = [], $widgetConfig = []) { diff --git a/modules/backend/widgets/Form.php b/modules/backend/widgets/Form.php index c2134f153..d4f1ec59d 100644 --- a/modules/backend/widgets/Form.php +++ b/modules/backend/widgets/Form.php @@ -93,7 +93,7 @@ class Form extends WidgetBase ]; /** - * @var FormWidgetBase[] Collection of all form widgets used in this form. + * @var array Collection of all form widgets used in this form. */ protected $formWidgets = []; @@ -167,7 +167,6 @@ class Form extends WidgetBase * * @param array $options * @return string|bool The rendered partial contents, or false if suppressing an exception - * @throws \SystemException */ public function render($options = []) { @@ -226,8 +225,6 @@ class Form extends WidgetBase * @param string|array $field The field name or definition * @param array $options * @return string|bool The rendered partial contents, or false if suppressing an exception - * @throws ApplicationException - * @throws \SystemException */ public function renderField($field, $options = []) { @@ -255,7 +252,6 @@ class Form extends WidgetBase * Renders the HTML element for a field * @param FormWidgetBase $field * @return string|bool The rendered partial contents, or false if suppressing an exception - * @throws \SystemException */ public function renderFieldElement($field) { @@ -364,6 +360,7 @@ class Form extends WidgetBase if (!isset($this->allFields[$field])) { continue; } + /** @var FormWidgetBase $fieldObject */ $fieldObject = $this->allFields[$field]; $result['#' . $fieldObject->getId('group')] = $this->makePartial('field', ['field' => $fieldObject]); @@ -832,7 +829,6 @@ class Form extends WidgetBase * Looks up the field value. * @param mixed $field * @return string - * @throws ApplicationException */ protected function getFieldValue($field) { diff --git a/modules/system/traits/ConfigMaker.php b/modules/system/traits/ConfigMaker.php index 332020650..4ca58d8e7 100644 --- a/modules/system/traits/ConfigMaker.php +++ b/modules/system/traits/ConfigMaker.php @@ -28,7 +28,6 @@ trait ConfigMaker * @param array $configFile * @param array $requiredConfig * @return array|stdClass - * @throws SystemException */ public function makeConfig($configFile = [], $requiredConfig = []) { @@ -108,7 +107,7 @@ trait ConfigMaker */ public function makeConfigFromArray($configArray = []) { - $object = new stdClass(); + $object = new stdClass; if (!is_array($configArray)) { return $object; @@ -124,7 +123,7 @@ trait ConfigMaker /** * Locates a file based on it's definition. If the file starts with - * an "at symbol", it will be returned in context of the application base path, + * the ~ symbol it will be returned in context of the application base path, * otherwise it will be returned in context of the config path. * @param string $fileName File to load. * @param mixed $configPath Explicitly define a config path. @@ -157,7 +156,7 @@ trait ConfigMaker } } - return ''; + return $fileName; } /** diff --git a/modules/system/traits/ViewMaker.php b/modules/system/traits/ViewMaker.php index 258752c9c..6b6143c86 100644 --- a/modules/system/traits/ViewMaker.php +++ b/modules/system/traits/ViewMaker.php @@ -50,7 +50,6 @@ trait ViewMaker * @param array $params Parameter variables to pass to the view. * @param bool $throwException Throw an exception if the partial is not found. * @return mixed Partial contents or false if not throwing an exception. - * @throws SystemException */ public function makePartial($partial, $params = [], $throwException = true) { @@ -90,7 +89,7 @@ trait ViewMaker * Renders supplied contents inside a layout. * @param string $contents The inner contents as a string. * @param string $layout Specifies the layout name. - * @throws SystemException + * @return string */ public function makeViewContent($contents, $layout = null) { @@ -110,12 +109,11 @@ trait ViewMaker * If this parameter is omitted, the $layout property will be used. * @param array $params Parameter variables to pass to the view. * @param bool $throwException Throw an exception if the layout is not found - * @return string The layout contents - * @throws SystemException + * @return mixed The layout contents, or false. */ public function makeLayout($name = null, $params = [], $throwException = true) { - $layout = ($name === null) ? $this->layout : $name; + $layout = $name === null ? $this->layout : $name; if ($layout == '') { return ''; } @@ -185,7 +183,7 @@ trait ViewMaker } } - return ''; + return $fileName; } /** @@ -236,7 +234,6 @@ trait ViewMaker * @param int $obLevel * @return void * - * @throws $e */ protected function handleViewException($e, $obLevel) { @@ -288,6 +285,7 @@ trait ViewMaker if ($result = Event::fire($event, $params)) { return implode(PHP_EOL.PHP_EOL, (array) $result); } + return ''; } }