On 11/04/2014 10:08 AM, Andrea Faulds wrote: > >> On 4 Nov 2014, at 17:46, Stas Malyshev <smalys...@sugarcrm.com> wrote: >> >> Hi! >> >>>> "public Foo function bar()" would be so much worse than "public function >>>> bar() : Foo" >>> >>> Because when you grep for "function bar", in future you'd have to know >>> the return type too. >> >> Sorry, I do not understand - why to grep for "function bar" you'd have >> to know the type? Just grep for "function bar" as you did before. > > Because if that function has a return type, e.g.: > > public function Foo bar() > > Then you couldn’t grep for “function bar” because of the Foo. > > If we used this syntax instead, which wouldn’t disrupt grep: > > public Foo function bar(); > > It’d be inconsistent with normal function declarations which would have to > have Foo after function.
I don't understand that inconsistency. public Foo function bar() { } looks perfectly sane to me. PHP's syntax was very heavily influenced by C from day 1. In C you have: static int bar() { } In PHP the 'function' keyword indicates what follows is a function. Putting something in between the function keyword and the name of the function would confuse me. To me "function bar()" is inseparable and is equivalent to "bar()" in C which makes the above examples consistent with each other. -Rasmus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php