class CoreComposerValidator in Automatic Updates 8.2
Validates the Drupal core requirements defined in composer.json.
Hierarchy
- class \Drupal\automatic_updates\Validator\CoreComposerValidator implements \Symfony\Component\EventDispatcher\EventSubscriberInterface uses StringTranslationTrait
Expanded class hierarchy of CoreComposerValidator
1 string reference to 'CoreComposerValidator'
1 service uses CoreComposerValidator
File
- src/
Validator/ CoreComposerValidator.php, line 14
Namespace
Drupal\automatic_updates\ValidatorView source
class CoreComposerValidator implements EventSubscriberInterface {
use StringTranslationTrait;
/**
* Validates the Drupal core requirements in composer.json.
*
* @param \Drupal\automatic_updates\Event\ReadinessCheckEvent $event
* The event object.
*/
public function checkCoreRequirements(ReadinessCheckEvent $event) : void {
// Ensure that either drupal/core or drupal/core-recommended is required.
// If neither is, then core cannot be updated, which we consider an error
// condition.
$core_requirements = array_intersect($event
->getActiveComposer()
->getCorePackageNames(), [
'drupal/core',
'drupal/core-recommended',
]);
if (empty($core_requirements)) {
$error = ValidationResult::createError([
$this
->t('Drupal core does not appear to be required in the project-level composer.json.'),
]);
$event
->addValidationResult($error);
}
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
return [
AutomaticUpdatesEvents::READINESS_CHECK => [
'checkCoreRequirements',
1000,
],
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CoreComposerValidator:: |
public | function | Validates the Drupal core requirements in composer.json. | |
CoreComposerValidator:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |