mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-80005 core: Update coding standards for core\param
This commit is contained in:
parent
d937e01550
commit
a61658da17
@ -21,6 +21,8 @@ use core_text;
|
||||
use invalid_parameter_exception;
|
||||
use moodle_exception;
|
||||
|
||||
// phpcs:disable Generic.CodeAnalysis.EmptyStatement.DetectedIf
|
||||
|
||||
/**
|
||||
* Parameter validation helpers for Moodle.
|
||||
*
|
||||
@ -527,7 +529,7 @@ enum param: string {
|
||||
throw new invalid_parameter_exception($debuginfo);
|
||||
}
|
||||
}
|
||||
if (is_array($param) or is_object($param)) {
|
||||
if (is_array($param) || is_object($param)) {
|
||||
throw new invalid_parameter_exception($debuginfo);
|
||||
}
|
||||
|
||||
@ -535,9 +537,9 @@ enum param: string {
|
||||
|
||||
if ($this->canonical() === self::FLOAT) {
|
||||
// Do not detect precision loss here.
|
||||
if (is_float($param) or is_int($param)) {
|
||||
if (is_float($param) || is_int($param)) {
|
||||
// These always fit.
|
||||
} else if (!is_numeric($param) or !preg_match('/^[\+-]?[0-9]*\.?[0-9]*(e[-+]?[0-9]+)?$/i', (string)$param)) {
|
||||
} else if (!is_numeric($param) || !preg_match('/^[\+-]?[0-9]*\.?[0-9]*(e[-+]?[0-9]+)?$/i', (string)$param)) {
|
||||
throw new invalid_parameter_exception($debuginfo);
|
||||
}
|
||||
} else if ((string) $param !== (string) $cleaned) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user