forked from squizlabs/PHP_CodeSniffer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Function return types are now tokenized as T_RETURN_TYPE in all cases…
… + the return value of File::getMethodProperties() now contains a return_type array index with a cleaned up return type (ref squizlabs#1527)
- Loading branch information
Showing
6 changed files
with
624 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
/* phpcs:ignoreFile */ | ||
|
||
/* testBasicFunction */ | ||
function myFunction() {} | ||
|
||
/* testReturnFunction */ | ||
function myFunction(array ...$arrays): array | ||
{ | ||
return array_map(/* testNestedClosure */function(array $array): int { | ||
return array_sum($array); | ||
}, $arrays); | ||
} | ||
|
||
class MyClass { | ||
/* testBasicMethod */ | ||
function myFunction() {} | ||
|
||
/* testPrivateStaticMethod */ | ||
private static function myFunction() {} | ||
|
||
/* testFinalMethod */ | ||
final public function myFunction() {} | ||
|
||
/* testProtectedReturnMethod */ | ||
protected function myFunction() : int {} | ||
|
||
/* testPublicReturnMethod */ | ||
public function myFunction(): array {} | ||
|
||
/* testReturnNamespace */ | ||
function myFunction(): \MyNamespace\MyClass {} | ||
|
||
/* testReturnMultilineNamespace */ | ||
function myFunction(): \MyNamespace /** comment *\/ comment */ | ||
\MyClass /* comment */ | ||
\Foo {} | ||
} | ||
|
||
abstract class MyClass | ||
{ | ||
/* testAbstractMethod */ | ||
abstract function myFunction(); | ||
|
||
/* testAbstractReturnMethod */ | ||
abstract protected function myFunction(): bool; | ||
} | ||
|
Oops, something went wrong.