PHP Classes

File: vendor/squizlabs/php_codesniffer/src/Standards/PSR12/Docs/Functions/ReturnTypeDeclarationStandard.xml

Recommend this page to a friend!
  Classes of Adeleye Ayodeji   Download Installed Plugin   vendor/squizlabs/php_codesniffer/src/Standards/PSR12/Docs/Functions/ReturnTypeDeclarationStandard.xml   Download  
File: vendor/squizlabs/php_codesniffer/src/Standards/PSR12/Docs/Functions/ReturnTypeDeclarationStandard.xml
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Download Installed Plugin
Download a WordPress plugin as a ZIP archive
Author: By
Last change:
Date: 2 days ago
Size: 1,347 bytes
 

Contents

Class file image Download
<documentation title="Return Type Declaration"> <standard> <![CDATA[ For function and closure return type declarations, there must be one space after the colon followed by the type declaration, and no space before the colon. The colon and the return type declaration have to be on the same line as the argument list closing parenthesis. ]]> </standard> <code_comparison> <code title="Valid: A single space between the colon and type in a return type declaration."> <![CDATA[ $closure = function ( $arg ):<em> </em>string { // Closure body. }; ]]> </code> <code title="Invalid: No space between the colon and the type in a return type declaration."> <![CDATA[ $closure = function ( $arg ):<em></em>string { // Closure body. }; ]]> </code> </code_comparison> <code_comparison> <code title="Valid: No space before the colon in a return type declaration."> <![CDATA[ function someFunction( $arg )<em></em>: string { // Function body. }; ]]> </code> <code title="Invalid: One or more spaces before the colon in a return type declaration."> <![CDATA[ function someFunction( $arg )<em> </em>: string { // Function body. }; ]]> </code> </code_comparison> </documentation>