Open ncou opened 4 years ago
Sometimes the default value doesn't really follow the rules, for example Expect::string()
has default value null
, but it doesn't allow null
. So it's more like expected behaviour.
Yes you are right, but it seems more logic to enforce the rules if the default value is explicitely defined. And have an error in the illogical cases like Expect::string()->default(123)
Hi,
It seems the controles like min/max or assert() are not appplyed on the default value. This could be problematic if the default value is dynamic.
In my use case i should controle the application key is a hexa 64 chars, and by default we use the environement variable APP_KEY.
I also tryed to move the min/max/assert function after the chained ->default(), but the result is the same :(
return Expect::structure([ 'key' => Expect::xdigit()->min(64)->max(64)->default(env('APP_KEY')), ]);
Is that a bug or an "expected" behaviour ?
Keep up the good work.