Skip to content

Commit

Permalink
Mark as nullable arguments with initial null value
Browse files Browse the repository at this point in the history
  • Loading branch information
acelaya authored and DEVizzent committed Dec 3, 2024
1 parent 9e20902 commit 4004029
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/SpecBaseObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,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) {
Expand Down
2 changes: 1 addition & 1 deletion src/SpecObjectInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/spec/Callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/spec/PathItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/spec/Paths.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions src/spec/Reference.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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.');
}
Expand Down
2 changes: 1 addition & 1 deletion src/spec/Responses.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 4004029

Please sign in to comment.