From 3a6cb0a308fb5aeac28043f53512c5a57bb1dcf9 Mon Sep 17 00:00:00 2001 From: "350375092@qq.com" <350375092@qq.com> Date: Tue, 3 Jun 2025 16:12:02 +0800 Subject: [PATCH] Fix: Parameter order to comply with PHP 8+ requirements --- src/Resolvers/InputResolver.php | 2 +- src/Resolvers/OutputResolver.php | 2 +- src/Serialize.php | 2 +- src/Support/Context/ChoosePropertyContext.php | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Resolvers/InputResolver.php b/src/Resolvers/InputResolver.php index e26a451..1e58949 100644 --- a/src/Resolvers/InputResolver.php +++ b/src/Resolvers/InputResolver.php @@ -51,7 +51,7 @@ classInstance: $object, continue; } - $chooseContext->addProperty(new ChoosePropertyContext($name, $chooseContext, $collection)); + $chooseContext->addProperty(new ChoosePropertyContext($name, $collection, $chooseContext)); $chooseContext->getProperty($name)?->setInputName($matchInput['name']); $resolvedValue = $matchInput['value']; diff --git a/src/Resolvers/OutputResolver.php b/src/Resolvers/OutputResolver.php index 0f90a4f..181b877 100644 --- a/src/Resolvers/OutputResolver.php +++ b/src/Resolvers/OutputResolver.php @@ -42,7 +42,7 @@ classInstance: $object, continue; } - $chooseContext->addProperty(new ChoosePropertyContext($name, $chooseContext, $collection)); + $chooseContext->addProperty(new ChoosePropertyContext($name, $collection, $chooseContext)); $chooseContext->getProperty($name)?->setOutPutNames($matchData['names']); $resolvedValue = $matchData['value']; diff --git a/src/Serialize.php b/src/Serialize.php index e527480..5e016bb 100644 --- a/src/Serialize.php +++ b/src/Serialize.php @@ -29,7 +29,7 @@ public static function setGroups(array|string $groups): SerializeContext public function withGroups(array|string $groups): static { - $this->getContext()->setGroups((array)$groups); + $this->getContext()?->setGroups((array)$groups); return $this; } diff --git a/src/Support/Context/ChoosePropertyContext.php b/src/Support/Context/ChoosePropertyContext.php index 2ee0586..47c1b50 100644 --- a/src/Support/Context/ChoosePropertyContext.php +++ b/src/Support/Context/ChoosePropertyContext.php @@ -16,15 +16,15 @@ class ChoosePropertyContext public function __construct( private readonly string $name, - private readonly ?ChooseSerializeContext $parent = null, private readonly DataCollection $dataCollection, + private readonly ?ChooseSerializeContext $parent = null, ) { } public static function build(DataCollection $collection, ChooseSerializeContext $context,DataCollection $dataCollection): ChoosePropertyContext { - return new self($collection->getName(), $context, $dataCollection); + return new self($collection->getName(), $dataCollection, $context); } public function getDataCollection() : DataCollection