You are here

protected function DeprecationAnalyzer::isRectorCovered in Upgrade Status 8.2

Same name and namespace in other branches
  1. 8.3 src/DeprecationAnalyzer.php \Drupal\upgrade_status\DeprecationAnalyzer::isRectorCovered()

Checks whether an error message is covered by rector.

Return value

bool

1 call to DeprecationAnalyzer::isRectorCovered()
DeprecationAnalyzer::categorizeMessage in src/DeprecationAnalyzer.php
Annotate and categorize the error message.

File

src/DeprecationAnalyzer.php, line 585

Class

DeprecationAnalyzer

Namespace

Drupal\upgrade_status

Code

protected function isRectorCovered($string) {

  // Hardcoded lo-fi implementation for now. This should be the same as in
  // https://git.drupalcode.org/project/deprecation_status/-/blob/script/stats.php
  $rector_covered = [
    // 0.3.3
    'Call to deprecated function drupal_set_message(). Deprecated in drupal:8.5.0 and is removed from drupal:9.0.0. Use Drupal\\Core\\Messenger\\MessengerInterface::addMessage() instead.',
    'Call to deprecated method entityManager() of class Drupal. Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use Drupal::entityTypeManager() instead in most cases. If the needed method is not on \\Drupal\\Core\\Entity\\EntityTypeManagerInterface, see the deprecated \\Drupal\\Core\\Entity\\EntityManager to find the correct interface or service.',
    'Call to deprecated method entityManager() of class Drupal\\Core\\Controller\\ControllerBase. Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Most of the time static::entityTypeManager() is supposed to be used instead.',
    'Call to deprecated function db_insert(). Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Instead, get a database connection injected into your service from the container and call insert() on it. For example,',
    'Call to deprecated function db_select(). Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Instead, get a database connection injected into your service from the container and call select() on it. For example,',
    'Call to deprecated function db_query(). Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Instead, get a database connection injected into your service from the container and call query() on it. For example,',
    'Call to deprecated function file_prepare_directory(). Deprecated in drupal:8.7.0 and is removed from drupal:9.0.0. Use Drupal\\Core\\File\\FileSystemInterface::prepareDirectory().',
    'Call to deprecated method getMock() of class Drupal\\Tests\\BrowserTestBase. Deprecated in drupal:8.5.0 and is removed from drupal:9.0.0. Use Drupal\\Tests\\PhpunitCompatibilityTrait::createMock() instead.',
    'Call to deprecated method getMock() of class Drupal\\KernelTests\\KernelTestBase. Deprecated in drupal:8.5.0 and is removed from drupal:9.0.0. Use Drupal\\Tests\\PhpunitCompatibilityTrait::createMock() instead.',
    'Call to deprecated method getMock() of class Drupal\\Tests\\UnitTestCase. Deprecated in drupal:8.5.0 and is removed from drupal:9.0.0. Use Drupal\\Tests\\PhpunitCompatibilityTrait::createMock() instead.',
    'Call to deprecated method url() of class Drupal. Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Instead create a \\Drupal\\Core\\Url object directly, for example using Url::fromRoute().',
    // 0.4.0
    'Call to deprecated function format_date(). Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use Drupal::service(\'date.formatter\')->format().',
    'Call to deprecated method strtolower() of class Drupal\\Component\\Utility\\Unicode. Deprecated in drupal:8.6.0 and is removed from drupal:9.0.0. Use mb_strtolower() instead.',
    'Call to deprecated constant FILE_CREATE_DIRECTORY: Deprecated in drupal:8.7.0 and is removed from drupal:9.0.0. Use Drupal\\Core\\File\\FileSystemInterface::CREATE_DIRECTORY.',
    'Call to deprecated constant FILE_EXISTS_REPLACE: Deprecated in drupal:8.7.0 and is removed from drupal:9.0.0. Use Drupal\\Core\\File\\FileSystemInterface::EXISTS_REPLACE.',
    'Call to deprecated method l() of class Drupal. Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use Drupal\\Core\\Link::fromTextAndUrl() instead.',
    'Call to deprecated function drupal_render(). Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use the',
    'Call to deprecated function drupal_render_root(). Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use Drupal\\Core\\Render\\RendererInterface::renderRoot() instead.',
    // 0.5.0
    'Call to deprecated function file_unmanaged_save_data(). Deprecated in drupal:8.7.0 and is removed from drupal:9.0.0. Use Drupal\\Core\\File\\FileSystemInterface::saveData().',
    // 0.5.1
    'Call to deprecated constant FILE_MODIFY_PERMISSIONS: Deprecated in drupal:8.7.0 and is removed from drupal:9.0.0. Use Drupal\\Core\\File\\FileSystemInterface::MODIFY_PERMISSIONS.',
    'Call to deprecated function db_delete(). Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Instead, get a database connection injected into your service from the container and call delete() on it. For example,',
    // 0.5.2
    'Call to deprecated function entity_get_form_display(). Deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use EntityDisplayRepositoryInterface::getFormDisplay() instead.',
    'Call to deprecated function entity_get_display(). Deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use EntityDisplayRepositoryInterface::getViewDisplay() instead.',
    'Call to deprecated const REQUEST_TIME. Deprecated in drupal:8.3.0 and is removed from drupal:10.0.0. Use Drupal::time()->getRequestTime().',
    'Call to deprecated method urlInfo() of class Drupal\\Core\\Entity\\EntityInterface. Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use Drupal\\Core\\Entity\\EntityInterface::toUrl() instead.',
    'Call to deprecated function file_scan_directory(). Deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use Drupal\\Core\\File\\FileSystemInterface::scanDirectory() instead.',
    'Call to deprecated function file_default_scheme(). Deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use Drupal::config(\'system.file\')->get(\'default_scheme\') instead.',
    'Call to deprecated function db_update(). Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Instead, get a database connection injected into your service from the container and call update() on it. For example,',
    // 0.5.3
    'Call to deprecated method strtolower() of class Drupal\\Component\\Utility\\Unicode. Deprecated in drupal:8.6.0 and is removed from drupal:9.0.0. Use mb_strtolower() instead.',
    'Call to deprecated method strlen() of class Drupal\\Component\\Utility\\Unicode. Deprecated in drupal:8.6.0 and is removed from drupal:9.0.0. Use mb_strlen() instead.',
    'Call to deprecated method link() of class Drupal\\Core\\Entity\\EntityInterface. Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use Drupal\\Core\\EntityInterface::toLink()->toString() instead.',
    'Call to deprecated function entity_load(). Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use the entity type storage\'s load() method.',
    'Call to deprecated function node_load(). Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use Drupal\\node\\Entity\\Node::load().',
    'Call to deprecated function file_load(). Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use Drupal\\file\\Entity\\File::load().',
    'Call to deprecated function user_load(). Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use Drupal\\user\\Entity\\User::load().',
    'Call to deprecated function file_directory_temp(). Deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use Drupal\\Core\\File\\FileSystemInterface::getTempDirectory() instead.',
    'Call to deprecated function file_directory_os_temp(). Deprecated in drupal:8.3.0 and is removed from drupal:9.0.0. Use Drupal\\Component\\FileSystem\\FileSystem::getOsTemporaryDirectory().',
    'Call to deprecated function drupal_realpath(). Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use Drupal\\Core\\File\\FileSystem::realpath().',
    'Call to deprecated function file_uri_target(). Deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use Drupal\\Core\\StreamWrapper\\StreamWrapperManagerInterface::getTarget() instead.',
    // 0.5.4
    'Call to deprecated method format() of class Drupal\\Component\\Utility\\SafeMarkup. Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use Drupal\\Component\\Render\\FormattableMarkup.',
    'Call to deprecated constant FILE_EXISTS_RENAME: Deprecated in drupal:8.7.0 and is removed from drupal:9.0.0. Use Drupal\\Core\\File\\FileSystemInterface::EXISTS_RENAME.',
    // Covered below with the pattern.

    //'Call to deprecated method l() of class [redacted]. Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use Drupal\Core\Link::fromTextAndUrl() instead.',
    'Call to deprecated function entity_create(). Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use The method overriding Entity::create() for the entity type, e.g. \\Drupal\\node\\Entity\\Node::create() if the entity type is known. If the entity type is variable, use the entity storage\'s create() method to construct a new entity:',
    // 0.5.5
    // No new rules
    // 0.5.6
    'Call to deprecated constant DATETIME_STORAGE_TIMEZONE: Deprecated in drupal:8.5.0 and is removed from drupal:9.0.0. Use Drupal\\datetime\\Plugin\\Field\\FieldType\\DateTimeItemInterface::STORAGE_TIMEZONE instead.',
    'Call to deprecated constant DATETIME_DATETIME_STORAGE_FORMAT: Deprecated in drupal:8.5.0 and is removed from drupal:9.0.0. Use Drupal\\datetime\\Plugin\\Field\\FieldType\\DateTimeItemInterface::DATETIME_STORAGE_FORMAT instead.',
    'Call to deprecated constant DATETIME_DATE_STORAGE_FORMAT: Deprecated in drupal:8.5.0 and is removed from drupal:9.0.0. Use Drupal\\datetime\\Plugin\\Field\\FieldType\\DateTimeItemInterface::DATE_STORAGE_FORMAT instead.',
  ];
  return in_array($string, $rector_covered) || strpos($string, 'Call to deprecated method l() of class Drupal') === 0;
}