diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-11-01 16:32:33 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-11-01 16:54:20 +0100 |
commit | 5ca46572e63fb7aae1df3ccfea0a9972cda35d3b (patch) | |
tree | e0b021db1179889772e019600149c272af8abb3b /scripts | |
parent | 4008704f62c849d689fe6bfec07ea3f1a9faf903 (diff) | |
download | php-git-5ca46572e63fb7aae1df3ccfea0a9972cda35d3b.tar.gz |
Allow generating stubs for directory
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/dev/gen_stub.php | 17 |
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) { |