Skip to content

(feat): add stubs for symfony/serializer interfaces #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 30, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions extension.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
13 changes: 13 additions & 0 deletions stubs/ContextAwareDecoderInterface.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Symfony\Component\Serializer\Encoder;

interface ContextAwareDecoderInterface extends DecoderInterface
{
/**
* @param string $format
* @param array<mixed> $context
* @return bool
*/
public function supportsDecoding($format, array $context = []);
}
14 changes: 14 additions & 0 deletions stubs/ContextAwareDenormalizerInterface.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Symfony\Component\Serializer\Normalizer;

interface ContextAwareDenormalizerInterface extends DenormalizerInterface
{
/**
* @param mixed $data
* @param string $format
* @param array<mixed> $context
* @return bool
*/
public function supportsDenormalization($data, $type, $format = null, array $context = []);
}
14 changes: 14 additions & 0 deletions stubs/ContextAwareNormalizerInterface.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Symfony\Component\Serializer\Normalizer;

interface ContextAwareNormalizerInterface extends NormalizerInterface
{
/**
* @param mixed $data
* @param string $format
* @param array<mixed> $context
* @return bool
*/
public function supportsNormalization($data, $format = null, array $context = []);
}
22 changes: 22 additions & 0 deletions stubs/DecoderInterface.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Symfony\Component\Serializer\Encoder;

use Symfony\Component\Serializer\Exception\UnexpectedValueException;

interface DecoderInterface
{
/**
* @param string $data
* @param string $format
* @param array<mixed> $context
* @return mixed
*/
public function decode($data, $format, array $context = []);

/**
* @param string $format Format name
* @return bool
*/
public function supportsDecoding($format);
}
16 changes: 16 additions & 0 deletions stubs/DenormalizableInterface.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Symfony\Component\Serializer\Normalizer;

interface DenormalizableInterface
{
/**
* @param DenormalizerInterface $denormalizer
* @param array<mixed>|string|int|float|bool $data
* @param string|null $format
* @param array<mixed> $context
*
* @return object|object[]
*/
public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = []);
}
20 changes: 20 additions & 0 deletions stubs/EncoderInterface.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Symfony\Component\Serializer\Encoder;

interface EncoderInterface
{
/**
* @param mixed $data
* @param string $format
* @param array<mixed> $context
* @return string|int|float|bool
*/
public function encode($data, $format, array $context = []);

/**
* @param string $format Format name
* @return bool
*/
public function supportsEncoding($format);
}
14 changes: 14 additions & 0 deletions stubs/NormalizableInterface.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Symfony\Component\Serializer\Normalizer;

interface NormalizableInterface
{
/**
* @param NormalizerInterface $normalizer
* @param string|null $format
* @param array<mixed> $context
* @return array<mixed>|string|int|float|bool
*/
public function normalize(NormalizerInterface $normalizer, $format = null, array $context = []);
}
14 changes: 14 additions & 0 deletions stubs/NormalizerInterface.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Symfony\Component\Serializer\Normalizer;

interface NormalizerInterface
{
/**
* @param mixed $object
* @param string $format
* @param array<mixed> $context
* @return array<mixed>|string|int|float|bool|null
*/
public function normalize($object, $format = null, array $context = []);
}