[Config] fix return type declarations

This commit is contained in:
Alexander M. Turek 2019-08-23 21:10:16 +02:00 committed by Nicolas Grekas
parent 05fe553666
commit 9c63be489e
4 changed files with 24 additions and 9 deletions

View File

@ -38,17 +38,13 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
}
/**
* Normalizes keys between the different configuration formats.
* {@inheritdoc}
*
* Namely, you mostly have foo_bar in YAML while you have foo-bar in XML.
* After running this method, all keys are normalized to foo_bar.
*
* If you have a mixed key like foo-bar_moo, it will not be altered.
* The key will also not be altered if the target key already exists.
*
* @param mixed $value
*
* @return array The value with normalized keys
*/
protected function preNormalize($value)
{

View File

@ -49,21 +49,37 @@ abstract class BaseNode implements NodeInterface
$this->parent = $parent;
}
/**
* @param string $key
*/
public function setAttribute($key, $value)
{
$this->attributes[$key] = $value;
}
/**
* @param string $key
*
* @return mixed
*/
public function getAttribute($key, $default = null)
{
return isset($this->attributes[$key]) ? $this->attributes[$key] : $default;
}
/**
* @param string $key
*
* @return bool
*/
public function hasAttribute($key)
{
return isset($this->attributes[$key]);
}
/**
* @return array
*/
public function getAttributes()
{
return $this->attributes;
@ -74,6 +90,9 @@ abstract class BaseNode implements NodeInterface
$this->attributes = $attributes;
}
/**
* @param string $key
*/
public function removeAttribute($key)
{
unset($this->attributes[$key]);
@ -92,7 +111,7 @@ abstract class BaseNode implements NodeInterface
/**
* Returns info message.
*
* @return string The info text
* @return string|null The info text
*/
public function getInfo()
{
@ -112,7 +131,7 @@ abstract class BaseNode implements NodeInterface
/**
* Retrieves the example configuration for this node.
*
* @return string|array The example
* @return string|array|null The example
*/
public function getExample()
{

View File

@ -78,7 +78,7 @@ class PrototypedArrayNode extends ArrayNode
/**
* Retrieves the name of the attribute which value should be used as key.
*
* @return string The name of the attribute
* @return string|null The name of the attribute
*/
public function getKeyAttribute()
{

View File

@ -152,7 +152,7 @@ class XmlUtils
* @param \DOMElement $element A \DOMElement instance
* @param bool $checkPrefix Check prefix in an element or an attribute name
*
* @return array A PHP array
* @return mixed
*/
public static function convertDomElementToArray(\DOMElement $element, $checkPrefix = true)
{