function AbstractLineCondition::shouldBeSkipped
2 calls to AbstractLineCondition::shouldBeSkipped()
- RequireMultiLineConditionSniff::process in vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Sniffs/ ControlStructures/ RequireMultiLineConditionSniff.php - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *
- RequireSingleLineConditionSniff::process in vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Sniffs/ ControlStructures/ RequireSingleLineConditionSniff.php - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *
File
-
vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Sniffs/ ControlStructures/ AbstractLineCondition.php, line 60
Class
Namespace
SlevomatCodingStandard\Sniffs\ControlStructuresCode
protected function shouldBeSkipped(File $phpcsFile, int $controlStructurePointer) : bool {
$tokens = $phpcsFile->getTokens();
if (!array_key_exists('parenthesis_opener', $tokens[$controlStructurePointer]) || $tokens[$controlStructurePointer]['parenthesis_opener'] === null || !array_key_exists('parenthesis_closer', $tokens[$controlStructurePointer]) || $tokens[$controlStructurePointer]['parenthesis_closer'] === null) {
return true;
}
if ($tokens[$controlStructurePointer]['code'] === T_WHILE) {
$isPartOfDo = $this->isPartOfDo($phpcsFile, $controlStructurePointer);
if ($isPartOfDo && !in_array(self::DO_CONTROL_STRUCTURE, $this->checkedControlStructures, true)) {
return true;
}
if (!$isPartOfDo && !in_array(self::WHILE_CONTROL_STRUCTURE, $this->checkedControlStructures, true)) {
return true;
}
}
return false;
}