WebLinkStringRelationsToConstantsRector

Change string link relations in WebLink to use Link constants

 use Symfony\Component\WebLink\Link;

-$link = (new Link('preload', 'https://...'))->withRel('next');
+$link = (new Link(Link::REL_PRELOAD, 'https://...'))->withRel(Link::REL_NEXT);

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Symfony\Symfony44\Rector\MethodCall\WebLinkStringRelationsToConstantsRector;

return RectorConfig::configure()
    ->withRules([
        WebLinkStringRelationsToConstantsRector::class,
    ]);
PACKAGE:  symfony/web-link >= 4.4