[Config] fix return type declarations
This commit is contained in:
parent
05fe553666
commit
9c63be489e
@ -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.
|
* 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.
|
* 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.
|
* 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.
|
* 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)
|
protected function preNormalize($value)
|
||||||
{
|
{
|
||||||
|
@ -49,21 +49,37 @@ abstract class BaseNode implements NodeInterface
|
|||||||
$this->parent = $parent;
|
$this->parent = $parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $key
|
||||||
|
*/
|
||||||
public function setAttribute($key, $value)
|
public function setAttribute($key, $value)
|
||||||
{
|
{
|
||||||
$this->attributes[$key] = $value;
|
$this->attributes[$key] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $key
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
public function getAttribute($key, $default = null)
|
public function getAttribute($key, $default = null)
|
||||||
{
|
{
|
||||||
return isset($this->attributes[$key]) ? $this->attributes[$key] : $default;
|
return isset($this->attributes[$key]) ? $this->attributes[$key] : $default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $key
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public function hasAttribute($key)
|
public function hasAttribute($key)
|
||||||
{
|
{
|
||||||
return isset($this->attributes[$key]);
|
return isset($this->attributes[$key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function getAttributes()
|
public function getAttributes()
|
||||||
{
|
{
|
||||||
return $this->attributes;
|
return $this->attributes;
|
||||||
@ -74,6 +90,9 @@ abstract class BaseNode implements NodeInterface
|
|||||||
$this->attributes = $attributes;
|
$this->attributes = $attributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $key
|
||||||
|
*/
|
||||||
public function removeAttribute($key)
|
public function removeAttribute($key)
|
||||||
{
|
{
|
||||||
unset($this->attributes[$key]);
|
unset($this->attributes[$key]);
|
||||||
@ -92,7 +111,7 @@ abstract class BaseNode implements NodeInterface
|
|||||||
/**
|
/**
|
||||||
* Returns info message.
|
* Returns info message.
|
||||||
*
|
*
|
||||||
* @return string The info text
|
* @return string|null The info text
|
||||||
*/
|
*/
|
||||||
public function getInfo()
|
public function getInfo()
|
||||||
{
|
{
|
||||||
@ -112,7 +131,7 @@ abstract class BaseNode implements NodeInterface
|
|||||||
/**
|
/**
|
||||||
* Retrieves the example configuration for this node.
|
* Retrieves the example configuration for this node.
|
||||||
*
|
*
|
||||||
* @return string|array The example
|
* @return string|array|null The example
|
||||||
*/
|
*/
|
||||||
public function getExample()
|
public function getExample()
|
||||||
{
|
{
|
||||||
|
@ -78,7 +78,7 @@ class PrototypedArrayNode extends ArrayNode
|
|||||||
/**
|
/**
|
||||||
* Retrieves the name of the attribute which value should be used as key.
|
* 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()
|
public function getKeyAttribute()
|
||||||
{
|
{
|
||||||
|
@ -152,7 +152,7 @@ class XmlUtils
|
|||||||
* @param \DOMElement $element A \DOMElement instance
|
* @param \DOMElement $element A \DOMElement instance
|
||||||
* @param bool $checkPrefix Check prefix in an element or an attribute name
|
* @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)
|
public static function convertDomElementToArray(\DOMElement $element, $checkPrefix = true)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user