1<documentation title="Function Declarations"> 2 <standard> 3 <![CDATA[ 4 There should be exactly 1 space after the function keyword and 1 space on each side of the use keyword. Closures should use the Kernighan/Ritchie Brace style and other single-line functions should use the BSD/Allman style. Multi-line function declarations should have the parameter lists indented one level with the closing parenthesis on a newline followed by a single space and the opening brace of the function. 5 ]]> 6 </standard> 7 <code_comparison> 8 <code title="Valid: Correct spacing around function and use keywords."> 9 <![CDATA[ 10$foo = function<em> </em>()<em> </em>use<em> </em>($bar)<em> </em>{ 11}; 12 ]]> 13 </code> 14 <code title="Invalid: No spacing around function and use keywords."> 15 <![CDATA[ 16$foo = function<em></em>()<em></em>use<em></em>($bar)<em></em>{ 17}; 18 ]]> 19 </code> 20 </code_comparison> 21 <code_comparison> 22 <code title="Valid: Multi-line function declaration formatted properly."> 23 <![CDATA[ 24function foo( 25<em> </em>$bar, 26<em> </em>$baz 27<em>) {</em> 28}; 29 ]]> 30 </code> 31 <code title="Invalid: Invalid indentation and formatting of closing parenthesis."> 32 <![CDATA[ 33function foo( 34<em></em>$bar, 35<em></em>$baz<em>)</em> 36<em>{</em> 37}; 38 ]]> 39 </code> 40 </code_comparison> 41</documentation> 42