// test: is_string() narrows type so else branch retains object members
// feature: completion
// Adapted from phpactor function/is_string.test and if-statement/else.test
// expect: fooMethod(
---
<?php
class Foobar {
public function fooMethod(): void {}
}
function test(Foobar|string $foo): void {
if (is_string($foo)) {
return;
}
$foo-><>
}