-
-
Notifications
You must be signed in to change notification settings - Fork 680
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
"PHPStan\Reflection\ClassReflection::getProperty(): Argument #2 ($scope) must be of type PHPStan\Reflection\ClassMemberAccessAnswerer, null given #5980
Comments
I found a minimal amount of code causes this error locally, but it works on demo: https://getrector.org/demo/3a1d056c-85f4-4f36-9d53-2d2288c4c775 I think it's a good idea to display Rector version on demo page. Note, it's parsing error and it seems it doesn't depend on rectors/rules/services |
Additionally, I found it fails only when I use |
Hey @TomasVotruba I'm sorry, the problem still exist even on master branch, I still can't reproduce it on getrector: https://getrector.org/demo/72ad4a75-83e5-4fa8-9875-11a9b9150c43 Here is a bare minimum php code run get this exception: <?php declare(strict_types=1);
namespace App\Models\User;
/**
* @property \DateTime $created_at
*/
final class User
{
use \App\Models\User\SomeTrait;
}
trait SomeTrait
{
public function filter(\App\Models\User\User $user)
{
return $user->created_at->modify('+2days');
}
}
The problem raises when we modify a class property declared by PHPDoc @Property from a trait but do it for another object instance |
please use |
@samsonasik I used After update, I've got another error:
But I've changed myy implementation to use array of arrays instead array of \stdClass and it "solves" the problem. Again, the problem is not reproducible on getrector and even more: I don't now a version we use at this site, but at least stoped to fail on my project. Thanks a lot! |
rectorphp/rector-src@a787d4c Remove deprecated and empty FinalizeClassesWithoutChildrenRector + FinalizePublicClassConstantRector (#5980)
Bug Report
fatal error
Minimal PHP Code Causing Issue
Sorry, I couldn't find a code to reproduce the issue on https://getrector.org/demo, does it use the latest 0.10.3 version? (I got this fatal after updating from 0.10.1).
It failed on a trait that used Eloquent properties (but not only), example:
But, that trait is pretty bit, and even the whole trait doesn't cause any reports on https://getrector.org/demo using all rectors and sets we use on the project. I hope it will help somehow.
rectors:
Expected Behaviour
Don’t have a fatal error :)
The text was updated successfully, but these errors were encountered: