function DisallowImplicitArrayCreationSniff::isCreatedByReferencedParameterInFunctionCall
1 call to DisallowImplicitArrayCreationSniff::isCreatedByReferencedParameterInFunctionCall()
- DisallowImplicitArrayCreationSniff::hasExplicitCreation in vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Sniffs/ Arrays/ DisallowImplicitArrayCreationSniff.php
File
-
vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Sniffs/ Arrays/ DisallowImplicitArrayCreationSniff.php, line 254
Class
Namespace
SlevomatCodingStandard\Sniffs\ArraysCode
private function isCreatedByReferencedParameterInFunctionCall(File $phpcsFile, int $variablePointer, int $scopeOpenerPointer) : bool {
$tokens = $phpcsFile->getTokens();
$parenthesisOpenerPointer = TokenHelper::findPrevious($phpcsFile, T_OPEN_PARENTHESIS, $variablePointer - 1, $scopeOpenerPointer);
if ($parenthesisOpenerPointer === null || $tokens[$parenthesisOpenerPointer]['parenthesis_closer'] < $variablePointer) {
return false;
}
$pointerBeforeParenthesisOpener = TokenHelper::findPreviousEffective($phpcsFile, $parenthesisOpenerPointer - 1);
return $tokens[$pointerBeforeParenthesisOpener]['code'] === T_STRING;
}