-
-
Notifications
You must be signed in to change notification settings - Fork 737
Closed
Labels
Description
Bug Report
| Subject | Details |
|---|---|
| Rector version | last dev-main |
| Installed as | composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.com/demo/efca927e-4095-4113-b668-bb172720d9e7
<?php
declare(strict_types=1);
namespace OCP\AppFramework\Http\Attribute;
use Attribute;
/**
* Attribute for controller methods that want to protect passwords, keys, tokens
* or other data against brute force
*
* @since 27.0.0
*/
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
class BruteForceProtection {
/**
* @since 27.0.0
*/
public function __construct(
protected string $action
) {
}
/**
* @since 27.0.0
*/
public function getAction(): string {
return $this->action;
}
}
namespace App\Test\Cases\Domain\Value;
use PHPUnit\Framework\TestCase;
final class RectorTest extends TestCase
{
/**
* @BruteForceProtection(action=login)
*/
public function testMethod() {
}
}Responsible rules
AnnotationToAttributeRector
Expected Behavior
Rector should keep the parameters for the annotation, according to the rule documentation: https://getrector.com/rule-detail/annotation-to-attribute-rector
But currently it loses the parameters. I tried setting useValueAsAttributeArgument to true, but that passes all parameters as one string.
I see that in some situation previous annotations were already classes, but in our case that’s not true, it was standard phpdoc tags that we are replacing with attributes. Is there any way to do that?