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.
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:The loaded arguments will be:
Expected Behavior
The loaded arguments should be:
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.