Skip to content

Commit

Permalink
Fixed deprecation warnings about passing null as parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus committed May 16, 2021
1 parent ff6e63c commit 424d29d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Loader/XliffFileLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ private function extractXliff1(\DOMDocument $dom, MessageCatalogue $catalogue, s
private function extractXliff2(\DOMDocument $dom, MessageCatalogue $catalogue, string $domain)
{
$xml = simplexml_import_dom($dom);
$encoding = strtoupper($dom->encoding);
$encoding = $dom->encoding ? strtoupper($dom->encoding) : null;

$xml->registerXPathNamespace('xliff', 'urn:oasis:names:tc:xliff:document:2.0');

Expand Down
2 changes: 1 addition & 1 deletion Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ protected function computeFallbackLocales($locale)
*/
protected function assertValidLocale($locale)
{
if (1 !== preg_match('/^[a-z0-9@_\\.\\-]*$/i', $locale)) {
if (null !== $locale && 1 !== preg_match('/^[a-z0-9@_\\.\\-]*$/i', $locale)) {
throw new InvalidArgumentException(sprintf('Invalid "%s" locale.', $locale));
}
}
Expand Down

0 comments on commit 424d29d

Please sign in to comment.