Skip to content
This repository was archived by the owner on Jul 16, 2020. It is now read-only.

Commit 206c158

Browse files
committed
Generator: propagate error if found unexpected data
1 parent 9903ba3 commit 206c158

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Generator.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,17 @@ private function allocateLocaleArray($path)
5454
$this->allocateLocaleArray($path . '/' . $fileinfo->getFilename());
5555
} else {
5656
$noExt = $this->removeExtension($fileinfo->getFilename());
57+
$fileName = $path . '/' . $fileinfo->getFilename();
5758

5859
// Ignore non *.php files (ex.: .gitignore, vim swap files etc.)
59-
if (pathinfo($fileinfo->getFileName(), PATHINFO_EXTENSION) !== 'php') {
60+
if (pathinfo($fileName, PATHINFO_EXTENSION) !== 'php') {
61+
continue;
62+
}
63+
$tmp = include($fileName);
64+
if (gettype($tmp) !== "array") {
65+
throw new Exception('Unexpected data while processing '.$fileName);
6066
continue;
6167
}
62-
$tmp = include($path . '/' . $fileinfo->getFilename());
6368

6469
$data[$noExt] = $this->adjustArray($tmp);
6570
}

0 commit comments

Comments
 (0)