protected function needsBrackets(File $phpcsFile, $openingBraceIndex, $closingBraceIndex) {
		$tokens = $phpcsFile->getTokens();

		$whitelistedCodes = [
			T_LNUMBER,
			T_STRING,
			T_BOOL_CAST,
			T_STRING_CAST,
			T_INT_CAST,
			T_ARRAY_CAST,
			T_COMMENT,
			T_WHITESPACE,
			T_VARIABLE,
			T_DOUBLE_COLON,
			T_OBJECT_OPERATOR,
		];

		for ($i = $openingBraceIndex + 1; $i < $closingBraceIndex; $i++) {
			if ($tokens[$i]['type'] === 'T_OPEN_PARENTHESIS') {
				$i = $tokens[$i]['parenthesis_closer'];
				continue;
			}
			if (in_array($tokens[$i]['code'], $whitelistedCodes, false)) {
				continue;
			}

			return true;
		}

		return false;
	}
protected function needsBrackets(File $phpcsFile, $openingBraceIndex, $closingBraceIndex) {
		$tokens = $phpcsFile->getTokens();

		$whitelistedCodes = [
			T_LNUMBER,
			T_STRING,
			T_BOOL_CAST,
			T_STRING_CAST,
			T_INT_CAST,
			T_ARRAY_CAST,
			T_COMMENT,
			T_WHITESPACE,
			T_VARIABLE,
			T_DOUBLE_COLON,
			T_OBJECT_OPERATOR,
		];

		for ($i = $openingBraceIndex + 1; $i < $closingBraceIndex; $i++) {
			if ($tokens[$i]['type'] === 'T_OPEN_PARENTHESIS') {
				$i = $tokens[$i]['parenthesis_closer'];
				continue;
			}
			if (in_array($tokens[$i]['code'], $whitelistedCodes, false)) {
				continue;
			}

			return true;
		}

		return false;
	}
protected function needsBrackets ( File $ phpcsFile , $ openingBraceIndex , $ closingBraceIndex ) { $ tokens = $ phpcsFile -> getTokens ( ) ; $ whitelistedCodes = [ T_LNUMBER , T_STRING , T_BOOL_CAST , T_STRING_CAST , T_INT_CAST , T_ARRAY_CAST , T_COMMENT , T_WHITESPACE , T_VARIABLE , T_DOUBLE_COLON , T_OBJECT_OPERATOR , ] ; for ( $ i = $ openingBraceIndex + 1 ; $ i < $ closingBraceIndex ; $ i ++ ) { if ( $ tokens [ $ i ] [ 'type' ] === 'T_OPEN_PARENTHESIS' ) { $ i = $ tokens [ $ i ] [ 'parenthesis_closer' ] ; continue ; } if ( in_array ( $ tokens [ $ i ] [ 'code' ] , $ whitelistedCodes , false ) ) { continue ; } return true ; } return false ; }
Checks if the given token scope requires brackets when used standalone.

@param \PHP_CodeSniffer\Files\File $phpcsFile
@param int $openingBraceIndex
@param int $closingBraceIndex
@return bool
Checks if the given token scope requires brackets when used standalone .