I am trying to store all the attribute predicates within a static array in PHP:
public static $attributeValidation = [
"attribute1" => function ($value) {
return is_bool($value);
},"attribute2" => function ($value) {
return is_int($value);
},
];
I am getting this following error:
expression is not allowed as default field value.
The goal is to simplify attribute validation by using
$attributeValidation["attribute"]($someValue);
Is there a way to accomplish this without using a local/private variables?