S.A.N, > The main advantage of the two syntaxes: > > 1. Strict > function bar(int $num){} > > 2. Weak > function bar((int) $num){} > > Any junior-middle PHP developer, seeing this syntax in the code can > understand how it works, without studying the documentation and without > your complex conversion tables. > >Explicit is better than implicit, is the motto Python, here it is very >relevant.
Just listing the advantages of the withdrawn ircmaxwell's RFC https://wiki.php.net/rfc/parameter_type_casting_hints over this one (both v0.1 and v0.2): 1. No BC breaks (classes named int, float, string would not become reserved) 2. More semantic and explicit (just like S.A.N said) 3. Will not block possible strict typing RFCs to get voted in the future 4. No reserved words added 5. Minimalist implementation (no runtime flags, configurations, etc) I'm not trying to highjack the topic here... just adding an alternative to an RFC that seems to become more and more polemic with both sides unsatisfied :) > I don't think any junior-middle php developer with understand how "(int)" works. > Just make a test and see how many will answer (int)'asd' with 1. Thomas, Actually `(int)'asd'` would be evaluated to 0 ;) ... `(int)'1asd'` would be evaluated to 1, though (I guess that's what you tried to say?). 2015-01-15 18:18 GMT-03:00 S.A.N <ua.san.a...@gmail.com>: > The main advantage of the two syntaxes: > > 1. Strict > function bar(int $num){} > > 2. Weak > function bar((int) $num){} > > Any junior-middle PHP developer, seeing this syntax in the code can > understand how it works, without studying the documentation and without > your complex conversion tables. > > Explicit is better than implicit, is the motto Python, here it is very > relevant. >