From f869d79f0ac922e143148e17c5dcd3dea3dff30a Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Sat, 6 Apr 2024 19:11:17 +0200 Subject: [PATCH] revert some accidental bc breaks --- src/Doctrine/Phpcr/RedirectRoute.php | 22 +++++++++++++++++++ src/Doctrine/Phpcr/Route.php | 22 +++++++++++++++++++ src/Model/RedirectRoute.php | 2 +- .../RouteDefaultsTwigValidator.php | 2 +- 4 files changed, 46 insertions(+), 2 deletions(-) diff --git a/src/Doctrine/Phpcr/RedirectRoute.php b/src/Doctrine/Phpcr/RedirectRoute.php index c9ec3d0b..f821ad66 100644 --- a/src/Doctrine/Phpcr/RedirectRoute.php +++ b/src/Doctrine/Phpcr/RedirectRoute.php @@ -74,6 +74,28 @@ public function getParentDocument(): ?object return $this->parent; } + /** + * @deprecated For BC with the PHPCR-ODM 1.4 HierarchyInterface + * @see setParentDocument + */ + public function setParent($parent) + { + @trigger_error('The '.__METHOD__.'() method is deprecated and will be removed in version 4.0. Use setParentDocument() instead.', \E_USER_DEPRECATED); + + return $this->setParentDocument($parent); + } + + /** + * @deprecated For BC with the PHPCR-ODM 1.4 HierarchyInterface + * @see getParentDocument + */ + public function getParent() + { + @trigger_error('The '.__METHOD__.'() method is deprecated and will be removed in version 4.0. Use getParentDocument() instead.', \E_USER_DEPRECATED); + + return $this->getParentDocument(); + } + /** * Rename a route by setting its new name. * diff --git a/src/Doctrine/Phpcr/Route.php b/src/Doctrine/Phpcr/Route.php index d01256ab..746c8987 100644 --- a/src/Doctrine/Phpcr/Route.php +++ b/src/Doctrine/Phpcr/Route.php @@ -89,6 +89,28 @@ public function getParentDocument(): object return $this->parent; } + /** + * @deprecated For BC with the PHPCR-ODM 1.4 HierarchyInterface + * @see setParentDocument + */ + public function setParent($parent) + { + @trigger_error('The '.__METHOD__.'() method is deprecated and will be removed in version 4.0. Use setParentDocument() instead.', \E_USER_DEPRECATED); + + return $this->setParentDocument($parent); + } + + /** + * @deprecated For BC with the PHPCR-ODM 1.4 HierarchyInterface + * @see getParentDocument + */ + public function getParent() + { + @trigger_error('The '.__METHOD__.'() method is deprecated and will be removed in version 4.0. Use getParentDocument() instead.', \E_USER_DEPRECATED); + + return $this->getParentDocument(); + } + /** * Rename a route by setting its new name. * diff --git a/src/Model/RedirectRoute.php b/src/Model/RedirectRoute.php index aa040106..b913162f 100644 --- a/src/Model/RedirectRoute.php +++ b/src/Model/RedirectRoute.php @@ -45,7 +45,7 @@ class RedirectRoute extends Route implements RedirectRouteInterface * * @throws \LogicException */ - public function setContent(object $document): static + public function setContent($document): static { throw new \LogicException('Do not set a content for the redirect route. It is its own content.'); } diff --git a/src/Validator/Constraints/RouteDefaultsTwigValidator.php b/src/Validator/Constraints/RouteDefaultsTwigValidator.php index f53e7e93..04258dc9 100644 --- a/src/Validator/Constraints/RouteDefaultsTwigValidator.php +++ b/src/Validator/Constraints/RouteDefaultsTwigValidator.php @@ -31,7 +31,7 @@ public function __construct(ControllerResolverInterface $controllerResolver, ?Lo $this->twig = $twig; } - public function validate(mixed $defaults, Constraint $constraint): void + public function validate($defaults, Constraint $constraint) { if (!$constraint instanceof RouteDefaults) { throw new \InvalidArgumentException(sprintf('Expected %s, got %s', RouteDefaults::class, get_class($constraint)));