Configurable
ReplaceCommentManagerGetCountNewCommentsRector
Replaces deprecated CommentManagerInterface::getCountNewComments() with HistoryManager service
-$this->commentManager->getCountNewComments($entity);
+\Drupal::service(\Drupal\history\HistoryManager::class)->getCountNewComments($entity);
Configure your rector.php:
<?php
use DrupalRector\Drupal11\Rector\Deprecation\ReplaceCommentManagerGetCountNewCommentsRector;
use DrupalRector\Rector\ValueObject\DrupalIntroducedVersionConfiguration;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withConfiguredRule(ReplaceCommentManagerGetCountNewCommentsRector::class, [
new DrupalIntroducedVersionConfiguration('11.3.0'),
]);