-
Notifications
You must be signed in to change notification settings - Fork 93
[Symfony 7.3] kick off GetFunctionsToAsTwigFunctionAttributeRector #764
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
2b2f050
to
14b33b7
Compare
14b33b7
to
558f0ca
Compare
public function match(Expr $expr): ?string | ||
{ | ||
if ($expr instanceof MethodCall) { | ||
Assert::isInstanceOf($expr->name, Identifier::class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MethodCall name can be any Expr, eg variable: $foo->$bar()
so this assert can cause error, should if instanceof Identifier instanceof instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will update 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we go
#766
if ($expr instanceof MethodCall) { | ||
Assert::isInstanceOf($expr->name, Identifier::class); | ||
|
||
return $expr->name->toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should only verify against $this
only, as per previous approach, other object may need ClassName argument instead
return null; | ||
} | ||
|
||
if ($methodName !== 'this') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be $varObjectName
or something similar to avoid confusion of method name named "this"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you resolve these? I'm already in another rule
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will try
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created PR :
for it.
Follow up to #761
Ref https://symfony.com/blog/new-in-symfony-7-3-twig-extension-attributes
Covering symfony/symfony#52748
Closes #760