summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/dev/gen_stub.php17
1 files changed, 14 insertions, 3 deletions
diff --git a/scripts/dev/gen_stub.php b/scripts/dev/gen_stub.php
index f03e4b82c2..4bf29fc440 100755
--- a/scripts/dev/gen_stub.php
+++ b/scripts/dev/gen_stub.php
@@ -15,12 +15,23 @@ try {
}
if ($argc >= 2) {
- // Generate single file.
- processStubFile($argv[1]);
+ if (is_file($argv[1])) {
+ // Generate single file.
+ processStubFile($argv[1]);
+ } else if (is_dir($argv[1])) {
+ processDirectory($argv[1]);
+ } else {
+ echo "$argv[1] is neither a file nor a directory.\n";
+ exit(1);
+ }
} else {
// Regenerate all stub files we can find.
+ processDirectory('.');
+}
+
+function processDirectory(string $dir) {
$it = new RecursiveIteratorIterator(
- new RecursiveDirectoryIterator('.'),
+ new RecursiveDirectoryIterator($dir),
RecursiveIteratorIterator::LEAVES_ONLY
);
foreach ($it as $file) {