-
Notifications
You must be signed in to change notification settings - Fork 696
Closed
Labels
easy problemsIssues that can be fixed without background knowledge of PsalmIssues that can be fixed without background knowledge of Psalmenhancement
Description
/**
* @psalm-inheritors FooClass|BarClass
*/
class BaseClass {}
class FooClass extends BaseClass {
public function thing(string $s) : void { return $s . "hello"; }
}
class BarClass extends BaseClass {
public function thing(int $i) : string { return $i . "hello"; }
}
class BazClass extends BaseClass {} // this is an error
function f1(BaseClass $c) : string {
switch (get_class($c)) {
case FooClass:class:
return $c->thing("me");
case BarClass:class:
return $c->thing(5);
}
}
function f2(BaseClass $c) : string { // this is an error as not all paths are met
switch (get_class($c)) {
case FooClass:class:
return $c->thing("me");
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
easy problemsIssues that can be fixed without background knowledge of PsalmIssues that can be fixed without background knowledge of Psalmenhancement