function RequireTernaryOperatorSniff::isCompatibleScope
1 call to RequireTernaryOperatorSniff::isCompatibleScope()
- RequireTernaryOperatorSniff::process in vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Sniffs/ ControlStructures/ RequireTernaryOperatorSniff.php - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *
File
-
vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Sniffs/ ControlStructures/ RequireTernaryOperatorSniff.php, line 216
Class
Namespace
SlevomatCodingStandard\Sniffs\ControlStructuresCode
private function isCompatibleScope(File $phpcsFile, int $scopeOpenerPointer, int $scopeCloserPointer) : bool {
$semicolonPointer = TokenHelper::findNext($phpcsFile, T_SEMICOLON, $scopeOpenerPointer + 1, $scopeCloserPointer);
if ($semicolonPointer === null) {
return false;
}
if (TokenHelper::findNext($phpcsFile, T_INLINE_THEN, $scopeOpenerPointer + 1, $semicolonPointer) !== null) {
return false;
}
if ($this->ignoreMultiLine) {
$firstContentPointer = TokenHelper::findNextEffective($phpcsFile, $scopeOpenerPointer + 1);
if (TokenHelper::findNextContent($phpcsFile, T_WHITESPACE, $phpcsFile->eolChar, $firstContentPointer + 1, $semicolonPointer) !== null) {
return false;
}
}
$pointerAfterSemicolon = TokenHelper::findNextEffective($phpcsFile, $semicolonPointer + 1);
return $pointerAfterSemicolon === $scopeCloserPointer;
}