On 4 November 2014 10:32, Andrea Faulds <a...@ajf.me> wrote: > > > On 4 Nov 2014, at 08:51, Stas Malyshev <smalys...@sugarcrm.com> wrote: > > > > I agree, this is not a very good situation. It would be much better to > > take a systematic approach to this, but this is impossible since there > > is no systematic approach to strict typing in PHP, just some pieces here > > and there. I think this is not right, but obviously many people here > > disagree and are happy to have the inconsistent syntax. I don't see why > > "public Foo function bar()" would be so much worse than "public function > > bar() : Foo" but for some reason this possibility wasn't even > > considered as far as I can see. > I thought it was inconsistent, but after discussions on StackOverflow, I > don't think it actually is. Return types describe the return type of a > function, not the type of a function. So there's no reason they have to go > before the function name like parameter types do. > > So, in a sentence:
In PHP, input types go on the left and output types go on the right. This sounds like a convention that could be established and followed, and no-one could reasonably call it inconsistent if it was adhered to.