Skip to content

Commit 4004029

Browse files
acelayaDEVizzent
authored andcommitted
Mark as nullable arguments with initial null value
1 parent 9e20902 commit 4004029

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

src/SpecBaseObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ public function __unset($name)
401401
* Resolves all Reference Objects in this object and replaces them with their resolution.
402402
* @throws exceptions\UnresolvableReferenceException in case resolving a reference fails.
403403
*/
404-
public function resolveReferences(ReferenceContext $context = null)
404+
public function resolveReferences(?ReferenceContext $context = null)
405405
{
406406
// avoid recursion to get stuck in a loop
407407
if ($this->_recursingReferences) {

src/SpecObjectInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function getErrors(): array;
4040
/**
4141
* Resolves all Reference Objects in this object and replaces them with their resolution.
4242
*/
43-
public function resolveReferences(ReferenceContext $context = null);
43+
public function resolveReferences(?ReferenceContext $context = null);
4444

4545
/**
4646
* Set context for all Reference Objects in this object.

src/spec/Callback.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public function getErrors(): array
133133
* Resolves all Reference Objects in this object and replaces them with their resolution.
134134
* @throws UnresolvableReferenceException
135135
*/
136-
public function resolveReferences(ReferenceContext $context = null)
136+
public function resolveReferences(?ReferenceContext $context = null)
137137
{
138138
if ($this->_pathItem !== null) {
139139
$this->_pathItem->resolveReferences($context);

src/spec/PathItem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public function setReferenceContext(ReferenceContext $context)
150150
* Resolves all Reference Objects in this object and replaces them with their resolution.
151151
* @throws \cebe\openapi\exceptions\UnresolvableReferenceException in case resolving a reference fails.
152152
*/
153-
public function resolveReferences(ReferenceContext $context = null)
153+
public function resolveReferences(?ReferenceContext $context = null)
154154
{
155155
if ($this->_ref instanceof Reference) {
156156
$pathItem = $this->_ref->resolve($context);

src/spec/Paths.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public function getIterator(): Traversable
246246
* Resolves all Reference Objects in this object and replaces them with their resolution.
247247
* @throws UnresolvableReferenceException
248248
*/
249-
public function resolveReferences(ReferenceContext $context = null)
249+
public function resolveReferences(?ReferenceContext $context = null)
250250
{
251251
foreach ($this->_paths as $key => $path) {
252252
if ($path === null) {

src/spec/Reference.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class Reference implements SpecObjectInterface, DocumentContextInterface
6464
* @param string $to class name of the type referenced by this Reference
6565
* @throws TypeErrorException in case invalid data is supplied.
6666
*/
67-
public function __construct(array $data, string $to = null)
67+
public function __construct(array $data, ?string $to = null)
6868
{
6969
if (!isset($data['$ref'])) {
7070
throw new TypeErrorException(
@@ -170,7 +170,7 @@ public function getContext() : ?ReferenceContext
170170
* If you call resolveReferences() make sure to replace the Reference with the resolved object first.
171171
* @throws UnresolvableReferenceException in case of errors.
172172
*/
173-
public function resolve(ReferenceContext $context = null)
173+
public function resolve(?ReferenceContext $context = null)
174174
{
175175
if ($context === null) {
176176
$context = $this->getContext();
@@ -357,7 +357,7 @@ private function makeRelativePath($base, $path)
357357
* Resolves all Reference Objects in this object and replaces them with their resolution.
358358
* @throws UnresolvableReferenceException
359359
*/
360-
public function resolveReferences(ReferenceContext $context = null)
360+
public function resolveReferences(?ReferenceContext $context = null)
361361
{
362362
throw new UnresolvableReferenceException('Cyclic reference detected, resolveReferences() called on a Reference Object.');
363363
}

src/spec/Responses.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ public function getIterator(): Traversable
236236
* Resolves all Reference Objects in this object and replaces them with their resolution.
237237
* @throws UnresolvableReferenceException
238238
*/
239-
public function resolveReferences(ReferenceContext $context = null)
239+
public function resolveReferences(?ReferenceContext $context = null)
240240
{
241241
foreach ($this->_responses as $key => $response) {
242242
if ($response instanceof Reference) {

0 commit comments

Comments
 (0)