From 9c63be489e42145b2c9b661ea723c543e43b8546 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Fri, 23 Aug 2019 21:10:16 +0200 Subject: [PATCH] [Config] fix return type declarations --- .../Component/Config/Definition/ArrayNode.php | 6 +---- .../Component/Config/Definition/BaseNode.php | 23 +++++++++++++++++-- .../Config/Definition/PrototypedArrayNode.php | 2 +- .../Component/Config/Util/XmlUtils.php | 2 +- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/Config/Definition/ArrayNode.php b/src/Symfony/Component/Config/Definition/ArrayNode.php index 2afa629cda..91160ae009 100644 --- a/src/Symfony/Component/Config/Definition/ArrayNode.php +++ b/src/Symfony/Component/Config/Definition/ArrayNode.php @@ -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) { diff --git a/src/Symfony/Component/Config/Definition/BaseNode.php b/src/Symfony/Component/Config/Definition/BaseNode.php index 2b41efe79e..2b10bffa78 100644 --- a/src/Symfony/Component/Config/Definition/BaseNode.php +++ b/src/Symfony/Component/Config/Definition/BaseNode.php @@ -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() { diff --git a/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php b/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php index 9a14449c48..7b64d842aa 100644 --- a/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php +++ b/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php @@ -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() { diff --git a/src/Symfony/Component/Config/Util/XmlUtils.php b/src/Symfony/Component/Config/Util/XmlUtils.php index 1775cc25fd..d0042af302 100644 --- a/src/Symfony/Component/Config/Util/XmlUtils.php +++ b/src/Symfony/Component/Config/Util/XmlUtils.php @@ -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) {