Skip to content

Commit

Permalink
Update and apply CS rules
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Jan 6, 2021
1 parent 796d7aa commit fdc1736
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions MessageFormatter.php
Expand Up @@ -162,11 +162,11 @@ private static function parseTokens(array $tokens, array $values, $locale)
private static function tokenizePattern($pattern)
{
if (false === $start = $pos = strpos($pattern, '{')) {
return array($pattern);
return [$pattern];
}

$depth = 1;
$tokens = array(substr($pattern, 0, $pos));
$tokens = [substr($pattern, 0, $pos)];

while (true) {
$open = strpos($pattern, '{', 1 + $pos);
Expand Down Expand Up @@ -228,7 +228,6 @@ private static function parseToken(array $token, array $values, $locale)
case 'choice':
case 'selectordinal':
throw new \DomainException(sprintf('The PHP intl extension is required to use the "%s" message format.', $type));

case 'number':
$format = isset($token[2]) ? trim($token[2]) : null;
if (!is_numeric($arg) || (null !== $format && 'integer' !== $format)) {
Expand Down Expand Up @@ -293,7 +292,7 @@ private static function parseToken(array $token, array $values, $locale)
$selector = trim($plural[$i++]);

if (1 === $i && 0 === strncmp($selector, 'offset:', 7)) {
$pos = strpos(str_replace(array("\n", "\r", "\t"), ' ', $selector), ' ', 7);
$pos = strpos(str_replace(["\n", "\r", "\t"], ' ', $selector), ' ', 7);
$offset = (int) trim(substr($selector, 7, $pos - 7));
$selector = trim(substr($selector, 1 + $pos, \strlen($selector)));
}
Expand Down

0 comments on commit fdc1736

Please sign in to comment.