Permalink
Browse files

Some minor CS improvements to FormHelper

Replaced use of deprecated method getVar by get.
Improved DocBocks, mostly data types
Removed deprecated DocBock tag because it's an invalid use of such. This makes the method look like it was deprecated but in reality it's only one of the possible values of one of its parameters.
  • Loading branch information...
1 parent 4f745a4 commit 11eeb33644c63f1049ed56c7608abe84144f5fa7 @ravage84 ravage84 committed Jul 6, 2013
Showing with 17 additions and 18 deletions.
  1. +17 −18 lib/Cake/View/Helper/FormHelper.php
@@ -599,9 +599,9 @@ public function unlockField($name = null) {
*
* @param boolean $lock Whether this field should be part of the validation
* or excluded as part of the unlockedFields.
- * @param string|array $field Reference to field to be secured. Should be dot separated to indicate nesting.
+ * @param string $field Reference to field to be secured. Should be dot separated to indicate nesting.
* @param mixed $value Field value, if value should not be tampered with.
- * @return void
+ * @return mixed|null Not used yet
*/
protected function _secure($lock, $field = null, $value = null) {
if (!$field) {
@@ -1029,8 +1029,8 @@ public function input($fieldName, $options = array()) {
/**
* Generates an input element
*
- * @param type $args
- * @return type
+ * @param array $args The options for the input element
+ * @return string The generated input element
*/
protected function _getInput($args) {
extract($args);
@@ -1069,7 +1069,7 @@ protected function _getInput($args) {
/**
* Generates input options array
*
- * @param type $options
+ * @param array $options
* @return array Options
*/
protected function _parseOptions($options) {
@@ -1100,7 +1100,7 @@ protected function _parseOptions($options) {
/**
* Generates list of options for multiple select
*
- * @param type $options
+ * @param array $options
* @return array
*/
protected function _optionsOptions($options) {
@@ -1110,7 +1110,7 @@ protected function _optionsOptions($options) {
$varName = Inflector::variable(
Inflector::pluralize(preg_replace('/_id$/', '', $this->field()))
);
- $varOptions = $this->_View->getVar($varName);
+ $varOptions = $this->_View->get($varName);
if (!is_array($varOptions)) {
return $options;
}
@@ -1124,7 +1124,7 @@ protected function _optionsOptions($options) {
/**
* Magically set option type and corresponding options
*
- * @param type $options
+ * @param array $options
* @return array
*/
protected function _magicOptions($options) {
@@ -1192,7 +1192,7 @@ protected function _magicOptions($options) {
/**
* Generate format options
*
- * @param type $options
+ * @param array $options
* @return array
*/
protected function _getFormat($options) {
@@ -1211,8 +1211,8 @@ protected function _getFormat($options) {
/**
* Generate label for input
*
- * @param type $fieldName
- * @param type $options
+ * @param string $fieldName
+ * @param array $options
* @return boolean|string false or Generated label element
*/
protected function _getLabel($fieldName, $options) {
@@ -1234,7 +1234,7 @@ protected function _getLabel($fieldName, $options) {
/**
* Calculates maxlength option
*
- * @param type $options
+ * @param array $options
* @return array
*/
protected function _maxLength($options) {
@@ -1310,9 +1310,8 @@ protected function _extractOption($name, $options, $default = null) {
*
* @param string $fieldName
* @param string $label
- * @param array $options Options for the label element.
+ * @param array $options Options for the label element. 'NONE' option is deprecated and will be removed in 3.0
* @return string Generated label element
- * @deprecated 'NONE' option is deprecated and will be removed in 3.0
*/
protected function _inputLabel($fieldName, $label, $options) {
$labelAttributes = $this->domId(array(), 'for');
@@ -1739,7 +1738,7 @@ public function postButton($title, $url, $options = array()) {
* @param string $title The content to be wrapped by <a> tags.
* @param string|array $url Cake-relative URL or array of URL parameters, or external URL (starts with http://)
* @param array $options Array of HTML attributes.
- * @param string $confirmMessage JavaScript confirmation message.
+ * @param bool|string $confirmMessage JavaScript confirmation message.
* @return string An `<a />` element.
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper::postLink
*/
@@ -2234,7 +2233,7 @@ public function hour($fieldName, $format24Hours = false, $attributes = array())
* - `value` The selected value of the input.
*
* @param string $fieldName Prefix name for the SELECT element
- * @param string $attributes Array of Attributes
+ * @param array $attributes Array of Attributes
* @return string Completed minute select input.
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper::minute
*/
@@ -2294,7 +2293,7 @@ protected function _dateTimeSelected($select, $fieldName, $attributes) {
* - `value` The selected value of the input.
*
* @param string $fieldName Prefix name for the SELECT element
- * @param string $attributes Array of Attributes
+ * @param array|string $attributes Array of Attributes
* @return string Completed meridian select input
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper::meridian
*/
@@ -2344,7 +2343,7 @@ public function meridian($fieldName, $attributes = array()) {
* @param string $fieldName Prefix name for the SELECT element
* @param string $dateFormat DMY, MDY, YMD, or null to not generate date inputs.
* @param string $timeFormat 12, 24, or null to not generate time inputs.
- * @param string $attributes array of Attributes
+ * @param array|string $attributes array of Attributes
* @return string Generated set of select boxes for the date and time formats chosen.
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper::dateTime
*/

0 comments on commit 11eeb33

Please sign in to comment.