Use empty() over === false to also return error in case of empty strings

This commit is contained in:
Joshua Ramon Enslin 2023-11-10 16:17:20 +01:00
parent 0fb368b96d
commit db31822a3f
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -96,7 +96,7 @@ final class MD_STD_IN {
*/
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);
}