On Mon, Feb 2, 2015 at 10:12 PM, Andrea Faulds <a...@ajf.me> wrote: > Hi Dmitry, > > > On 2 Feb 2015, at 18:22, Dmitry Stogov <dmi...@zend.com> wrote: > > > > So, one of the advantages of strict type hinting is the ability to catch > potential errors. > > For example when we pass 67 to setBody(string $message). > > Yes, that sort of thing is easily caught by strict type checks. They’re > also able to catch things that are sometimes okay for weak hints, sometimes > not. For example, some *but not all* strings are accepted for integer and > float parameters, and some *but not all* floats are accepted for integer > parameters. Strict checks make this much simpler and not dependant on the > value: either some type is accepted, or it isn’t. >
Agree. Strict type checks are simple and may be implemented more efficient. But in case we have to support both - weak and strict, this won't make any advantage. > > Because of that, strict types can actually be effectively analysed > ahead-of-time by static analysers, IDEs and so on, and so you can catch > some types of errors while editing your code, without even needing to run > it. This is quite a powerful feature. Nikita might have more to say on that. > Static analyzers can work with weak conversion rules as well. Anyway, this is not directly related to run-time semantic we discuss now. Thanks. Dmitry. > > Thanks. > -- > Andrea Faulds > http://ajf.me/ > > > > >