Closed corretge closed 1 month ago
Maybe this \Marshal\Http\Output\Raw()
has __toString()
method in there - but it's something like
public function __toString() {
if(!is_null($this->rawData)) {
return $this->rawData
}
// If the condition above doesn't match, there is no backup return clause,
// potentially resulting in a return of :void.
}
If \Marshal\Http\Output\Raw()
would implement \Stringable
interface, intelephense would have pointed out earlier that __toString()
potentially returns :void
..this was just a wild guess. Can't tell as I haven't seen the code, but hopefully this helps tho ^^
$this->assertStringContainsString(
'This is the help message',
(string) $txt // This turns even void or null to empty string so this is where I based my guess
);
So adding backup return to __toString()
public function __toString() {
if(!is_null($this->rawData)) {
return $this->rawData
}
return 'There were nothing to turn to string..!';
}
Would fix the issue..!
@corretge if you navigate to the __toString
definition, does it have an incorrect @return
annotation?
I get an error: Expected type 'string'. Found 'void'. intelephense(P1006)
while the result of __toString() is typed as string but intelephense thinks that it is void.
look the capture
To Reproduce It is not happening in all the places that I assertStringContainsString with the result of __toString().
I fixed it typing:
Expected behavior As happens in other parts of the code
Screenshots
Platform and version Mac OS Sonoma 14.4.1
intelephense v1.10.4