laminas-filter
laminas-filter copied to clipboard
ToString filter missing?
Feature Request
Laminas-filter component has ToFloat, ToInt and ToNull filters but ToString
is missing.
Q | A |
---|---|
New Feature | yes |
RFC | no |
BC Break | no |
Summary
This filter should be similar as ToInt
:
class ToString extends AbstractFilter
{
public function filter($value)
{
if (
is_scalar($value)
|| $value === null
|| $value instanceof Stringable
) {
return (string) $value;
}
return $value;
}
}
Your opinions?
Send a patch with tests and it shall be added 👍