Larastan: PHPStan\Reflection\ReflectionProvider class is missing

Created on 19 Jun 2020  路  5Comments  路  Source: nunomaduro/larastan

  • Larastan Version: 0.6.0
  • PHPStan Version: 0.12.29
  • Laravel Version: 7.16.1
  • PHP Version: 7.3.19
  • --level used: 3

Description

Files NunoMaduro\Larastan\Rules\NoUnnecessaryCollectionCallRule and NunoMaduro\Larastan\Types\RelationParserHelper are requiring PHPStan\Reflection\ReflectionProvider file, but it is missing in codebase.

Setting noUnnecessaryCollectionCall to false doesn't help either.

In Resolver.php line 404:

  Service of type NunoMaduro\Larastan\Rules\NoUnnecessaryCollectionCallRule: Class PHPStan\Reflection\ReflectionProvider needed by $reflectionProvider in __construct() not found. Check type hint and 'use' statements. 

Most helpful comment

My bad, I realized that I have used phpstan installed globally on my computer, rather than by vendor/bin/phpstan. After this little change everything works like a charm. Sorry for trouble and thanks for fast response!

All 5 comments

Hello Krzysztof!
Thank you for your report

ReflectionProvider seems to be part of PHPStan 2 years ago
https://github.com/phpstan/phpstan-src/commits/master/src/Reflection/ReflectionProvider.php

Could you share a snippet of your code with us?

My bad, I realized that I have used phpstan installed globally on my computer, rather than by vendor/bin/phpstan. After this little change everything works like a charm. Sorry for trouble and thanks for fast response!

It doesn't/didn't happen often with larastan so far, but there are months were you've the feeling every 2nd bug report in phpunit is simply because the global installation is preferred but horribly outdated.

Would be interesting to know if there's a way to detect this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iNviNho picture iNviNho  路  3Comments

grcasanova picture grcasanova  路  4Comments

szepeviktor picture szepeviktor  路  4Comments

jdrieghe picture jdrieghe  路  4Comments

danielcosta picture danielcosta  路  4Comments