-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
[Step 6 Upgrade] Add PHP 8+ Attributes support #130
Conversation
Hello, @samsonasik! Do you plan to add actual |
Hi @lisachenko , yes, I will try it in this PR |
@lisachenko I added failing test case with stub with throw RuntimeException inside it, do you mean unit test should not show error even it has
If I remove the
I tried cheking from the node from its reflector and got segmentation fault:
public function getAttributes(?string $name = null, int $flags = 0): array
{
$node = $this->getNode();
$attributes = [];
foreach ($node->attrGroups as $attrGroup) {
foreach ($attrGroup->attrs as $attr) {
if ($name === null) {
$attributes[] = new ReflectionAttribute($attr->name->toString(), $this);
continue;
}
if ($name !== $attr->name->toString()) {
continue;
}
$attributes[] = new ReflectionAttribute($name, $this);
}
}
return $attributes;
} |
@lisachenko I added handling get Attributes by AST 9a2bb99 , not sure yet on |
@lisachenko I updated to get Line via Node which go to end of |
implemented 🎉 @lisachenko Ready to merge 👍 |
Wow! This was fast! )) I've tested it for the class and method - it works!! 🚀 There is only gotcha with properties (would be nice to add a test for this) - for ReflectionProperty attributes are stored not inside
For ReflectionParameter, attribute also generates this deprecation notice: |
We can skip this function implementation, or just delegate to the parent call. I guess, it should load the attribute class into memory, then check the bitmask for which type of items this attribute should be applied. We don't need this functionality now. |
@lisachenko sure, resolved at eefee84 on getting attrGroups from |
I also updated |
@samsonasik could you please check X/Twitter private messages BTW? ) Need some info |
@lisachenko yes, replied 👍 |
implemented 🎉 @lisachenko Ready to merge 👍 |
Merged, thanks! |
The inspection completed: No new issues |
@lisachenko here the 6th step 👍 , to add attributes support.