File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
src/Standards/PSR12/Docs/Functions Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ <documentation title =" Return Type Declaration" >
2
+ <standard >
3
+ <![CDATA[
4
+ For functions and closures, the return type declaration must be correctly defined.
5
+ ]]>
6
+ </standard >
7
+ <code_comparison >
8
+ <code title =" Valid: A single space between the colon and type in a return type declaration." >
9
+ <![CDATA[
10
+ $closure = function ( $arg ):<em> </em>string {
11
+ // Closure body.
12
+ };
13
+ ]]>
14
+ </code >
15
+ <code title =" Invalid: No space between the colon and the type in a return type declaration." >
16
+ <![CDATA[
17
+ $closure = function ( $arg ):<em></em>string {
18
+ // Closure body.
19
+ };
20
+ ]]>
21
+ </code >
22
+ </code_comparison >
23
+ <code_comparison >
24
+ <code title =" Valid: No space before the colon in a return type declaration." >
25
+ <![CDATA[
26
+ function someFunction( $arg )<em></em>: string {
27
+ // Function body.
28
+ };
29
+ ]]>
30
+ </code >
31
+ <code title =" Invalid: One or more spaces before the colon in a return type declaration." >
32
+ <![CDATA[
33
+ function someFunction( $arg )<em> </em>: string {
34
+ // Function body.
35
+ };
36
+ ]]>
37
+ </code >
38
+ </code_comparison >
39
+ </documentation >
You can’t perform that action at this time.
0 commit comments