Skip to content
Closed
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
8 changes: 7 additions & 1 deletion src/Reflection/Php/PhpMethodReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,13 @@ private function getNativeReturnType(): Type
return $this->nativeReturnType = new VoidType();
}
if ($name === '__tostring') {
return $this->nativeReturnType = new StringType();
return $this->nativeReturnType = $this->declaringClass->isBuiltin()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. How is __toString() different from other methods handled by this method?
  2. Personally I'd like a test + revert of the commit that changed this (3854cbc) instead of this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. we found by case, for current case is __toString() so don't know what other needs
  2. yes, I think revert is better for this case, as native is native on overridden method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

? new StringType()
: TypehintHelper::decideTypeFromReflection(
$returnType,
null,
$this->declaringClass,
);
}
if ($name === '__isset') {
return $this->nativeReturnType = new BooleanType();
Expand Down
Loading