From: Raphaƫl Gertz Date: Tue, 27 Feb 2024 15:43:54 +0000 (+0100) Subject: Update configureOptions and reverseTransform member function prototypes X-Git-Tag: 0.3.0~52 X-Git-Url: https://git.rapsys.eu/airbundle/commitdiff_plain/cb55dba78691e9563c2d72ff70ce3e40833fef7a Update configureOptions and reverseTransform member function prototypes --- 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;