From cb55dba78691e9563c2d72ff70ce3e40833fef7a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Tue, 27 Feb 2024 16:43:54 +0100 Subject: [PATCH] Update configureOptions and reverseTransform member function prototypes --- Form/Extension/Type/HiddenEntityType.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Form/Extension/Type/HiddenEntityType.php b/Form/Extension/Type/HiddenEntityType.php index 7521633..f9b27d1 100644 --- a/Form/Extension/Type/HiddenEntityType.php +++ b/Form/Extension/Type/HiddenEntityType.php @@ -40,7 +40,7 @@ class HiddenEntityType extends HiddenType implements DataTransformerInterface { * * {@inheritdoc} */ - public function configureOptions(OptionsResolver $resolver) { + public function configureOptions(OptionsResolver $resolver): void { //Call parent parent::configureOptions($resolver); @@ -102,24 +102,24 @@ class HiddenEntityType extends HiddenType implements DataTransformerInterface { /** * Reverse transformation from string to data object * - * @param string $data The object id + * @param mixed $value The object id * @return mixed The data object */ - public function reverseTransform($data) { - if (!$data) { + public function reverseTransform(mixed $value): mixed { + if (!$value) { return null; } $res = null; try { $rep = $this->dm->getRepository($this->class); - $res = $rep->findOneById($data); + $res = $rep->findOneById($value); } catch (\Exception $e) { throw new TransformationFailedException($e->getMessage()); } if ($res === null) { - throw new TransformationFailedException(sprintf('A %s with id %s does not exist!', $this->class, $data)); + throw new TransformationFailedException(sprintf('A %s with id %s does not exist!', $this->class, $value)); } return $res; -- 2.41.1