Reputation: 2144
The PHP PSR 2 coding style guide requires there to NOT be any space between a function name and the opening bracket following it. This applies when writing the function signature:
Method names MUST NOT be declared with a space after the method name. The opening brace MUST go on its own line, and the closing brace MUST go on the next line following the body. There MUST NOT be a space after the opening parenthesis, and there MUST NOT be a space before the closing parenthesis.
as well as calling a function:
When making a method or function call, there MUST NOT be a space between the method or function name and the opening parenthesis, there MUST NOT be a space after the opening parenthesis, and there MUST NOT be a space before the closing parenthesis. In the argument list, there MUST NOT be a space before each comma, and there MUST be one space after each comma.
The style code doesn't describe why these are the guidelines, but rather dictates what to do or not to do in this case. When describing this spacing, the phrases MUST
and MUST NOT
are used, indicating an absolute requirement. This results in cramping words together (specially with long function and parameter names), so what is the reason behind this decision?
Upvotes: 1
Views: 2299
Reputation: 41300
No reason, just common practice.
This is a guide. You don't have to follow it, however if you follow you must obey rules, otherwise you are not following.
Upvotes: 1