limoncello-php / app

Quick start JSON API application
MIT License
83 stars 7 forks source link

assert(static::isValidType($value) === true) #30

Closed dreamsbond closed 7 years ago

dreamsbond commented 7 years ago

@neomerx i am refactoring my existing validation to your new ruleset style. having problem doing test:

assert(): assert(static::isValidType($value) === true) failed

i have no idea yet. any glue?

neomerx commented 7 years ago

This is an assertion within Validation library. It is used in multiple places but all for checking input value is a scalar. Most likely you're trying to use a validation rule for a scalar (e.g. bool, int, float, string, etc) with non-scalar input (e.g. array, DateTime or null). Can you debug the line and see what is inside $value?

dreamsbond commented 7 years ago

it was string string(5) "users" on var_dump($value)

neomerx commented 7 years ago

Hmmm.... "users" is a scalar so assert(is_scalar("users") === true) must be pass without problems. Are you sure it fails with this input?

dreamsbond commented 7 years ago

yes it all returns string... let me check again

neomerx commented 7 years ago

let me know if you still have this issue and it needs to be re-opened.