mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Allow generating stubs for directory
This commit is contained in:
parent
4008704f62
commit
5ca46572e6
1 changed files with 14 additions and 3 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue