0

For a php project, for some time my tests fail for phpstan and psalm, with unclear error messages.

I tried to debug, to rebuild the commits, but without success. I can't understand or so.

These are the output, the composer.json and the ci.yml.

I can spot these lines. For psalm:

Uncaught Error: Call to undefined method ReflectionUnionType::getName() in phar:///home/runner/work/me-tools/me-tools/vendor/psalm/phar/psalm.phar/src/Psalm/Internal/Codebase/Reflection.php:262

And for phpstan:

PHP Warning:  Undefined array key "PHPStan\Rules\Arrays\DuplicateKeysInLiteralArraysRule" in phar:///home/runner/work/me-tools/me-tools/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/utils/src/Utils/Reflection.php on line 180
Warning: Undefined array key "PHPStan\Rules\Arrays\DuplicateKeysInLiteralArraysRule" in phar:///home/runner/work/me-tools/me-tools/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/utils/src/Utils/Reflection.php on line 180
PHP Fatal error:  Uncaught TypeError: _HumbugBox5f943a942674\Nette\Utils\Reflection::getUseStatements(): Return value must be of type array, null returned in phar:///home/runner/work/me-tools/me-tools/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/utils/src/Utils/Reflection.php:180

But I didn't help and even looking on the net I didn't find anything useful.

The strangest thing is that I can't replicate this problem. In fact, locally, with the same configuration, I have no problem.

One possible hypothesis about that Call to undefined method ReflectionUnionType::getName () is that somewhere there might be something like:

public function myMethod(): int | float

but I have checked the code and I am not aware of any of this.

Can anyone help me debug?

Mirko Pagliai
  • 1,220
  • 1
  • 19
  • 36

1 Answers1

2

These are unrelated separate problems. You’ll have higher luck asking about them in Psalm and PHPStan GitHub issue trackers.

Ondřej Mirtes
  • 5,054
  • 25
  • 36