public function CoreComposerValidator::checkCoreRequirements in Automatic Updates 8.2
Validates the Drupal core requirements in composer.json.
Parameters
\Drupal\automatic_updates\Event\ReadinessCheckEvent $event: The event object.
File
- src/
Validator/ CoreComposerValidator.php, line 24
Class
- CoreComposerValidator
- Validates the Drupal core requirements defined in composer.json.
Namespace
Drupal\automatic_updates\ValidatorCode
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);
}
}