Skip to content

Commit

Permalink
Merge pull request #381 from dedoc/171-issue-failure-to-parse-relatio…
Browse files Browse the repository at this point in the history
…nship-while-parsing-a-child-model

Fixed property fetching inference logic, fixed relations retrieval for child models
  • Loading branch information
romalytvynenko authored May 19, 2024
2 parents a48a8da + b9c6eca commit c76724d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/Infer/Services/ReferenceTypeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,17 +270,17 @@ private function resolveNewCallReferenceType(Scope $scope, NewCallReferenceType

private function resolvePropertyFetchReferenceType(Scope $scope, PropertyFetchReferenceType $type)
{
$objectType = $this->resolve($scope, $type->object);

if (
($type->object instanceof ObjectType)
&& ! array_key_exists($type->object->name, $this->index->classesDefinitions)
&& ! $this->resolveUnknownClassResolver($type->object->name)
($objectType instanceof ObjectType)
&& ! array_key_exists($objectType->name, $this->index->classesDefinitions)
&& ! $this->resolveUnknownClassResolver($objectType->name)
) {
// Class is not indexed, and we simply cannot get an info from it.
return $type;
}

$objectType = $this->resolve($scope, $type->object);

if (
$objectType instanceof AbstractReferenceType
|| $objectType instanceof TemplateType
Expand Down
2 changes: 1 addition & 1 deletion src/Support/ResponseExtractor/ModelInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ protected function getRelations($model)
->reject(
fn (ReflectionMethod $method) => $method->isStatic()
|| $method->isAbstract()
|| $method->getDeclaringClass()->getName() !== get_class($model)
|| $method->getDeclaringClass()->getName() === Model::class,
)
->filter(function (ReflectionMethod $method) {
$file = new SplFileObject($method->getFileName());
Expand Down

0 comments on commit c76724d

Please sign in to comment.