Mercurial > hg > isophonics-drupal-site
diff vendor/symfony/translation/Command/XliffLintCommand.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | c2387f117808 |
children |
line wrap: on
line diff
--- a/vendor/symfony/translation/Command/XliffLintCommand.php Tue Jul 10 15:07:59 2018 +0100 +++ b/vendor/symfony/translation/Command/XliffLintCommand.php Thu Feb 28 13:21:36 2019 +0000 @@ -85,14 +85,14 @@ throw new RuntimeException('Please provide a filename or pipe file content to STDIN.'); } - return $this->display($io, array($this->validate($stdin))); + return $this->display($io, [$this->validate($stdin)]); } if (!$this->isReadable($filename)) { throw new RuntimeException(sprintf('File or directory "%s" is not readable.', $filename)); } - $filesInfo = array(); + $filesInfo = []; foreach ($this->getFiles($filename) as $file) { $filesInfo[] = $this->validate(file_get_contents($file), $file); } @@ -104,7 +104,7 @@ { // Avoid: Warning DOMDocument::loadXML(): Empty string supplied as input if ('' === trim($content)) { - return array('file' => $file, 'valid' => true); + return ['file' => $file, 'valid' => true]; } libxml_use_internal_errors(true); @@ -112,21 +112,21 @@ $document = new \DOMDocument(); $document->loadXML($content); if ($document->schemaValidate(__DIR__.'/../Resources/schemas/xliff-core-1.2-strict.xsd')) { - return array('file' => $file, 'valid' => true); + return ['file' => $file, 'valid' => true]; } $errorMessages = array_map(function ($error) { - return array( + return [ 'line' => $error->line, 'column' => $error->column, 'message' => trim($error->message), - ); + ]; }, libxml_get_errors()); libxml_clear_errors(); libxml_use_internal_errors(false); - return array('file' => $file, 'valid' => false, 'messages' => $errorMessages); + return ['file' => $file, 'valid' => false, 'messages' => $errorMessages]; } private function display(SymfonyStyle $io, array $files) @@ -143,7 +143,7 @@ private function displayTxt(SymfonyStyle $io, array $filesInfo) { - $countFiles = count($filesInfo); + $countFiles = \count($filesInfo); $erroredFiles = 0; foreach ($filesInfo as $info) { @@ -193,7 +193,7 @@ } foreach ($this->getDirectoryIterator($fileOrDirectory) as $file) { - if (!in_array($file->getExtension(), array('xlf', 'xliff'))) { + if (!\in_array($file->getExtension(), ['xlf', 'xliff'])) { continue; } @@ -225,7 +225,7 @@ }; if (null !== $this->directoryIteratorProvider) { - return call_user_func($this->directoryIteratorProvider, $directory, $default); + return \call_user_func($this->directoryIteratorProvider, $directory, $default); } return $default($directory); @@ -238,7 +238,7 @@ }; if (null !== $this->isReadableProvider) { - return call_user_func($this->isReadableProvider, $fileOrDirectory, $default); + return \call_user_func($this->isReadableProvider, $fileOrDirectory, $default); } return $default($fileOrDirectory);