From 558ca1bfd1722a7d09877926d2b446a478d110fd Mon Sep 17 00:00:00 2001 From: Mr Ceperka Date: Mon, 17 Jul 2023 12:12:55 +0200 Subject: [PATCH] return early if transformer is null --- src/Scope.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Scope.php b/src/Scope.php index 45037b66..c2fc08f0 100644 --- a/src/Scope.php +++ b/src/Scope.php @@ -343,13 +343,17 @@ protected function serializeResource(Serializer $serializer, $data): ?array * * @internal * - * @param TransformerAbstract|callable $transformer - * @param mixed $data + * @param TransformerAbstract|callable|null $transformer + * @param mixed $data */ protected function fireTransformer($transformer, $data): array { $includedData = []; + if ($transformer === null) { + return [$data, $includedData]; + } + if (is_callable($transformer)) { $transformedData = call_user_func($transformer, $data); } else {