Skip to content

Commit db00996

Browse files
committed
Move up to SpecBaseObject
1 parent 400221e commit db00996

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/SpecBaseObject.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@
1313
use cebe\openapi\json\JsonReference;
1414
use cebe\openapi\spec\Reference;
1515
use cebe\openapi\spec\Type;
16+
use \JsonSerializable;
1617

1718
/**
1819
* Base class for all spec objects.
1920
*
2021
* Implements property management and validation basics.
2122
*
2223
*/
23-
abstract class SpecBaseObject implements SpecObjectInterface, DocumentContextInterface
24+
abstract class SpecBaseObject implements SpecObjectInterface, DocumentContextInterface, JsonSerializable
2425
{
2526
private $_properties = [];
2627
private $_errors = [];
@@ -525,4 +526,8 @@ public function getExtensions(): array
525526
}
526527
return $extensions;
527528
}
529+
530+
public function jsonSerialize() {
531+
return $this->getSerializableData();
532+
}
528533
}

src/spec/OpenApi.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
use cebe\openapi\exceptions\TypeErrorException;
1111
use cebe\openapi\SpecBaseObject;
12-
use \JsonSerializable;
1312

1413
/**
1514
* This is the root document object of the OpenAPI document.
@@ -26,7 +25,7 @@
2625
* @property ExternalDocumentation|null $externalDocs
2726
*
2827
*/
29-
class OpenApi extends SpecBaseObject implements JsonSerializable
28+
class OpenApi extends SpecBaseObject
3029
{
3130
/**
3231
* @return array array of attributes available in this object.
@@ -80,8 +79,4 @@ public function performValidation()
8079
$this->addError('Unsupported openapi version: ' . $this->openapi);
8180
}
8281
}
83-
84-
public function jsonSerialize() {
85-
return $this->getSerializableData();
86-
}
8782
}

0 commit comments

Comments
 (0)