src/Fixer/Alias/EregToPregFixer.php
private function getBestDelimiter($pattern)
    {
        // try do find something that's not used
        $delimiters = [];
        foreach (self::$delimiters as $k => $d) {
            if (false === strpos($pattern, $d)) {
                return $d;
            }

            $delimiters[$d] = [substr_count($pattern, $d), $k];
        }

        // return the least used delimiter, using the position in the list as a tie breaker
        uasort($delimiters, static function ($a, $b) {
            if ($a[0] === $b[0]) {
                return Utils::cmpInt($a, $b);
            }

            return $a[0] < $b[0] ? -1 : 1;
        });

        return key($delimiters);
    }
private function getBestDelimiter($pattern)
    {
        // try do find something that's not used
        $delimiters = [];
        foreach (self::$delimiters as $k => $d) {
            if (false === strpos($pattern, $d)) {
                return $d;
            }

            $delimiters[$d] = [substr_count($pattern, $d), $k];
        }

        // return the least used delimiter, using the position in the list as a tie breaker
        uasort($delimiters, static function ($a, $b) {
            if ($a[0] === $b[0]) {
                return Utils::cmpInt($a, $b);
            }

            return $a[0] < $b[0] ? -1 : 1;
        });

        return key($delimiters);
    }
private function getBestDelimiter ( $ pattern ) { // try do find something that's not used $ delimiters = [ ] ; foreach ( self :: $ delimiters as $ k => $ d ) { if ( false === strpos ( $ pattern , $ d ) ) { return $ d ; } $ delimiters [ $ d ] = [ substr_count ( $ pattern , $ d ) , $ k ] ; } // return the least used delimiter, using the position in the list as a tie breaker uasort ( $ delimiters , static function ( $ a , $ b ) { if ( $ a [ 0 ] === $ b [ 0 ] ) { return Utils :: cmpInt ( $ a , $ b ) ; } return $ a [ 0 ] < $ b [ 0 ] ? - 1 : 1 ; } ) ; return key ( $ delimiters ) ; }
Get the delimiter that would require the least escaping in a regular expression.

@param string $pattern the regular expression

@return string the preg delimiter
Get the delimiter that would require the least escaping in a regular expression .