Skip to content
Snippets Groups Projects
Commit 68af97b4 authored by Florent Torregrosa's avatar Florent Torregrosa
Browse files

Merge branch '3517724-number-prop-validate' into '2.0.x'

Issue #3517724 by grimreaper: Number prop: validate in normalize

See merge request !367
parents b2216dcb 1b7b7bb6
No related branches found
No related tags found
No related merge requests found
Pipeline #467508 failed
......@@ -46,6 +46,14 @@ class NumberPropType extends PropTypePluginBase {
if (NULL === $value) {
return NULL;
}
if (isset($definition['minimum']) && ($value < $definition['minimum'])) {
return NULL;
}
if (isset($definition['maximum']) && ($value > $definition['maximum'])) {
return NULL;
}
$type = (is_array($definition) && isset($definition['type'])) ? $definition['type'] : NULL;
if (($type === 'integer') || (is_array($type) && !in_array('number', $type, TRUE) && in_array('integer', $type, TRUE))) {
return (int) $value;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment