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
|
@@ 105-108 (lines=4) @@
|
| 102 |
|
return; |
| 103 |
|
} |
| 104 |
|
|
| 105 |
|
if (isset($tokens[$function]['scope_opener'], $tokens[$function]['scope_closer']) === false) { |
| 106 |
|
// Can't reliably determine start/end of function scope. |
| 107 |
|
return; |
| 108 |
|
} |
| 109 |
|
|
| 110 |
|
$hasReturn = $phpcsFile->findNext(T_RETURN, ($tokens[$function]['scope_opener'] + 1), $tokens[$function]['scope_closer']); |
| 111 |
|
if ($hasReturn === false) { |