From 7562f8c3ff07b4206e94683215885ab37f0d4535 Mon Sep 17 00:00:00 2001 From: Ivan Lackovic Date: Mon, 12 Jan 2026 07:34:24 +0100 Subject: [PATCH] SpecObjectInterface::resolveReferences() - make $context nullable --- src/SpecBaseObject.php | 2 +- src/SpecObjectInterface.php | 2 +- src/spec/PathItem.php | 2 +- src/spec/Paths.php | 2 +- src/spec/Reference.php | 2 +- src/spec/Responses.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/SpecBaseObject.php b/src/SpecBaseObject.php index ef93401e..0e5b2f45 100644 --- a/src/SpecBaseObject.php +++ b/src/SpecBaseObject.php @@ -393,7 +393,7 @@ public function __unset($name) * Resolves all Reference Objects in this object and replaces them with their resolution. * @throws exceptions\UnresolvableReferenceException in case resolving a reference fails. */ - public function resolveReferences(ReferenceContext $context = null) + public function resolveReferences(?ReferenceContext $context = null) { // avoid recursion to get stuck in a loop if ($this->_recursingReferences) { diff --git a/src/SpecObjectInterface.php b/src/SpecObjectInterface.php index a96aa74e..31f9f8cb 100644 --- a/src/SpecObjectInterface.php +++ b/src/SpecObjectInterface.php @@ -40,7 +40,7 @@ public function getErrors(): array; /** * Resolves all Reference Objects in this object and replaces them with their resolution. */ - public function resolveReferences(ReferenceContext $context = null); + public function resolveReferences(?ReferenceContext $context = null); /** * Set context for all Reference Objects in this object. diff --git a/src/spec/PathItem.php b/src/spec/PathItem.php index 6930e0af..083e7028 100644 --- a/src/spec/PathItem.php +++ b/src/spec/PathItem.php @@ -150,7 +150,7 @@ public function setReferenceContext(ReferenceContext $context) * Resolves all Reference Objects in this object and replaces them with their resolution. * @throws \cebe\openapi\exceptions\UnresolvableReferenceException in case resolving a reference fails. */ - public function resolveReferences(ReferenceContext $context = null) + public function resolveReferences(?ReferenceContext $context = null) { if ($this->_ref instanceof Reference) { $pathItem = $this->_ref->resolve($context); diff --git a/src/spec/Paths.php b/src/spec/Paths.php index e504a90a..f55bafe1 100644 --- a/src/spec/Paths.php +++ b/src/spec/Paths.php @@ -246,7 +246,7 @@ public function getIterator(): Traversable * Resolves all Reference Objects in this object and replaces them with their resolution. * @throws UnresolvableReferenceException */ - public function resolveReferences(ReferenceContext $context = null) + public function resolveReferences(?ReferenceContext $context = null) { foreach ($this->_paths as $key => $path) { if ($path === null) { diff --git a/src/spec/Reference.php b/src/spec/Reference.php index f9b84d67..91964243 100644 --- a/src/spec/Reference.php +++ b/src/spec/Reference.php @@ -363,7 +363,7 @@ private function makeRelativePath($base, $path) * Resolves all Reference Objects in this object and replaces them with their resolution. * @throws UnresolvableReferenceException */ - public function resolveReferences(ReferenceContext $context = null) + public function resolveReferences(?ReferenceContext $context = null) { throw new UnresolvableReferenceException('Cyclic reference detected, resolveReferences() called on a Reference Object.'); } diff --git a/src/spec/Responses.php b/src/spec/Responses.php index a6db447d..9e1233d2 100644 --- a/src/spec/Responses.php +++ b/src/spec/Responses.php @@ -236,7 +236,7 @@ public function getIterator(): Traversable * Resolves all Reference Objects in this object and replaces them with their resolution. * @throws UnresolvableReferenceException */ - public function resolveReferences(ReferenceContext $context = null) + public function resolveReferences(?ReferenceContext $context = null) { foreach ($this->_responses as $key => $response) { if ($response instanceof Reference) {