Skip to content

Commit c1402a9

Browse files
committed
Implement feedback
1 parent dff8a03 commit c1402a9

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/lib/openapi/PropertySchema.php

+7-5
Original file line numberDiff line numberDiff line change
@@ -269,13 +269,15 @@ public function isRefPointerToSchema():bool
269269

270270
public function isRefPointerToSelf():bool
271271
{
272-
$schema = Json::decode(Json::encode($this->schema->getSchema()->getSerializableData()));
272+
$allOfsInSchema = null;
273+
if (isset($this->schema->getSchema()->properties[$this->name]->allOf)) {
274+
$allOfsInSchema = $this->schema->getSchema()->properties[$this->name]->allOf;
275+
}
273276

274-
if (isset($schema['properties'][$this->name]['allOf'])) { # fixes https://github.com/php-openapi/yii2-openapi/issues/68
275-
$allOfs = $schema['properties'][$this->name]['allOf'];
277+
if ($allOfsInSchema) { # fixes https://github.com/php-openapi/yii2-openapi/issues/68
276278
$refCounter = 0;
277-
foreach ($allOfs as $allOf) {
278-
if (isset($allOf['$ref'])) {
279+
foreach ($allOfsInSchema as $allOf) {
280+
if ($allOf instanceof Reference) {
279281
$refCounter++;
280282
}
281283
}

0 commit comments

Comments
 (0)