From ce709cb8bfadf1586ab416b3894f3535689fd906 Mon Sep 17 00:00:00 2001 From: Lucas dos Santos Abreu Date: Thu, 29 Oct 2020 15:18:14 -0300 Subject: [PATCH 1/2] (feat): add stubs for symfony/serializer interfaces --- extension.neon | 8 +++++++ stubs/ContextAwareDecoderInterface.stub | 13 ++++++++++++ stubs/ContextAwareDenormalizerInterface.stub | 14 +++++++++++++ stubs/ContextAwareNormalizerInterface.stub | 14 +++++++++++++ stubs/DecoderInterface.stub | 22 ++++++++++++++++++++ stubs/DenormalizableInterface.stub | 16 ++++++++++++++ stubs/EncoderInterface.stub | 20 ++++++++++++++++++ stubs/NormalizableInterface.stub | 14 +++++++++++++ stubs/NormalizerInterface.stub | 14 +++++++++++++ 9 files changed, 135 insertions(+) create mode 100644 stubs/ContextAwareDecoderInterface.stub create mode 100644 stubs/ContextAwareDenormalizerInterface.stub create mode 100644 stubs/ContextAwareNormalizerInterface.stub create mode 100644 stubs/DecoderInterface.stub create mode 100644 stubs/DenormalizableInterface.stub create mode 100644 stubs/EncoderInterface.stub create mode 100644 stubs/NormalizableInterface.stub create mode 100644 stubs/NormalizerInterface.stub diff --git a/extension.neon b/extension.neon index 9b0c264c..a66d9a5f 100644 --- a/extension.neon +++ b/extension.neon @@ -7,6 +7,12 @@ parameters: - stubs/ChoiceLoaderInterface.stub - stubs/Constraint.stub - stubs/ContainerBuilder.stub + - stubs/ContextAwareDecoderInterface.stub + - stubs/ContextAwareDenormalizerInterface.stub + - stubs/ContextAwareNormalizerInterface.stub + - stubs/DecoderInterface.stub + - stubs/DenormalizableInterface.stub + - stubs/EncoderInterface.stub - stubs/EventSubscriberInterface.stub - stubs/ExtensionInterface.stub - stubs/FormBuilderInterface.stub @@ -15,6 +21,8 @@ parameters: - stubs/FormTypeInterface.stub - stubs/FormView.stub - stubs/HeaderBag.stub + - stubs/NormalizableInterface.stub + - stubs/NormalizerInterface.stub - stubs/Process.stub - stubs/Session.stub diff --git a/stubs/ContextAwareDecoderInterface.stub b/stubs/ContextAwareDecoderInterface.stub new file mode 100644 index 00000000..39e12d2f --- /dev/null +++ b/stubs/ContextAwareDecoderInterface.stub @@ -0,0 +1,13 @@ + $context + * @return bool + */ + public function supportsDecoding($format, array $context = []); +} diff --git a/stubs/ContextAwareDenormalizerInterface.stub b/stubs/ContextAwareDenormalizerInterface.stub new file mode 100644 index 00000000..4c3bdbc8 --- /dev/null +++ b/stubs/ContextAwareDenormalizerInterface.stub @@ -0,0 +1,14 @@ + $context + * @return bool + */ + public function supportsDenormalization($data, $type, $format = null, array $context = []); +} diff --git a/stubs/ContextAwareNormalizerInterface.stub b/stubs/ContextAwareNormalizerInterface.stub new file mode 100644 index 00000000..282354a8 --- /dev/null +++ b/stubs/ContextAwareNormalizerInterface.stub @@ -0,0 +1,14 @@ + $context + * @return bool + */ + public function supportsNormalization($data, $format = null, array $context = []); +} diff --git a/stubs/DecoderInterface.stub b/stubs/DecoderInterface.stub new file mode 100644 index 00000000..715dadc4 --- /dev/null +++ b/stubs/DecoderInterface.stub @@ -0,0 +1,22 @@ + $context + * @return mixed + */ + public function decode($data, $format, array $context = []); + + /** + * @param string $format Format name + * @return bool + */ + public function supportsDecoding($format); +} diff --git a/stubs/DenormalizableInterface.stub b/stubs/DenormalizableInterface.stub new file mode 100644 index 00000000..3aae90ab --- /dev/null +++ b/stubs/DenormalizableInterface.stub @@ -0,0 +1,16 @@ +|string|int|float|bool $data + * @param string|null $format + * @param array $context + * + * @return object|object[] + */ + public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = []); +} diff --git a/stubs/EncoderInterface.stub b/stubs/EncoderInterface.stub new file mode 100644 index 00000000..a3092757 --- /dev/null +++ b/stubs/EncoderInterface.stub @@ -0,0 +1,20 @@ + $context + * @return string|int|float|bool + */ + public function encode($data, $format, array $context = []); + + /** + * @param string $format Format name + * @return bool + */ + public function supportsEncoding($format); +} diff --git a/stubs/NormalizableInterface.stub b/stubs/NormalizableInterface.stub new file mode 100644 index 00000000..c7958c55 --- /dev/null +++ b/stubs/NormalizableInterface.stub @@ -0,0 +1,14 @@ + $context + * @return array|string|int|float|bool + */ + public function normalize(NormalizerInterface $normalizer, $format = null, array $context = []); +} diff --git a/stubs/NormalizerInterface.stub b/stubs/NormalizerInterface.stub new file mode 100644 index 00000000..907e296e --- /dev/null +++ b/stubs/NormalizerInterface.stub @@ -0,0 +1,14 @@ + $context + * @return array|string|int|float|bool|null + */ + public function normalize($object, $format = null, array $context = []); +} From 1b01335de91f7986a219d2d1ed0fc10f7095d138 Mon Sep 17 00:00:00 2001 From: Lucas dos Santos Abreu Date: Thu, 29 Oct 2020 17:29:33 -0300 Subject: [PATCH 2/2] (fix): missing DenormalizerInterface --- extension.neon | 1 + stubs/DenormalizableInterface.stub | 2 +- stubs/DenormalizerInterface.stub | 23 +++++++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 stubs/DenormalizerInterface.stub diff --git a/extension.neon b/extension.neon index a66d9a5f..272f1343 100644 --- a/extension.neon +++ b/extension.neon @@ -12,6 +12,7 @@ parameters: - stubs/ContextAwareNormalizerInterface.stub - stubs/DecoderInterface.stub - stubs/DenormalizableInterface.stub + - stubs/DenormalizerInterface.stub - stubs/EncoderInterface.stub - stubs/EventSubscriberInterface.stub - stubs/ExtensionInterface.stub diff --git a/stubs/DenormalizableInterface.stub b/stubs/DenormalizableInterface.stub index 3aae90ab..17d6b118 100644 --- a/stubs/DenormalizableInterface.stub +++ b/stubs/DenormalizableInterface.stub @@ -12,5 +12,5 @@ interface DenormalizableInterface * * @return object|object[] */ - public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = []); + public function denormalize($denormalizer, $data, $format = null, array $context = []); } diff --git a/stubs/DenormalizerInterface.stub b/stubs/DenormalizerInterface.stub new file mode 100644 index 00000000..86ca8bec --- /dev/null +++ b/stubs/DenormalizerInterface.stub @@ -0,0 +1,23 @@ + $context + * @return object|array + */ + public function denormalize($data, $type, $format = null, array $context = []); + + /** + * @param mixed $data + * @param string $type + * @param string $format + * @return bool + */ + public function supportsDenormalization($data, $type, $format = null); +}