-
Notifications
You must be signed in to change notification settings - Fork 103
Discover repository class from #[Entity]
attribute on PHP 8
#238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
87e4bf7
to
d524d5d
Compare
Hmm, I don't understand why on PHP 8.0 it fails. |
Please try the nice way via ClassReflection::getNativeReflection() and require |
d524d5d
to
2eae4a5
Compare
The fact that PHPStan reports an error like that is weird and I should look into it, but it might still work correctly. Hard to tell without a test. |
For some reason I cannot install the dependencies for this project anymore:
Weird that it just works on CI. |
2eae4a5
to
d037bd6
Compare
Yeah, you need |
d037bd6
to
125fecf
Compare
That works, weird that the error doesn't mention I don't know how to solve the error on PHP 8. It seems that PHPStan doesn't understand |
I really don't know, it works in the playground: https://phpstan.org/r/fa2489cc-dfd7-4a61-8865-c29e83a8a2a6 |
🤷 |
I know! It's caused by phpstan-doctrine/composer.json Lines 36 to 41 in 04cace0
|
125fecf
to
719b5cc
Compare
I removed the php platform and now phpunit fails. Shouldn't PHPunit be installed differently on PHP < 7.3? I fixed the name of the mongodb extension, as it was wrong. |
e0b1153
to
c9f9444
Compare
Ok, 2 problems left:
|
80d1c57
to
1eee2a6
Compare
1eee2a6
to
670690e
Compare
Oke, so the only problem left seems to be a bug in PHPStan, am I right? https://phpstan.org/r/a34ea8cd-2986-4bbf-82e2-a1041cb4a6de If so, I can report it on phpstan/phpstan |
f8e3f88
to
2179d23
Compare
@ondrejmirtes I hoped that PHPStan 1.3 would solve the problem with attributes, as the release notes mention this:
but I still cannot solve the problem. Any idea how to proceed? |
What PHPStan 1.3 fixed was an internal PHP error when accessing Are you trying to solve the problem on PHP 7.x from this example? https://phpstan.org/r/a34ea8cd-2986-4bbf-82e2-a1041cb4a6de This is usually solved by having different PHPStan configs for different PHP versions (when a project is analysed on different PHP cersions). One notable example is PHPStan itself: https://github.com/phpstan/phpstan-src/blob/master/build/ignore-by-php-version.neon.php This file is included in |
By doing it like this, we don't need to instantiate the object manager at all.
2179d23
to
22f9661
Compare
@ondrejmirtes It worked 🎉 Ready for review. |
While writing some tests, I notice that |
Looks like I'm gonna solve this in a general way for all the rules :) #253 |
🥳🥳🥳🥳🥳 thank you |
By doing it like this, we don't need to instantiate the object manager at all which makes PHPStan run faster and more reliable. Very often I had to manually clear my Symfony cache and re-run PHPStan.
Unfortunately, BetterReflection doesn't support attributes yet so therefore we need to use native
ReflectionClass
.See phpstan/phpstan#5863 (reply in thread)