Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
// Is this a return type declarations?
if ($tokens[$nextPtr]['code'] === T_OPEN_CURLY_BRACKET) {
$prevPtrReturnType = $phpcsFile->findPrevious(array(T_WHITESPACE, T_INLINE_THEN), ($stackPtr - 1), null, true);
if ($tokens[$prevPtrReturnType]['code'] === T_COLON) {
if (in_array($tokens[$prevPtrReturnType]['code'], array(T_COLON, T_INLINE_ELSE), true)) {
return;
}
}
Expand Down
12 changes: 11 additions & 1 deletion CakePHP/tests/files/return_type_declaration_pass.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,17 @@ public function returnTypeVoid() : void {
*
* @return string|null
*/
public unction returnTypeNull() : ?string {
public function returnTypeNull() : ?string {
}

/**
* A function with param
*
* @param int $firstParam a first param
* @param string $secondParam a second param
* @return int
*/
public function withParam(int $firstParam, string $secondParam) : int {
}

}