Unverified Commit 1201aa82 authored by alexpott's avatar alexpott
Browse files

Issue #3255245 by Spokje, longwave, daffie, Gábor Hojtsy, Taran2L, murilohp:...

Issue #3255245 by Spokje, longwave, daffie, Gábor Hojtsy, Taran2L, murilohp: [Symfony 6] Revert 3231603 to use our own TranslatorInterface

(cherry picked from commit d28e89ba)
parent 7105aa27
......@@ -8,11 +8,11 @@
use Drupal\Core\DependencyInjection\DependencySerializationTrait;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\DefaultPluginManager;
use Drupal\Core\TypedData\Validation\ExecutionContextFactory;
use Drupal\Core\TypedData\Validation\RecursiveValidator;
use Drupal\Core\Validation\ConstraintManager;
use Drupal\Core\Validation\ConstraintValidatorFactory;
use Drupal\Core\Validation\DrupalTranslator;
use Symfony\Component\Validator\Context\ExecutionContextFactory;
use Symfony\Component\Validator\Validator\ValidatorInterface;
/**
......
......@@ -17,10 +17,6 @@
*
* We do not use the builder provided by Symfony as it is marked internal.
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use the class
* \Symfony\Component\Validator\Violation\ConstraintViolationBuilder instead.
*
* @see https://www.drupal.org/node/3238432
*/
class ConstraintViolationBuilder implements ConstraintViolationBuilderInterface {
......@@ -125,7 +121,6 @@ class ConstraintViolationBuilder implements ConstraintViolationBuilderInterface
*/
public function __construct(ConstraintViolationList $violations, Constraint $constraint, $message, array $parameters, $root, $propertyPath, $invalidValue, TranslatorInterface $translator, $translationDomain = null)
{
@trigger_error(__CLASS__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use the class \Symfony\Component\Validator\Violation\ConstraintViolationBuilder instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
$this->violations = $violations;
$this->message = $message;
$this->parameters = $parameters;
......@@ -139,16 +134,9 @@ public function __construct(ConstraintViolationList $violations, Constraint $con
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Violation\ConstraintViolationBuilder::atPath()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function atPath($path)
{
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Violation\ConstraintViolationBuilder::atPath() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
$this->propertyPath = PropertyPath::append($this->propertyPath, $path);
return $this;
......@@ -156,16 +144,9 @@ public function atPath($path)
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Violation\ConstraintViolationBuilder::setParameter()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function setParameter($key, $value)
{
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Violation\ConstraintViolationBuilder::setParameter() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
$this->parameters[$key] = $value;
return $this;
......@@ -173,16 +154,9 @@ public function setParameter($key, $value)
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Violation\ConstraintViolationBuilder::setParameters()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function setParameters(array $parameters)
{
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Violation\ConstraintViolationBuilder::setParameters() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
$this->parameters = $parameters;
return $this;
......@@ -190,16 +164,9 @@ public function setParameters(array $parameters)
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Violation\ConstraintViolationBuilder::setTranslationDomain()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function setTranslationDomain($translationDomain)
{
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Violation\ConstraintViolationBuilder::setTranslationDomain() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
$this->translationDomain = $translationDomain;
return $this;
......@@ -207,16 +174,9 @@ public function setTranslationDomain($translationDomain)
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Violation\ConstraintViolationBuilder::setInvalidValue()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function setInvalidValue($invalidValue)
{
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Violation\ConstraintViolationBuilder::setInvalidValue() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
$this->invalidValue = $invalidValue;
return $this;
......@@ -224,16 +184,9 @@ public function setInvalidValue($invalidValue)
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Violation\ConstraintViolationBuilder::setPlural()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function setPlural($number)
{
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Violation\ConstraintViolationBuilder::setPlural() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
$this->plural = $number;
return $this;
......@@ -241,16 +194,9 @@ public function setPlural($number)
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Violation\ConstraintViolationBuilder::setCode()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function setCode($code)
{
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Violation\ConstraintViolationBuilder::setCode() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
$this->code = $code;
return $this;
......@@ -258,16 +204,9 @@ public function setCode($code)
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Violation\ConstraintViolationBuilder::setCause()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function setCause($cause)
{
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Violation\ConstraintViolationBuilder::setCause() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
$this->cause = $cause;
return $this;
......@@ -275,16 +214,9 @@ public function setCause($cause)
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Violation\ConstraintViolationBuilder::addViolation()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function addViolation()
{
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Violation\ConstraintViolationBuilder::addViolation() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
if (null === $this->plural) {
$translatedMessage = $this->translator->trans(
$this->message,
......
......@@ -18,11 +18,6 @@
* We do not use the context provided by Symfony as it is marked internal, so
* this class is pretty much the same, but has some code style changes as well
* as exceptions for methods we don't support.
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use the class
* \Symfony\Component\Validator\Context\ExecutionContext instead.
*
* @see https://www.drupal.org/node/3238432
*/
class ExecutionContext implements ExecutionContextInterface {
......@@ -127,7 +122,6 @@ class ExecutionContext implements ExecutionContextInterface {
* Should not be used in user code.
*/
public function __construct(ValidatorInterface $validator, $root, TranslatorInterface $translator, $translationDomain = NULL) {
@trigger_error(__CLASS__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use the class \Symfony\Component\Validator\Context\ExecutionContext instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
$this->validator = $validator;
$this->root = $root;
$this->translator = $translator;
......@@ -137,15 +131,8 @@ public function __construct(ValidatorInterface $validator, $root, TranslatorInte
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Context\ExecutionContext::setNode()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function setNode($value, $object, MetadataInterface $metadata = NULL, $propertyPath) {
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Context\ExecutionContext::setNode() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
$this->value = $value;
$this->data = $object;
$this->metadata = $metadata;
......@@ -154,43 +141,22 @@ public function setNode($value, $object, MetadataInterface $metadata = NULL, $pr
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Context\ExecutionContext::setGroup()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function setGroup($group) {
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Context\ExecutionContext::setGroup() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
$this->group = $group;
}
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Context\ExecutionContext::setConstraint()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function setConstraint(Constraint $constraint) {
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Context\ExecutionContext::setConstraint() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
$this->constraint = $constraint;
}
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Context\ExecutionContext::addViolation()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function addViolation($message, array $parameters = [], $invalidValue = NULL, $plural = NULL, $code = NULL) {
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Context\ExecutionContext::addViolation() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
// The parameters $invalidValue and following are ignored by the new
// API, as they are not present in the new interface anymore.
// You should use buildViolation() instead.
......@@ -203,295 +169,148 @@ public function addViolation($message, array $parameters = [], $invalidValue = N
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Context\ExecutionContext::buildViolation()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function buildViolation($message, array $parameters = []): ConstraintViolationBuilderInterface {
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Context\ExecutionContext::buildViolation() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
return new ConstraintViolationBuilder($this->violations, $this->constraint, $message, $parameters, $this->root, $this->propertyPath, $this->value, $this->translator, $this->translationDomain);
}
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Context\ExecutionContext::getViolations()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function getViolations() {
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Context\ExecutionContext::getViolations() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
return $this->violations;
}
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Context\ExecutionContext::getValidator()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function getValidator() {
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Context\ExecutionContext::getValidator() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
return $this->validator;
}
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Context\ExecutionContext::getRoot()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function getRoot() {
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Context\ExecutionContext::getRoot() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
return $this->root;
}
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Context\ExecutionContext::getValue()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function getValue() {
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Context\ExecutionContext::getValue() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
return $this->value;
}
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Context\ExecutionContext::getObject()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function getObject(): ?object {
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Context\ExecutionContext::getObject() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
return $this->data;
}
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Context\ExecutionContext::getMetadata()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function getMetadata(): ?MetadataInterface {
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Context\ExecutionContext::getMetadata() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
return $this->metadata;
}
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Context\ExecutionContext::getGroup()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function getGroup(): ?string {
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Context\ExecutionContext::getGroup() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
return Constraint::DEFAULT_GROUP;
}
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Context\ExecutionContext::getClassName()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function getClassName(): ?string {
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Context\ExecutionContext::getClassName() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
return get_class($this->data);
}
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Context\ExecutionContext::getPropertyName()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function getPropertyName(): ?string {
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Context\ExecutionContext::getPropertyName() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
return $this->data->getName();
}
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Context\ExecutionContext::getPropertyPath()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function getPropertyPath($sub_path = ''): string {
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Context\ExecutionContext::getPropertyPath() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
return PropertyPath::append($this->propertyPath, $sub_path);
}
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Context\ExecutionContext::addViolationAt()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function addViolationAt($subPath, $message, array $parameters = [], $invalidValue = NULL, $plural = NULL, $code = NULL) {
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Context\ExecutionContext::addViolationAt() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
throw new \LogicException('Legacy validator API is unsupported.');
}
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Context\ExecutionContext::validate()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function validate($value, $subPath = '', $groups = NULL, $traverse = FALSE, $deep = FALSE) {
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Context\ExecutionContext::validate() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
throw new \LogicException('Legacy validator API is unsupported.');
}
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Context\ExecutionContext::markConstraintAsValidated()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function markConstraintAsValidated($cache_key, $constraint_hash) {
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Context\ExecutionContext::markConstraintAsValidated() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
$this->validatedConstraints[$cache_key . ':' . $constraint_hash] = TRUE;
}
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Context\ExecutionContext::isConstraintValidated()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function isConstraintValidated($cache_key, $constraint_hash) {
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Context\ExecutionContext::isConstraintValidated() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
return isset($this->validatedConstraints[$cache_key . ':' . $constraint_hash]);
}
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Context\ExecutionContext::validateValue()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function validateValue($value, $constraints, $subPath = '', $groups = NULL) {
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Context\ExecutionContext::validateValue() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
throw new \LogicException('Legacy validator API is unsupported.');
}
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Context\ExecutionContext::markGroupAsValidated()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function markGroupAsValidated($cache_key, $group_hash) {
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Context\ExecutionContext::markGroupAsValidated() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
$this->validatedObjects[$cache_key][$group_hash] = TRUE;
}
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Context\ExecutionContext::isGroupValidated()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function isGroupValidated($cache_key, $group_hash) {
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Context\ExecutionContext::isGroupValidated() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
return isset($this->validatedObjects[$cache_key][$group_hash]);
}
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Context\ExecutionContext::markObjectAsInitialized()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function markObjectAsInitialized($cache_key) {
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Context\ExecutionContext::markObjectAsInitialized() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
// Not supported, so nothing todo.
}
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Context\ExecutionContext::isObjectInitialized()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function isObjectInitialized($cache_key) {
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Context\ExecutionContext::isObjectInitialized() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
// Not supported, so nothing todo.
}
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Context\ExecutionContext::getMetadataFactory()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function getMetadataFactory() {
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Context\ExecutionContext::getMetadataFactory() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
throw new \LogicException('Legacy validator API is unsupported.');
}
......
......@@ -11,11 +11,6 @@
* Defines an execution factory for the Typed Data validator.
*
* We do not use the factory provided by Symfony as it is marked internal.
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use the class
* \Symfony\Component\Validator\Context\ExecutionContextFactory instead.
*
* @see https://www.drupal.org/node/3238432
*/
class ExecutionContextFactory implements ExecutionContextFactoryInterface {
......@@ -38,22 +33,14 @@ class ExecutionContextFactory implements ExecutionContextFactoryInterface {
* (optional) The translation domain.
*/
public function __construct(TranslatorInterface $translator, $translationDomain = NULL) {
@trigger_error(__CLASS__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use the class \Symfony\Component\Validator\Context\ExecutionContextFactory instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
$this->translator = $translator;
$this->translationDomain = $translationDomain;
}
/**
* {@inheritdoc}
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Symfony\Component\Validator\Context\ExecutionContextFactory::createContext()
* instead.
*
* @see https://www.drupal.org/node/3238432
*/
public function createContext(ValidatorInterface $validator, $root): ExecutionContextInterface {
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Symfony\Component\Validator\Context\ExecutionContextFactory::createContext() instead. See https://www.drupal.org/node/3238432', E_USER_DEPRECATED);
return new ExecutionContext(
$validator,
$root,
......
......@@ -4,7 +4,6 @@
use Drupal\Component\Render\MarkupInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Symfony\Contracts\Translation\TranslatorInterface;
/**
* Translates strings using Drupal's translation system.
......@@ -29,27 +28,13 @@ public function trans($id, array $parameters = [], $domain = NULL, $locale = NUL
if ($id instanceof TranslatableMarkup) {
return $id;
}