From 930e6e7d71bda7aa4b32464c307df2594efb0060 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 8 Sep 2014 09:24:53 +0200 Subject: [PATCH] We shouldn't require Form::createElements() to return self refs #5525 --- application/forms/Authentication/LoginForm.php | 2 -- .../forms/Config/Authentication/AutologinBackendForm.php | 2 -- application/forms/Config/Authentication/DbBackendForm.php | 2 -- .../forms/Config/Authentication/LdapBackendForm.php | 2 -- .../forms/Config/AuthenticationBackendConfigForm.php | 2 -- .../forms/Config/General/ApplicationConfigForm.php | 2 -- application/forms/Config/General/LoggingConfigForm.php | 2 -- application/forms/Config/GeneralConfigForm.php | 2 -- application/forms/Config/Resource/DbResourceForm.php | 2 -- application/forms/Config/Resource/FileResourceForm.php | 2 -- application/forms/Config/Resource/LdapResourceForm.php | 2 -- .../forms/Config/Resource/LivestatusResourceForm.php | 2 -- .../forms/Config/Resource/StatusdatResourceForm.php | 2 -- application/forms/Config/ResourceConfigForm.php | 2 -- application/forms/Dashboard/AddUrlForm.php | 2 -- application/forms/PreferenceForm.php | 2 -- library/Icinga/Web/Form.php | 8 +++----- .../application/forms/Config/BackendConfigForm.php | 2 -- .../forms/Config/Instance/LocalInstanceForm.php | 2 -- .../forms/Config/Instance/RemoteInstanceForm.php | 2 -- .../application/forms/Config/InstanceConfigForm.php | 2 -- .../application/forms/Config/SecurityConfigForm.php | 2 -- 22 files changed, 3 insertions(+), 47 deletions(-) diff --git a/application/forms/Authentication/LoginForm.php b/application/forms/Authentication/LoginForm.php index 0d9b8dedc..d878475f2 100644 --- a/application/forms/Authentication/LoginForm.php +++ b/application/forms/Authentication/LoginForm.php @@ -53,7 +53,5 @@ class LoginForm extends Form 'value' => Url::fromRequest()->getParam('redirect') ) ); - - return $this; } } diff --git a/application/forms/Config/Authentication/AutologinBackendForm.php b/application/forms/Config/Authentication/AutologinBackendForm.php index 4f4df73e3..d4e0547a9 100644 --- a/application/forms/Config/Authentication/AutologinBackendForm.php +++ b/application/forms/Config/Authentication/AutologinBackendForm.php @@ -69,8 +69,6 @@ class AutologinBackendForm extends Form 'value' => 'autologin' ) ); - - return $this; } /** diff --git a/application/forms/Config/Authentication/DbBackendForm.php b/application/forms/Config/Authentication/DbBackendForm.php index 23335f8fa..960a6d07c 100644 --- a/application/forms/Config/Authentication/DbBackendForm.php +++ b/application/forms/Config/Authentication/DbBackendForm.php @@ -77,8 +77,6 @@ class DbBackendForm extends Form 'value' => 'db' ) ); - - return $this; } /** diff --git a/application/forms/Config/Authentication/LdapBackendForm.php b/application/forms/Config/Authentication/LdapBackendForm.php index 9db773708..4e3172ad2 100644 --- a/application/forms/Config/Authentication/LdapBackendForm.php +++ b/application/forms/Config/Authentication/LdapBackendForm.php @@ -96,8 +96,6 @@ class LdapBackendForm extends Form 'value' => 'ldap' ) ); - - return $this; } /** diff --git a/application/forms/Config/AuthenticationBackendConfigForm.php b/application/forms/Config/AuthenticationBackendConfigForm.php index 9068ed25a..e81382cd4 100644 --- a/application/forms/Config/AuthenticationBackendConfigForm.php +++ b/application/forms/Config/AuthenticationBackendConfigForm.php @@ -318,7 +318,5 @@ class AuthenticationBackendConfigForm extends ConfigForm } $this->addElements($this->getBackendForm($backendType)->createElements($formData)->getElements()); - - return $this; } } diff --git a/application/forms/Config/General/ApplicationConfigForm.php b/application/forms/Config/General/ApplicationConfigForm.php index fda695886..5f592eefc 100644 --- a/application/forms/Config/General/ApplicationConfigForm.php +++ b/application/forms/Config/General/ApplicationConfigForm.php @@ -112,7 +112,5 @@ class ApplicationConfigForm extends Form ) ); } - - return $this; } } diff --git a/application/forms/Config/General/LoggingConfigForm.php b/application/forms/Config/General/LoggingConfigForm.php index 135dd9e28..33e182b5d 100644 --- a/application/forms/Config/General/LoggingConfigForm.php +++ b/application/forms/Config/General/LoggingConfigForm.php @@ -102,8 +102,6 @@ class LoggingConfigForm extends Form ) ); } - - return $this; } /** diff --git a/application/forms/Config/GeneralConfigForm.php b/application/forms/Config/GeneralConfigForm.php index ffb0a7d1c..550fe4cfb 100644 --- a/application/forms/Config/GeneralConfigForm.php +++ b/application/forms/Config/GeneralConfigForm.php @@ -33,8 +33,6 @@ class GeneralConfigForm extends ConfigForm $loggingConfigForm = new LoggingConfigForm(); $this->addElements($appConfigForm->createElements($formData)->getElements()); $this->addElements($loggingConfigForm->createElements($formData)->getElements()); - - return $this; } /** diff --git a/application/forms/Config/Resource/DbResourceForm.php b/application/forms/Config/Resource/DbResourceForm.php index 4fd7297d9..136e9e645 100644 --- a/application/forms/Config/Resource/DbResourceForm.php +++ b/application/forms/Config/Resource/DbResourceForm.php @@ -92,8 +92,6 @@ class DbResourceForm extends Form 'description' => t('The password to use for authentication') ) ); - - return $this; } /** diff --git a/application/forms/Config/Resource/FileResourceForm.php b/application/forms/Config/Resource/FileResourceForm.php index d1d33a749..2654ad949 100644 --- a/application/forms/Config/Resource/FileResourceForm.php +++ b/application/forms/Config/Resource/FileResourceForm.php @@ -44,7 +44,5 @@ class FileResourceForm extends Form 'description' => t('The regular expression by which to identify columns') ) ); - - return $this; } } diff --git a/application/forms/Config/Resource/LdapResourceForm.php b/application/forms/Config/Resource/LdapResourceForm.php index 6196f3a17..752516956 100644 --- a/application/forms/Config/Resource/LdapResourceForm.php +++ b/application/forms/Config/Resource/LdapResourceForm.php @@ -78,8 +78,6 @@ class LdapResourceForm extends Form 'description' => t('The password to use for querying the ldap server') ) ); - - return $this; } /** diff --git a/application/forms/Config/Resource/LivestatusResourceForm.php b/application/forms/Config/Resource/LivestatusResourceForm.php index 92534f220..ad0b382c2 100644 --- a/application/forms/Config/Resource/LivestatusResourceForm.php +++ b/application/forms/Config/Resource/LivestatusResourceForm.php @@ -39,8 +39,6 @@ class LivestatusResourceForm extends Form 'value' => realpath(Icinga::app()->getApplicationDir() . '/../var/rw/livestatus') ) ); - - return $this; } /** diff --git a/application/forms/Config/Resource/StatusdatResourceForm.php b/application/forms/Config/Resource/StatusdatResourceForm.php index f150056d1..15563ff39 100644 --- a/application/forms/Config/Resource/StatusdatResourceForm.php +++ b/application/forms/Config/Resource/StatusdatResourceForm.php @@ -48,7 +48,5 @@ class StatusdatResourceForm extends Form 'validators' => array(new ReadablePathValidator()) ) ); - - return $this; } } diff --git a/application/forms/Config/ResourceConfigForm.php b/application/forms/Config/ResourceConfigForm.php index d9ec4dad3..8e677cf8b 100644 --- a/application/forms/Config/ResourceConfigForm.php +++ b/application/forms/Config/ResourceConfigForm.php @@ -252,7 +252,5 @@ class ResourceConfigForm extends ConfigForm } $this->addElements($this->getResourceForm($resourceType)->createElements($formData)->getElements()); - - return $this; } } diff --git a/application/forms/Dashboard/AddUrlForm.php b/application/forms/Dashboard/AddUrlForm.php index 51130bb11..88195654d 100644 --- a/application/forms/Dashboard/AddUrlForm.php +++ b/application/forms/Dashboard/AddUrlForm.php @@ -100,8 +100,6 @@ class AddUrlForm extends Form 'helptext' => t('The title for the dashlet') ) ); - - return $this; } /** diff --git a/application/forms/PreferenceForm.php b/application/forms/PreferenceForm.php index f01f4e337..cdb6ff288 100644 --- a/application/forms/PreferenceForm.php +++ b/application/forms/PreferenceForm.php @@ -206,8 +206,6 @@ class PreferenceForm extends Form 'label' => t('Use benchmark') ) ); - - return $this; } /** diff --git a/library/Icinga/Web/Form.php b/library/Icinga/Web/Form.php index 8f3a47f64..61d75e3af 100644 --- a/library/Icinga/Web/Form.php +++ b/library/Icinga/Web/Form.php @@ -304,8 +304,8 @@ class Form extends Zend_Form public function create(array $formData = array()) { if (false === $this->created) { - $this->createElements($formData) - ->addFormIdentification() + $this->createElements($formData); + $this->addFormIdentification() ->addCsrfCounterMeasure() ->addSubmitButton(); @@ -327,12 +327,10 @@ class Form extends Zend_Form * Intended to be implemented by concrete form classes. * * @param array $formData The data sent by the user - * - * @return self */ public function createElements(array $formData) { - return $this; + } /** diff --git a/modules/monitoring/application/forms/Config/BackendConfigForm.php b/modules/monitoring/application/forms/Config/BackendConfigForm.php index 84f68b57e..e2cdf210c 100644 --- a/modules/monitoring/application/forms/Config/BackendConfigForm.php +++ b/modules/monitoring/application/forms/Config/BackendConfigForm.php @@ -238,7 +238,5 @@ class BackendConfigForm extends ConfigForm 'multiOptions' => $this->resources[$resourceType] ) ); - - return $this; } } diff --git a/modules/monitoring/application/forms/Config/Instance/LocalInstanceForm.php b/modules/monitoring/application/forms/Config/Instance/LocalInstanceForm.php index 513ba2433..6f0d37e25 100644 --- a/modules/monitoring/application/forms/Config/Instance/LocalInstanceForm.php +++ b/modules/monitoring/application/forms/Config/Instance/LocalInstanceForm.php @@ -31,7 +31,5 @@ class LocalInstanceForm extends Form 'description' => t('The file path where the icinga commandpipe can be found') ) ); - - return $this; } } diff --git a/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php b/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php index 0e78a0aec..36991425b 100644 --- a/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php +++ b/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php @@ -62,7 +62,5 @@ class RemoteInstanceForm extends Form 'description' => t('The file path where the icinga commandpipe can be found') ) ); - - return $this; } } diff --git a/modules/monitoring/application/forms/Config/InstanceConfigForm.php b/modules/monitoring/application/forms/Config/InstanceConfigForm.php index 011284a9a..6f8d04764 100644 --- a/modules/monitoring/application/forms/Config/InstanceConfigForm.php +++ b/modules/monitoring/application/forms/Config/InstanceConfigForm.php @@ -205,7 +205,5 @@ class InstanceConfigForm extends ConfigForm ); $this->addElements($this->getInstanceForm($instanceType)->createElements($formData)->getElements()); - - return $this; } } diff --git a/modules/monitoring/application/forms/Config/SecurityConfigForm.php b/modules/monitoring/application/forms/Config/SecurityConfigForm.php index 33a03328e..a164766cc 100644 --- a/modules/monitoring/application/forms/Config/SecurityConfigForm.php +++ b/modules/monitoring/application/forms/Config/SecurityConfigForm.php @@ -62,7 +62,5 @@ class SecurityConfigForm extends ConfigForm . ' Existance of those custom variables will be shown, but their values will be masked.' ) ); - - return $this; } }