Re: Class Properties in Interfaces?

From: Date: Wed, 14 May 2008 08:57:24 +0000
Subject: Re: Class Properties in Interfaces?
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14  Groups: php.internals 
Request: Send a blank email to internals+get-37643@lists.php.net to get a copy of this message
Am 14.05.2008 um 02:06 schrieb Marcus Boerger:
So you are saying that
       $o_Foo->bar = array(42);
is ok when the class "expects" a string but
       unset($o_Foo->bar);
or (as as slight variation)
       $o->Foo->bar = null;
is not?
I Do not get the connection here? And since when can we 'expect' a string only for a property?
You stated that allowing unset() is a bug. I replied that unset() is not different from setting the value to array(42) or null and should be allowed. Apropos 'expect': A programmer of a class can have some expectations of what is stored in attributes, PHP does not enforce these expectations (hence I put expect in quotes). And just to make it clear: I want to keep it that way, I do not want PHP to become more strict than it is. So I completely agree with Stas here. - Chris

« previous php.internals (#37643) next »