Mercurial > hg > isophonics-drupal-site
diff vendor/symfony/translation/Util/ArrayConverter.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 4c8ae668cc8c |
children | af1871eacc83 |
line wrap: on
line diff
--- a/vendor/symfony/translation/Util/ArrayConverter.php Tue Jul 10 15:07:59 2018 +0100 +++ b/vendor/symfony/translation/Util/ArrayConverter.php Thu Feb 28 13:21:36 2019 +0000 @@ -27,7 +27,7 @@ { /** * Converts linear messages array to tree-like array. - * For example this rray('foo.bar' => 'value') will be converted to array('foo' => array('bar' => 'value')). + * For example this rray('foo.bar' => 'value') will be converted to ['foo' => ['bar' => 'value']]. * * @param array $messages Linear messages array * @@ -35,7 +35,7 @@ */ public static function expandToTree(array $messages) { - $tree = array(); + $tree = []; foreach ($messages as $id => $value) { $referenceToElement = &self::getElementByPath($tree, explode('.', $id)); @@ -54,7 +54,7 @@ $parentOfElem = null; foreach ($parts as $i => $part) { - if (isset($elem[$part]) && is_string($elem[$part])) { + if (isset($elem[$part]) && \is_string($elem[$part])) { /* Process next case: * 'foo': 'test1', * 'foo.bar': 'test2' @@ -62,14 +62,14 @@ * $tree['foo'] was string before we found array {bar: test2}. * Treat new element as string too, e.g. add $tree['foo.bar'] = 'test2'; */ - $elem = &$elem[implode('.', array_slice($parts, $i))]; + $elem = &$elem[implode('.', \array_slice($parts, $i))]; break; } $parentOfElem = &$elem; $elem = &$elem[$part]; } - if (is_array($elem) && count($elem) > 0 && $parentOfElem) { + if ($elem && \is_array($elem) && $parentOfElem) { /* Process next case: * 'foo.bar': 'test1' * 'foo': 'test2' @@ -89,7 +89,7 @@ $prefix .= '.'; foreach ($node as $id => $value) { - if (is_string($value)) { + if (\is_string($value)) { $tree[$prefix.$id] = $value; } else { self::cancelExpand($tree, $prefix.$id, $value);