diff --git a/src/SpecBaseObject.php b/src/SpecBaseObject.php index 1de429b..673f876 100644 --- a/src/SpecBaseObject.php +++ b/src/SpecBaseObject.php @@ -391,7 +391,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 a96aa74..31f9f8c 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/Callback.php b/src/spec/Callback.php index 06bbd58..dc2c414 100644 --- a/src/spec/Callback.php +++ b/src/spec/Callback.php @@ -133,7 +133,7 @@ public function getErrors(): array * 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) { if ($this->_pathItem !== null) { $this->_pathItem->resolveReferences($context); diff --git a/src/spec/PathItem.php b/src/spec/PathItem.php index 4b2debc..22e5b13 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 e504a90..f55bafe 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 cda612a..81f07e8 100644 --- a/src/spec/Reference.php +++ b/src/spec/Reference.php @@ -64,7 +64,7 @@ class Reference implements SpecObjectInterface, DocumentContextInterface * @param string $to class name of the type referenced by this Reference * @throws TypeErrorException in case invalid data is supplied. */ - public function __construct(array $data, string $to = null) + public function __construct(array $data, ?string $to = null) { if (!isset($data['$ref'])) { throw new TypeErrorException( @@ -170,7 +170,7 @@ public function getContext() : ?ReferenceContext * If you call resolveReferences() make sure to replace the Reference with the resolved object first. * @throws UnresolvableReferenceException in case of errors. */ - public function resolve(ReferenceContext $context = null) + public function resolve(?ReferenceContext $context = null) { if ($context === null) { $context = $this->getContext(); @@ -357,7 +357,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 a6db447..9e1233d 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) {