-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Config] finish adding parameter types #32286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,11 +66,9 @@ public function children() | |
/** | ||
* Sets a prototype for child nodes. | ||
* | ||
* @param string $type The type of node | ||
* | ||
* @return NodeDefinition | ||
*/ | ||
public function prototype($type) | ||
public function prototype(string $type) | ||
{ | ||
return $this->prototype = $this->getNodeBuilder()->node(null, $type)->setParent($this); | ||
} | ||
|
@@ -194,12 +192,12 @@ public function disallowNewKeysInSubsequentConfigs() | |
/** | ||
* Sets a normalization rule for XML configurations. | ||
* | ||
* @param string $singular The key to remap | ||
* @param string $plural The plural of the key for irregular plurals | ||
* @param string $singular The key to remap | ||
* @param string|null $plural The plural of the key for irregular plurals | ||
* | ||
* @return $this | ||
*/ | ||
public function fixXmlConfig($singular, $plural = null) | ||
public function fixXmlConfig(string $singular, string $plural = null) | ||
{ | ||
$this->normalization()->remap($singular, $plural); | ||
|
||
|
@@ -234,7 +232,7 @@ public function fixXmlConfig($singular, $plural = null) | |
* | ||
* @return $this | ||
*/ | ||
public function useAttributeAsKey($name, $removeKeyItem = true) | ||
public function useAttributeAsKey(string $name, bool $removeKeyItem = true) | ||
{ | ||
$this->key = $name; | ||
$this->removeKeyItem = $removeKeyItem; | ||
|
@@ -245,11 +243,9 @@ public function useAttributeAsKey($name, $removeKeyItem = true) | |
/** | ||
* Sets whether the node can be unset. | ||
* | ||
* @param bool $allow | ||
* | ||
* @return $this | ||
*/ | ||
public function canBeUnset($allow = true) | ||
public function canBeUnset(bool $allow = true) | ||
{ | ||
$this->merge()->allowUnset($allow); | ||
|
||
|
@@ -341,7 +337,7 @@ public function performNoDeepMerging() | |
* | ||
* @return $this | ||
*/ | ||
public function ignoreExtraKeys($remove = true) | ||
public function ignoreExtraKeys(bool $remove = true) | ||
{ | ||
$this->ignoreExtraKeys = true; | ||
$this->removeExtraKeys = $remove; | ||
|
@@ -350,15 +346,13 @@ public function ignoreExtraKeys($remove = true) | |
} | ||
|
||
/** | ||
* Sets key normalization. | ||
* | ||
* @param bool $bool Whether to enable key normalization | ||
* Sets whether to enable key normalization. | ||
* | ||
* @return $this | ||
*/ | ||
public function normalizeKeys($bool) | ||
public function normalizeKeys(bool $bool) | ||
{ | ||
$this->normalizeKeys = (bool) $bool; | ||
$this->normalizeKeys = $bool; | ||
|
||
return $this; | ||
} | ||
|
@@ -417,6 +411,10 @@ protected function createNode() | |
} | ||
|
||
if ($this->default) { | ||
if (!\is_array($this->defaultValue)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. only for 5? missing deprecation in 4.4? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just moved the check from |
||
throw new \InvalidArgumentException($node->getPath().': the default value of an array node has to be an array.'); | ||
Tobion marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
$node->setDefaultValue($this->defaultValue); | ||
} | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.