From 763a63764d0bbaf1be3fa1d3d3a6e1daec86410f Mon Sep 17 00:00:00 2001 From: grizzm0 Date: Thu, 6 Mar 2014 08:26:17 +0100 Subject: [PATCH] Default value to labelAttributes and docblock fix for label --- library/Zend/Form/Element.php | 6 +++--- tests/ZendTest/Form/ElementTest.php | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/library/Zend/Form/Element.php b/library/Zend/Form/Element.php index 37e9263c126..a8e616d39c7 100644 --- a/library/Zend/Form/Element.php +++ b/library/Zend/Form/Element.php @@ -24,14 +24,14 @@ class Element implements protected $attributes = array(); /** - * @var string + * @var null|string */ protected $label; /** * @var array */ - protected $labelAttributes; + protected $labelAttributes = array(); /** * @var array Validation error messages @@ -308,7 +308,7 @@ public function setLabel($label) /** * Retrieve the label used for this element * - * @return string + * @return null|string */ public function getLabel() { diff --git a/tests/ZendTest/Form/ElementTest.php b/tests/ZendTest/Form/ElementTest.php index 5aa1672634f..128b804fd17 100644 --- a/tests/ZendTest/Form/ElementTest.php +++ b/tests/ZendTest/Form/ElementTest.php @@ -20,6 +20,12 @@ public function testAttributesAreEmptyByDefault() $this->assertEquals(array(), $element->getAttributes()); } + public function testLabelAttributesAreEmptyByDefault() + { + $element = new Element(); + $this->assertEquals(array(), $element->getLabelAttributes()); + } + public function testCanAddAttributesSingly() { $element = new Element();