Re: [RFC] Scalar Type Hints v0.2
| From: | Jordi Boggiano | Date: | Thu, 15 Jan 2015 15:30:57 +0000 |
| Subject: | Re: [RFC] Scalar Type Hints v0.2 | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-80556@lists.php.net to get a copy of this message | ||
On 15/01/2015 15:25, Pavel Kouřil wrote:
The potential issues with this are pretty real, to be honest. Simple things like moving a method from one class to another (let's say to parent or descendant) and getting to another typing context may cause unpredictable behavior if the user forgets to have declare() in both files.Agreed there are gotchas but not only with declare(). Many things can go wrong when you move a function somewhere else, for example you might leave
use statements behind and suddenly a `catch (FooException $e)` will fail to match exceptions or something sneaky like that. I don't necessarily think that's enough to kill the feature.
Note that you can only get problems going from weak to strict context by the way, the other way around should not cause any issues, code would just work when it otherwise would have triggered strict errors. Since you usually move code into places you own, I'd assume you know it if you are using strict typing.
Cheers
--
Jordi Boggiano
@seldaek - http://nelm.io/jordi