Use empty() over === false to also return error in case of empty strings
This commit is contained in:
parent
0fb368b96d
commit
db31822a3f
|
@ -96,7 +96,7 @@ final class MD_STD_IN {
|
||||||
*/
|
*/
|
||||||
public static function sanitize_rgb_color(mixed $input):string {
|
public static function sanitize_rgb_color(mixed $input):string {
|
||||||
|
|
||||||
if (($output = \filter_var($input, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH)) === false) {
|
if (empty($output = \filter_var($input, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH))) {
|
||||||
throw new MDInvalidColorCode("Invalid color code provided: " . $output);
|
throw new MDInvalidColorCode("Invalid color code provided: " . $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user