Hi all,
Here's a quick question... is it a good idea to enforce the type of value that can be stored in a particular object property or attribute? i.e. the setter function forces a passed value to be an integer or a string, or perhaps verifies that the value is a particular kind of class. For example:
Is this good practice or overkill? Opinions?PHP Code:public function setSomething($something)
{
$this->something = (string) $something;
}
Great forums by the way, glad I found them!![]()
Cheers,
{R}





Bookmarks