Skip to content

Commit b6b20da

Browse files
committed
check isBuiltIn() on __toString()
1 parent 3b20c35 commit b6b20da

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Reflection/Php/PhpMethodReflection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,12 @@ private function getNativeReturnType(): Type
324324
{
325325
if ($this->nativeReturnType === null) {
326326
$returnType = $this->reflection->getReturnType();
327-
if ($returnType === null && $this->declaringClass->isBuiltin()) {
327+
if ($returnType === null) {
328328
$name = strtolower($this->getName());
329329
if (in_array($this->getName(), ['__construct', '__destruct', '__unset', '__wakeup', '__clone'], true)) {
330330
return $this->nativeReturnType = new VoidType();
331331
}
332-
if ($name === '__tostring') {
332+
if ($name === '__tostring' && $this->declaringClass->isBuiltin()) {
333333
return $this->nativeReturnType = new StringType();
334334
}
335335
if ($name === '__isset') {

0 commit comments

Comments
 (0)