vimeo / psalm

A static analysis tool for finding errors in PHP applications
https://psalm.dev
MIT License
5.54k stars 660 forks source link

Tests fail because of direct access to `$argv` #10719

Open weirdan opened 6 months ago

weirdan commented 6 months ago
$ vendor/bin/phpunit -d memory_limit=-1 tests/Cache/CacheTest.php
PHPUnit 9.6.16 by Sebastian Bergmann and contributors.

Random Seed:   1708301269

Cannot locate memory_limit=-1

I believe this is caused by one of the changes in #10370

cc: @orklah and @kkmuffme

psalm-github-bot[bot] commented 6 months ago

Hey @weirdan, can you reproduce the issue on https://psalm.dev? These will be used as phpunit tests when implementing the feature or fixing this bug.

kkmuffme commented 6 months ago

Seems to be the same issue as https://github.com/vimeo/psalm/issues/10418 (and various similar ones)

I guess just adding a || for d like in the PR I created to fix the issue above: https://github.com/vimeo/psalm/pull/10442/files

Could you check if that fixes the issue?

weirdan commented 6 months ago

It may fix the immediate issue, but it isn't a robust solution. There's a myriad of flags you can pass to PHPUnit / paratest / etc, and whitelisting all of them is a pain in the back, not to mention potential conflicts between Psalm and PHPUnit arguments.

A correct solution would be passing arguments from Cli\Psalm to Config::fromXmlAndPaths() instead.