We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4008704 commit 5ca4657Copy full SHA for 5ca4657
scripts/dev/gen_stub.php
@@ -15,12 +15,23 @@
15
}
16
17
if ($argc >= 2) {
18
- // Generate single file.
19
- processStubFile($argv[1]);
+ if (is_file($argv[1])) {
+ // Generate single file.
20
+ processStubFile($argv[1]);
21
+ } else if (is_dir($argv[1])) {
22
+ processDirectory($argv[1]);
23
+ } else {
24
+ echo "$argv[1] is neither a file nor a directory.\n";
25
+ exit(1);
26
+ }
27
} else {
28
// Regenerate all stub files we can find.
29
+ processDirectory('.');
30
+}
31
+
32
+function processDirectory(string $dir) {
33
$it = new RecursiveIteratorIterator(
- new RecursiveDirectoryIterator('.'),
34
+ new RecursiveDirectoryIterator($dir),
35
RecursiveIteratorIterator::LEAVES_ONLY
36
);
37
foreach ($it as $file) {
0 commit comments