Configurable

ConstantToClassConstantRector

Fixes deprecated constant use, used in Drupal 8 and later deprecations

-$result = file_unmanaged_copy($source, $destination, DEPRECATED_CONSTANT);
+$result = file_unmanaged_copy($source, $destination, \Drupal\MyClass::CONSTANT);

Configure your rector.php:

<?php

use DrupalRector\Rector\Deprecation\ConstantToClassConstantRector;
use DrupalRector\Rector\ValueObject\ConstantToClassConfiguration;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withConfiguredRule(ConstantToClassConstantRector::class, [
        new ConstantToClassConfiguration('DEPRECATED_CONSTANT', 'Drupal\MyClass', 'CONSTANT', '8.0.0'),
    ]);