Re: Call non-static method staticly raise E_STRICT, but why call a static method instancely won't
| From: | Reindl Harald | Date: | Mon, 25 Apr 2011 10:29:35 +0000 |
| Subject: | Re: Call non-static method staticly raise E_STRICT, but why call a static method instancely won't | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-52005@lists.php.net to get a copy of this message | ||
Am 25.04.2011 09:52, schrieb Alessandro Nadalin:
>> Nothing wrong with it.
>>
>> The E_STRICT is raised because when you call a non-static method
>> statically, $this will not be defined and that could be a problem (e.g.
>> the method could rely on it). When you call a static method with ->, it
>> remains a static call, $this will not be defined anyway, and there is
>> absolutely no problem with it.
>
> I can see your point, but I think we should drop this "feature" not to
> let developers have N ways of doing the same things:
why should ANYTHING be dropped affection backward compatibility?
> if you declare a method as static, you should be able to only call it
> with a static call, not hrough an object.
that is a opinion, but not enough to damage BC
> PHP usually lets you do the same thing in a few ways, and that's a bit
> frustrating
there are so naby different woman and cars out there and that's a
bit frustrating - you know what i mean?
> because we should force some kind of best practices for
> the language: not .advise, but *force*
maybe you are using the wrong language if this is your opinion?
nobody says "stop selling guns because somebody can shoot in his foot"
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc