On 12/10/2009 9:21 PM, David Otton wrote:
2009/10/11 Eric Bauman<baum...@livejournal.dk>:
As before, please feel free to insult my code. ;-) Any and all feedback is
of course most appreciated.
I know you're more concerned with structure, but your checkInt()
method is arguably buggy/has an un-noted assumption. It accepts ints
formatted as ints and strings, but not floats:
*sigh* sometimes I really wish PHP allowed one to be a bit more
heavy-handed with types (optional real type hinting would be nice).
I guess I only ever worried about string (from DB) and int (internal
call) as in my specific use I would never be passing a float.
You make an excellent point however; I suppose in the interests of
completeness, forward compatibility etc. I should take into account more
possibilities. Perhaps I should just throw an exception in deposit()
etc. if the argument isn't int and worry about converting elsewhere.
Also thanks for the sample TestCase code! I've never really thought
about unit testing in PHP, despite doing so in Java etc. Reading about
PHPUnit brought me on to phpUnderControl - interesting stuff!
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php