diff --git a/php/bin/gherkin b/php/bin/gherkin index a5cda8eba..f156ada32 100755 --- a/php/bin/gherkin +++ b/php/bin/gherkin @@ -7,11 +7,14 @@ use Cucumber\Gherkin\GherkinParser; use Cucumber\Messages\Source; use Cucumber\Messages\Streams\NdJson\NdJsonStreamWriter; +assert(is_array($argv), "Script must be run from the command line"); + $options = ['predictable-ids', 'no-source', 'no-ast', 'no-pickles']; $selectedOptions = getopt('', $options, $restIndex); $paths = array_slice($argv, $restIndex); + // lazily-read list of Sources $sources = ( /** @param list $paths */ diff --git a/php/bin/gherkin-generate-tokens b/php/bin/gherkin-generate-tokens index 0c9ce2ed8..61a3a1897 100755 --- a/php/bin/gherkin-generate-tokens +++ b/php/bin/gherkin-generate-tokens @@ -9,6 +9,8 @@ namespace Cucumber\Gherkin; require __DIR__ . '/../vendor/autoload.php'; +assert(is_array($argv), "Script must be run from the command line"); + $parser = new Parser(new TokenFormatterBuilder()); // first element is the script name diff --git a/php/composer.json b/php/composer.json index d3610acd9..1b6c871bf 100644 --- a/php/composer.json +++ b/php/composer.json @@ -19,7 +19,7 @@ }, "require-dev": { "phpunit/phpunit": "^10.0", - "vimeo/psalm": "5.5.0", + "vimeo/psalm": "5.15.0", "friendsofphp/php-cs-fixer": "^3.5", "psalm/plugin-phpunit": "^0.18.0", "nikic/php-parser": "^4.14"