Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes PHP 8.4 deprecation warnings #217

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/SpecBaseObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
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