Skip to content

Commit dd9efeb

Browse files
authored
Merge pull request #19 from lipemat/feature/tools-stubs
Create a WP-CLI PHP-CLI Tools stubs file
2 parents fbd7ff4 + 5cccb8c commit dd9efeb

File tree

5 files changed

+1737
-0
lines changed

5 files changed

+1737
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/.idea/
12
/vendor/
23
/composer.lock
34
/source/vendor/

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ parameters:
3232
- %rootDir%/../../php-stubs/wp-cli-stubs/wp-cli-stubs.php
3333
- %rootDir%/../../php-stubs/wp-cli-stubs/wp-cli-commands-stubs.php
3434
- %rootDir%/../../php-stubs/wp-cli-stubs/wp-cli-i18n-stubs.php
35+
- %rootDir%/../../php-stubs/wp-cli-stubs/wp-cli-tools.php
3536
```

finder-tools.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
declare( strict_types=1 );
3+
4+
return \StubsGenerator\Finder::create()
5+
->in( 'source/vendor/wp-cli/php-cli-tools/lib' )
6+
->sortByName();

generate.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ HEADER=$'/**\n * Generated stub declarations for WP-CLI\n * @see https://wp-cli.
55
FILE="wp-cli-stubs.php"
66
FILE_PKGS="wp-cli-commands-stubs.php"
77
FILE_I18N="wp-cli-i18n-stubs.php"
8+
FILE_TOOLS="wp-cli-tools-stubs.php"
89

910
set -e
1011

@@ -53,3 +54,15 @@ fi
5354
--interfaces \
5455
--traits \
5556
--out="$FILE_I18N"
57+
58+
# wp-cli/php-cli-tools
59+
"$(dirname "$0")/vendor/bin/generate-stubs" \
60+
--include-inaccessible-class-nodes \
61+
--force \
62+
--finder=finder-tools.php \
63+
--header="$HEADER" \
64+
--functions \
65+
--classes \
66+
--interfaces \
67+
--traits \
68+
--out="$FILE_TOOLS"

0 commit comments

Comments
 (0)