From 1de2133b12a62b492fcd73542b95a3f162d163cc Mon Sep 17 00:00:00 2001 From: Neur0toxine Date: Tue, 3 Oct 2023 12:03:27 +0300 Subject: [PATCH] fix phpstan --- phpstan-baseline.neon | 5 ----- src/Creator/AbstractJmsSerializerCreator.php | 8 ++++---- src/Creator/AbstractSymfonySerializerCreator.php | 2 +- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index a6863b6..31eeb01 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -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\\, array\\ given\\.$#" - count: 1 - path: src/Creator/AbstractSymfonySerializerCreator.php - - message: "#^Unsafe access to private property Pock\\\\Factory\\\\JsonSerializerFactory\\:\\:\\$mainSerializer through static\\:\\:\\.$#" count: 2 diff --git a/src/Creator/AbstractJmsSerializerCreator.php b/src/Creator/AbstractJmsSerializerCreator.php index 7786f69..0e2f63e 100644 --- a/src/Creator/AbstractJmsSerializerCreator.php +++ b/src/Creator/AbstractJmsSerializerCreator.php @@ -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; diff --git a/src/Creator/AbstractSymfonySerializerCreator.php b/src/Creator/AbstractSymfonySerializerCreator.php index e6b0484..b4cfa76 100644 --- a/src/Creator/AbstractSymfonySerializerCreator.php +++ b/src/Creator/AbstractSymfonySerializerCreator.php @@ -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() ); }