File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change 3
3
# Generate WooCommerce stubs.
4
4
#
5
5
6
- PLUGIN_VERSION=" 3.6.5"
6
+ PLUGIN_VERSION=" 3.7.0"
7
+
8
+ GENERATE_STUBS_COMMAND=" vendor/bin/generate-stubs"
7
9
8
10
Get_legacy_classes ()
9
11
{
@@ -48,15 +50,16 @@ if ! grep -q 'Plugin Name:\s\+WooCommerce' ./woocommerce.php 2>/dev/null; then
48
50
fi
49
51
50
52
# Delete files
51
- Get_legacy_files | sort -u | grep ' ^includes/api/ legacy/v[12]/' | xargs -r -- rm -v
53
+ Get_legacy_files | sort -u | grep ' ^includes/legacy/api /v[12]/' | xargs -r -- rm -v
52
54
Get_problematic_files | xargs -r -- rm -v
53
55
54
56
# Generate stubs
55
- if [ ! -x vendor/bin/generate-stubs ]; then
57
+ if hash generate-stubs 2> /dev/null; then
58
+ GENERATE_STUBS_COMMAND=" generate-stubs"
59
+ elif hash generate-stubs.phar 2> /dev/null; then
60
+ GENERATE_STUBS_COMMAND=" generate-stubs.phar"
61
+ elif [ ! -x vendor/bin/generate-stubs ]; then
56
62
composer require --no-interaction --update-no-dev --prefer-dist giacocorsiglia/stubs-generator
57
63
fi
58
- vendor/bin/generate-stubs --functions --classes --interfaces --traits --out=woocommerce-stubs-${PLUGIN_VERSION} .php ./woocommerce.php ./includes/
59
-
60
- echo " Fixing invalid PHPDoc blocks in WooCommerce version 3.6.* ..."
61
- sed -e ' s#@return array\|WC_Error#@return array|WP_Error#' -i woocommerce-stubs-${PLUGIN_VERSION} .php
62
- sed -e ' s#@return string\| Message#@return string Message#' -i woocommerce-stubs-${PLUGIN_VERSION} .php
64
+ " $GENERATE_STUBS_COMMAND " --functions --classes --interfaces --traits --out=woocommerce-stubs-${PLUGIN_VERSION} .php \
65
+ ./woocommerce.php ./includes/ ./packages/* /src/
You can’t perform that action at this time.
0 commit comments