ZF-3779: Zend_Locale : some methods accept object or string and are not properly coded


Zend_Locale's constructor docblock says

@param  string $locale (Optional) Locale for parsing input

The constructor looks for a string, but also looks for a Zend_Locale object to call its toString() method. The docblock should reflect that fact.

Same (revert) for the setDefault() method, docblock says

@param  string|Zend_Locale $locale Locale to set

But this time, the method doesn't accept a Zend_Locale object as param, it should ( calling its toString() method).


Just because the Docblock is wrong, you can not say that the complete class is coded wrong :-) I think this is a hard word ;-)

Related to your second example you are wrong. Looking at the code you can see that the locale is casted to a string which does exactly the same as calling toString but is a little more performant.

I will correct the docblock.

I did not say the complete class is wrong, perhaps my english sentence meant that, so I apologyze :-D

For my second example, I'm sorry I'm right, I'm really talking about setDefault() method, not the setLocale() method ( whitch effectively casts to string like you say )

Fixed with r10510

Updating for the 1.6.0 release.