Skip to content
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

Attributes are not loaded correctly #98

Closed
alanpoulain opened this issue Nov 22, 2021 · 2 comments
Closed

Attributes are not loaded correctly #98

alanpoulain opened this issue Nov 22, 2021 · 2 comments

Comments

@alanpoulain
Copy link

Version: 3.6.4

Bug Description

When loading from the code (PhpFile::fromCode($content)), attribute arguments are not loaded as expected: arguments are "duplicated".
For instance, with this attribute:

#[AnAttribute(foo: 'bar')]

The loaded arguments will be:

$args = ['foo' => new Literal("foo: 'bar'")];

Expected Behavior

The loaded arguments should be:

$args = ['foo' => new Literal("'bar'")];

Possible Solution

The issue comes from the call to getReformattedContents which gets everything inside the attribute as raw. It shouldn't be the case when loading content.

@alanpoulain
Copy link
Author

Thanks!

@dg
Copy link
Member

dg commented Nov 22, 2021

You're welcome

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

No branches or pull requests

2 participants