Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit edb6aeb

Browse files
(feat): add stubs for symfony/serializer interfaces (#110)
* (feat): add stubs for symfony/serializer interfaces * (fix): missing DenormalizerInterface
1 parent e928cfc commit edb6aeb

10 files changed

+159
-0
lines changed

‎extension.neon‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ parameters:
77
- stubs/ChoiceLoaderInterface.stub
88
- stubs/Constraint.stub
99
- stubs/ContainerBuilder.stub
10+
- stubs/ContextAwareDecoderInterface.stub
11+
- stubs/ContextAwareDenormalizerInterface.stub
12+
- stubs/ContextAwareNormalizerInterface.stub
13+
- stubs/DecoderInterface.stub
14+
- stubs/DenormalizableInterface.stub
15+
- stubs/DenormalizerInterface.stub
16+
- stubs/EncoderInterface.stub
1017
- stubs/EventSubscriberInterface.stub
1118
- stubs/ExtensionInterface.stub
1219
- stubs/FormBuilderInterface.stub
@@ -15,6 +22,8 @@ parameters:
1522
- stubs/FormTypeInterface.stub
1623
- stubs/FormView.stub
1724
- stubs/HeaderBag.stub
25+
- stubs/NormalizableInterface.stub
26+
- stubs/NormalizerInterface.stub
1827
- stubs/Process.stub
1928
- stubs/Session.stub
2029

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace Symfony\Component\Serializer\Encoder;
4+
5+
interface ContextAwareDecoderInterface extends DecoderInterface
6+
{
7+
/**
8+
* @param string $format
9+
* @param array<mixed> $context
10+
* @return bool
11+
*/
12+
public function supportsDecoding($format, array $context = []);
13+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Symfony\Component\Serializer\Normalizer;
4+
5+
interface ContextAwareDenormalizerInterface extends DenormalizerInterface
6+
{
7+
/**
8+
* @param mixed $data
9+
* @param string $format
10+
* @param array<mixed> $context
11+
* @return bool
12+
*/
13+
public function supportsDenormalization($data, $type, $format = null, array $context = []);
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Symfony\Component\Serializer\Normalizer;
4+
5+
interface ContextAwareNormalizerInterface extends NormalizerInterface
6+
{
7+
/**
8+
* @param mixed $data
9+
* @param string $format
10+
* @param array<mixed> $context
11+
* @return bool
12+
*/
13+
public function supportsNormalization($data, $format = null, array $context = []);
14+
}

‎stubs/DecoderInterface.stub‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace Symfony\Component\Serializer\Encoder;
4+
5+
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
6+
7+
interface DecoderInterface
8+
{
9+
/**
10+
* @param string $data
11+
* @param string $format
12+
* @param array<mixed> $context
13+
* @return mixed
14+
*/
15+
public function decode($data, $format, array $context = []);
16+
17+
/**
18+
* @param string $format Format name
19+
* @return bool
20+
*/
21+
public function supportsDecoding($format);
22+
}

‎stubs/DenormalizableInterface.stub‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace Symfony\Component\Serializer\Normalizer;
4+
5+
interface DenormalizableInterface
6+
{
7+
/**
8+
* @param DenormalizerInterface $denormalizer
9+
* @param array<mixed>|string|int|float|bool $data
10+
* @param string|null $format
11+
* @param array<mixed> $context
12+
*
13+
* @return object|object[]
14+
*/
15+
public function denormalize($denormalizer, $data, $format = null, array $context = []);
16+
}

‎stubs/DenormalizerInterface.stub‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace Symfony\Component\Serializer\Normalizer;
4+
5+
interface DenormalizerInterface
6+
{
7+
/**
8+
* @param mixed $data
9+
* @param string $type
10+
* @param string $format
11+
* @param array<mixed> $context
12+
* @return object|array<mixed>
13+
*/
14+
public function denormalize($data, $type, $format = null, array $context = []);
15+
16+
/**
17+
* @param mixed $data
18+
* @param string $type
19+
* @param string $format
20+
* @return bool
21+
*/
22+
public function supportsDenormalization($data, $type, $format = null);
23+
}

‎stubs/EncoderInterface.stub‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace Symfony\Component\Serializer\Encoder;
4+
5+
interface EncoderInterface
6+
{
7+
/**
8+
* @param mixed $data
9+
* @param string $format
10+
* @param array<mixed> $context
11+
* @return string|int|float|bool
12+
*/
13+
public function encode($data, $format, array $context = []);
14+
15+
/**
16+
* @param string $format Format name
17+
* @return bool
18+
*/
19+
public function supportsEncoding($format);
20+
}

‎stubs/NormalizableInterface.stub‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Symfony\Component\Serializer\Normalizer;
4+
5+
interface NormalizableInterface
6+
{
7+
/**
8+
* @param NormalizerInterface $normalizer
9+
* @param string|null $format
10+
* @param array<mixed> $context
11+
* @return array<mixed>|string|int|float|bool
12+
*/
13+
public function normalize(NormalizerInterface $normalizer, $format = null, array $context = []);
14+
}

‎stubs/NormalizerInterface.stub‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Symfony\Component\Serializer\Normalizer;
4+
5+
interface NormalizerInterface
6+
{
7+
/**
8+
* @param mixed $object
9+
* @param string $format
10+
* @param array<mixed> $context
11+
* @return array<mixed>|string|int|float|bool|null
12+
*/
13+
public function normalize($object, $format = null, array $context = []);
14+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /