protected function hasTargetInList(File $phpcsFile, $start, $closer)
    {
        $tokens = $phpcsFile->getTokens();

        for ($i = ($start + 1); $i < $closer; $i++) {
            if (isset($this->allTargets[$tokens[$i]['code']]) === false) {
                continue;
            }

            if (isset($this->targetsInList[$tokens[$i]['code']]) === true) {
                return $i;
            }

            // Skip past nested list constructs.
            if ($tokens[$i]['code'] === \T_LIST) {
                $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($i + 1), null, true);
                if ($nextNonEmpty !== false
                    && $tokens[$nextNonEmpty]['code'] === \T_OPEN_PARENTHESIS
                    && isset($tokens[$nextNonEmpty]['parenthesis_closer']) === true
                ) {
                    $i = $tokens[$nextNonEmpty]['parenthesis_closer'];
                }
            } elseif ($tokens[$i]['code'] === \T_OPEN_SHORT_ARRAY
                && isset($tokens[$i]['bracket_closer'])
            ) {
                $i = $tokens[$i]['bracket_closer'];
            }
        }

        return false;
    }