@@ -233,13 +233,12 @@ public function getForm($need = TRUE)
233233 * @param string label
234234 * @param int width of the control (deprecated)
235235 * @param int maximum number of characters the user may enter
236- * @return Nette\Forms\ Controls\TextInput
236+ * @return Controls\TextInput
237237 */
238238 public function addText ($ name , $ label = NULL , $ cols = NULL , $ maxLength = NULL )
239239 {
240- $ control = new Controls \TextInput ($ label , $ maxLength );
241- $ control ->setAttribute ('size ' , $ cols );
242- return $ this [$ name ] = $ control ;
240+ return $ this [$ name ] = (new Controls \TextInput ($ label , $ maxLength ))
241+ ->setAttribute ('size ' , $ cols );
243242 }
244243
245244
@@ -249,13 +248,13 @@ public function addText($name, $label = NULL, $cols = NULL, $maxLength = NULL)
249248 * @param string label
250249 * @param int width of the control (deprecated)
251250 * @param int maximum number of characters the user may enter
252- * @return Nette\Forms\ Controls\TextInput
251+ * @return Controls\TextInput
253252 */
254253 public function addPassword ($ name , $ label = NULL , $ cols = NULL , $ maxLength = NULL )
255254 {
256- $ control = new Controls \TextInput ($ label , $ maxLength );
257- $ control ->setAttribute ('size ' , $ cols );
258- return $ this [ $ name ] = $ control ->setType ('password ' );
255+ return $ this [ $ name ] = ( new Controls \TextInput ($ label , $ maxLength ))
256+ ->setAttribute ('size ' , $ cols )
257+ ->setType ('password ' );
259258 }
260259
261260
@@ -265,13 +264,12 @@ public function addPassword($name, $label = NULL, $cols = NULL, $maxLength = NUL
265264 * @param string label
266265 * @param int width of the control
267266 * @param int height of the control in text lines
268- * @return Nette\Forms\ Controls\TextArea
267+ * @return Controls\TextArea
269268 */
270269 public function addTextArea ($ name , $ label = NULL , $ cols = NULL , $ rows = NULL )
271270 {
272- $ control = new Controls \TextArea ($ label );
273- $ control ->setAttribute ('cols ' , $ cols )->setAttribute ('rows ' , $ rows );
274- return $ this [$ name ] = $ control ;
271+ return $ this [$ name ] = (new Controls \TextArea ($ label ))
272+ ->setAttribute ('cols ' , $ cols )->setAttribute ('rows ' , $ rows );
275273 }
276274
277275
@@ -280,7 +278,7 @@ public function addTextArea($name, $label = NULL, $cols = NULL, $rows = NULL)
280278 * @param string control name
281279 * @param string label
282280 * @param bool allows to upload multiple files
283- * @return Nette\Forms\ Controls\UploadControl
281+ * @return Controls\UploadControl
284282 */
285283 public function addUpload ($ name , $ label = NULL , $ multiple = FALSE )
286284 {
@@ -292,7 +290,7 @@ public function addUpload($name, $label = NULL, $multiple = FALSE)
292290 * Adds control that allows the user to upload multiple files.
293291 * @param string control name
294292 * @param string label
295- * @return Nette\Forms\ Controls\UploadControl
293+ * @return Controls\UploadControl
296294 */
297295 public function addMultiUpload ($ name , $ label = NULL )
298296 {
@@ -304,21 +302,20 @@ public function addMultiUpload($name, $label = NULL)
304302 * Adds hidden form control used to store a non-displayed value.
305303 * @param string control name
306304 * @param mixed default value
307- * @return Nette\Forms\ Controls\HiddenField
305+ * @return Controls\HiddenField
308306 */
309307 public function addHidden ($ name , $ default = NULL )
310308 {
311- $ control = new Controls \HiddenField ;
312- $ control ->setDefaultValue ($ default );
313- return $ this [$ name ] = $ control ;
309+ return $ this [$ name ] = (new Controls \HiddenField )
310+ ->setDefaultValue ($ default );
314311 }
315312
316313
317314 /**
318315 * Adds check box control to the form.
319316 * @param string control name
320317 * @param string caption
321- * @return Nette\Forms\ Controls\Checkbox
318+ * @return Controls\Checkbox
322319 */
323320 public function addCheckbox ($ name , $ caption = NULL )
324321 {
@@ -331,7 +328,7 @@ public function addCheckbox($name, $caption = NULL)
331328 * @param string control name
332329 * @param string label
333330 * @param array options from which to choose
334- * @return Nette\Forms\ Controls\RadioList
331+ * @return Controls\RadioList
335332 */
336333 public function addRadioList ($ name , $ label = NULL , array $ items = NULL )
337334 {
@@ -341,7 +338,7 @@ public function addRadioList($name, $label = NULL, array $items = NULL)
341338
342339 /**
343340 * Adds set of checkbox controls to the form.
344- * @return Nette\Forms\ Controls\CheckboxList
341+ * @return Controls\CheckboxList
345342 */
346343 public function addCheckboxList ($ name , $ label = NULL , array $ items = NULL )
347344 {
@@ -355,15 +352,12 @@ public function addCheckboxList($name, $label = NULL, array $items = NULL)
355352 * @param string label
356353 * @param array items from which to choose
357354 * @param int number of rows that should be visible
358- * @return Nette\Forms\ Controls\SelectBox
355+ * @return Controls\SelectBox
359356 */
360357 public function addSelect ($ name , $ label = NULL , array $ items = NULL , $ size = NULL )
361358 {
362- $ control = new Controls \SelectBox ($ label , $ items );
363- if ($ size > 1 ) {
364- $ control ->setAttribute ('size ' , (int ) $ size );
365- }
366- return $ this [$ name ] = $ control ;
359+ return $ this [$ name ] = (new Controls \SelectBox ($ label , $ items ))
360+ ->setAttribute ('size ' , $ size > 1 ? (int ) $ size : NULL );
367361 }
368362
369363
@@ -373,23 +367,20 @@ public function addSelect($name, $label = NULL, array $items = NULL, $size = NUL
373367 * @param string label
374368 * @param array options from which to choose
375369 * @param int number of rows that should be visible
376- * @return Nette\Forms\ Controls\MultiSelectBox
370+ * @return Controls\MultiSelectBox
377371 */
378372 public function addMultiSelect ($ name , $ label = NULL , array $ items = NULL , $ size = NULL )
379373 {
380- $ control = new Controls \MultiSelectBox ($ label , $ items );
381- if ($ size > 1 ) {
382- $ control ->setAttribute ('size ' , (int ) $ size );
383- }
384- return $ this [$ name ] = $ control ;
374+ return $ this [$ name ] = (new Controls \MultiSelectBox ($ label , $ items ))
375+ ->setAttribute ('size ' , $ size > 1 ? (int ) $ size : NULL );
385376 }
386377
387378
388379 /**
389380 * Adds button used to submit form.
390381 * @param string control name
391382 * @param string caption
392- * @return Nette\Forms\ Controls\SubmitButton
383+ * @return Controls\SubmitButton
393384 */
394385 public function addSubmit ($ name , $ caption = NULL )
395386 {
@@ -401,7 +392,7 @@ public function addSubmit($name, $caption = NULL)
401392 * Adds push buttons with no default behavior.
402393 * @param string control name
403394 * @param string caption
404- * @return Nette\Forms\ Controls\Button
395+ * @return Controls\Button
405396 */
406397 public function addButton ($ name , $ caption = NULL )
407398 {
@@ -414,7 +405,7 @@ public function addButton($name, $caption = NULL)
414405 * @param string control name
415406 * @param string URI of the image
416407 * @param string alternate text for the image
417- * @return Nette\Forms\ Controls\ImageButton
408+ * @return Controls\ImageButton
418409 */
419410 public function addImage ($ name , $ src = NULL , $ alt = NULL )
420411 {
0 commit comments