PHPCompatibility/Sniffs/PHP/NewClosureSniff.php 1 location
|
@@ 162-165 (lines=4) @@
|
| 159 |
|
{ |
| 160 |
|
$tokens = $phpcsFile->getTokens(); |
| 161 |
|
|
| 162 |
|
if (isset($tokens[$stackPtr]['scope_opener'], $tokens[$stackPtr]['scope_closer']) === false) { |
| 163 |
|
// Live coding or parse error. |
| 164 |
|
return false; |
| 165 |
|
} |
| 166 |
|
|
| 167 |
|
// Make sure the optional $startToken is valid. |
| 168 |
|
if (isset($startToken) === true && (isset($tokens[$startToken]) === false || $startToken >= $tokens[$stackPtr]['scope_closer'])) { |
PHPCompatibility/Sniffs/PHP/NewGeneratorReturnSniff.php 1 location
|
@@ 72-75 (lines=4) @@
|
| 69 |
|
|
| 70 |
|
$tokens = $phpcsFile->getTokens(); |
| 71 |
|
|
| 72 |
|
if (isset($tokens[$function]['scope_opener'], $tokens[$function]['scope_closer']) === false) { |
| 73 |
|
// Can't reliably determine start/end of function scope. |
| 74 |
|
return; |
| 75 |
|
} |
| 76 |
|
|
| 77 |
|
$hasReturn = $phpcsFile->findNext(T_RETURN, ($tokens[$function]['scope_opener'] + 1), $tokens[$function]['scope_closer']); |
| 78 |
|
if ($hasReturn === false) { |