Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Merged
merged 1 commit into from
May 9, 2025

Conversation

TomasVotruba
Copy link
Member

@TomasVotruba TomasVotruba commented May 9, 2025

@TomasVotruba TomasVotruba force-pushed the tv-twig-function-attribute branch 2 times, most recently from 2b2f050 to 14b33b7 Compare May 9, 2025 07:24
@TomasVotruba TomasVotruba force-pushed the tv-twig-function-attribute branch from 14b33b7 to 558f0ca Compare May 9, 2025 07:27
@TomasVotruba TomasVotruba merged commit 8810ce6 into main May 9, 2025
5 checks passed
@TomasVotruba TomasVotruba deleted the tv-twig-function-attribute branch May 9, 2025 07:32
@TomasVotruba TomasVotruba changed the title kick off GetFunctionsToAsTwigFunctionAttributeRector [7.3] kick off GetFunctionsToAsTwigFunctionAttributeRector May 9, 2025
@TomasVotruba TomasVotruba changed the title [7.3] kick off GetFunctionsToAsTwigFunctionAttributeRector [Symfony 7.3] kick off GetFunctionsToAsTwigFunctionAttributeRector May 9, 2025
public function match(Expr $expr): ?string
{
if ($expr instanceof MethodCall) {
Assert::isInstanceOf($expr->name, Identifier::class);
Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will update 👍

Copy link
Member Author

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();
Copy link
Member

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') {
Copy link
Member

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"

Copy link
Member Author

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will try

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[symfony 7.3] Add twig function attribute
2 participants