From c4dfdf8ea1d91cd6401cd4ed6d72cee3e27c08bd Mon Sep 17 00:00:00 2001 From: lotyp Date: Wed, 19 Jun 2024 03:42:55 +0300 Subject: [PATCH] feat: add static types to Manager Facade --- config/serializer.php | 6 +++--- src/Bridge/Laravel/Facades/Manager.php | 10 ++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/config/serializer.php b/config/serializer.php index 006073d1..44512213 100644 --- a/config/serializer.php +++ b/config/serializer.php @@ -2,15 +2,13 @@ declare(strict_types=1); -use Symfony\Component\Serializer\Mapping\Loader\LoaderInterface; - /** * @return array{ * default: string, * debug: bool, * normalizerRegistrationStrategy: class-string, * encoderRegistrationStrategy: class-string, - * metadataLoader: class-string|null, + * metadataLoader: class-string|null, * } */ return [ @@ -59,6 +57,8 @@ /* * Allows you to register your custom metadata loader. + * + * By default Symfony\Component\Serializer\Mapping\Loader\AttributeLoader is used. */ 'metadataLoader' => null, ]; diff --git a/src/Bridge/Laravel/Facades/Manager.php b/src/Bridge/Laravel/Facades/Manager.php index 39c4c2c6..3546b5e8 100644 --- a/src/Bridge/Laravel/Facades/Manager.php +++ b/src/Bridge/Laravel/Facades/Manager.php @@ -5,7 +5,17 @@ namespace WayOfDev\Serializer\Bridge\Laravel\Facades; use Illuminate\Support\Facades\Facade; +use Stringable; +use WayOfDev\Serializer\Contracts\SerializerInterface; +/** + * @method static string format() + * @method static SerializerInterface serializer(?string $format = null) + * @method static string serialize(mixed $payload, ?string $format = null, ?array $context = []) + * @method static mixed deserialize(string|Stringable $payload, string|object|null $type = null, ?string $format = null, ?array $context = []) + * + * @see \WayOfDev\Serializer\Manager\SerializerManager + */ class Manager extends Facade { protected static function getFacadeAccessor(): string