fix phpstan

This commit is contained in:
Pavel 2023-10-03 12:03:27 +03:00
parent a5f7f280f2
commit 1de2133b12
3 changed files with 5 additions and 10 deletions

View File

@ -15,11 +15,6 @@ parameters:
count: 3
path: src/Comparator/ComparatorLocator.php
-
message: "#^Parameter \\#2 \\$encoders of class Symfony\\\\Component\\\\Serializer\\\\Serializer constructor expects array\\<Symfony\\\\Component\\\\Serializer\\\\Encoder\\\\DecoderInterface\\|Symfony\\\\Component\\\\Serializer\\\\Encoder\\\\EncoderInterface\\>, array\\<int, object\\> given\\.$#"
count: 1
path: src/Creator/AbstractSymfonySerializerCreator.php
-
message: "#^Unsafe access to private property Pock\\\\Factory\\\\JsonSerializerFactory\\:\\:\\$mainSerializer through static\\:\\:\\.$#"
count: 2

View File

@ -30,13 +30,13 @@ abstract class AbstractJmsSerializerCreator implements SerializerCreatorInterfac
{
if (
class_exists(self::BUILDER_CLASS) &&
method_exists(self::BUILDER_CLASS, 'create')
method_exists(self::BUILDER_CLASS, 'create') // @phpstan-ignore-line
) {
try {
$builder = call_user_func([self::BUILDER_CLASS, 'create']);
$builder = call_user_func([self::BUILDER_CLASS, 'create']); // @phpstan-ignore-line
if (null !== $builder && method_exists($builder, 'build')) {
return new JmsSerializerAdapter($builder->build(), static::getFormat());
if (null !== $builder && method_exists($builder, 'build')) { // @phpstan-ignore-line
return new JmsSerializerAdapter($builder->build(), static::getFormat()); // @phpstan-ignore-line
}
} catch (Throwable $throwable) {
return null;

View File

@ -34,7 +34,7 @@ abstract class AbstractSymfonySerializerCreator implements SerializerCreatorInte
$encoder = static::getEncoderClass();
return new SymfonySerializerAdapter(
new $serializer([new $normalizer()], [new $encoder()]),
new $serializer([new $normalizer()], [new $encoder()]), // @phpstan-ignore-line
static::getFormat()
);
}