I couldn't find anything else demonstrating this so here's the rector config I used in case it's any use to someone else
<?php
declare(strict_types=1);
use Laminas\Form\Annotation\AllowEmpty;
use Laminas\Form\Annotation\Filter;
use Laminas\Form\Annotation\Name;
use Laminas\Form\Annotation\Required;
use Laminas\Form\Annotation\Validator;
use Rector\Config\RectorConfig;
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
use Rector\Php80\Rector\Class_\AnnotationToAttributeRector;
use Rector\Php80\ValueObject\AnnotationToAttribute;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/module/Application/src',
]);
$rectorConfig->importNames();
$rectorConfig->ruleWithConfiguration(
AnnotationToAttributeRector::class,
[
new AnnotationToAttribute(Filter::class),
new AnnotationToAttribute(Name::class),
new AnnotationToAttribute(Required::class),
new AnnotationToAttribute(Validator::class),
new AnnotationToAttribute(AllowEmpty::class),
]);
$rectorConfig->rule(StringClassNameToClassConstantRector::class);
};
You will almost certainly need to change the config paths, and add any missing Annotations to the array
Top comments (0)