RemoveRendererAddCacheableDependencyNonObjectRector
Remove RendererInterface::addCacheableDependency() calls where the dependency argument cannot implement CacheableDependencyInterface (bool, int, float, string, null, array). Such calls silently make pages uncacheable and are deprecated in drupal:11.3.0.
-$build = ['#markup' => 'Hello'];
-$this->renderer->addCacheableDependency($build, false);
+$build = ['#markup' => 'Hello'];
Configure your rector.php:
<?php
use DrupalRector\Drupal11\Rector\Deprecation\RemoveRendererAddCacheableDependencyNonObjectRector;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withRules([
RemoveRendererAddCacheableDependencyNonObjectRector::class,
]);