php-stubs / wp-cli-stubs

WP-CLI function and class declaration stubs for static analysis.
https://packagist.org/packages/php-stubs/wp-cli-stubs
MIT License
23 stars 2 forks source link

Generate script fails on some bash environments #15

Closed lipemat closed 1 year ago

lipemat commented 1 year ago

When running the generate.sh script on Windows Bash the --header text gets transformed into a multi line argument when pass and breaks the command.

Running bash -x ./generate.sh

Shows the following in terminal.

+ HEADER='/**
 * Generated stub declarations for WP-CLI
 * @see https://wp-cli.org/
 * @see https://github.com/php-stubs/wp-cli-stubs
 */'
+ FILE=wp-cli-stubs.php
+ FILE_PKGS=wp-cli-commands-stubs.php
+ FILE_I18N=wp-cli-i18n-stubs.php
+ set -e
+ test -f wp-cli-stubs.php
+ test -f wp-cli-commands-stubs.php
+ test -f wp-cli-i18n-stubs.php
+ test -d source/vendor/wp-cli
+ '[' '!' -d vendor ']'
++ dirname ./generate.sh
+ ./vendor/bin/generate-stubs --include-inaccessible-class-nodes --force --finder=finder.php '--header=/**
 * Generated stub declarations for WP-CLI
 * @see https://wp-cli.org/
 * @see https://github.com/php-stubs/wp-cli-stubs
 */' --functions --classes --interfaces --traits --out=wp-cli-stubs.php
<?php
/**

namespace cli {
... Definitions outputted below here.
  1. Definition files are not updated.
  2. Removing the --header flag in the command generates everything correctly but does not include the expected file header.

Tested with

  1. GNU bash, version 5.1.16(1)-release (x86_64-pc-msys)
szepeviktor commented 1 year ago

You are right. All my projects live in a golden cage called Debian GNU/Linux amd64.

szepeviktor commented 1 year ago

I would gladly support your person but not Microsoft Windows.

lipemat commented 1 year ago

Understood. :)

I was able to get the generate script to work in GitHub Codespaces. This will do for now.