Can anyone explain why Zend_Filter_Int
casts the value to string first then int i.e.:
public function filter($value)
{
return (int) ((string) $value);
}
I cant see any reason for this.
Zend_Filter_Int allows you to transform a scalar value which contains into an integer.
Casting the passed in value as a string simply enforces that a scalar value has been passed.
While I'm sure a debate of epic proportions may be had on what constitutes a scalar value. In this context anything that can be cast as a string is scalar. :)