Re: Class Properties in Interfaces?

From: Date: Sun, 18 May 2008 11:20:00 +0000
Subject: Re: Class Properties in Interfaces?
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  Groups: php.internals 
Request: Send a blank email to internals+get-37699@lists.php.net to get a copy of this message
Hello Christian, Wednesday, May 14, 2008, 10:57:24 AM, you wrote: > 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. Not allowing unset() is the bug. Having unset delete the property would be the error. As long as the property still exists with value NULL all is fine. > 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 Best regards, Marcus

« previous php.internals (#37699) next »