mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Update to more specific example
This commit is contained in:
parent
5d1dd3ca65
commit
39ad587c3e
@ -128,10 +128,14 @@ function instantiator(string $class) {
|
||||
return new $class();
|
||||
}
|
||||
|
||||
/** @psalm-consistent-constructor */
|
||||
class Foo {}
|
||||
class Foo {
|
||||
public final function __construct() {}
|
||||
}
|
||||
|
||||
$_a = instantiator(Foo::class); // Psalm knows the result is an object of type Foo
|
||||
class FooChild extends Foo {}
|
||||
|
||||
$r = instantiator(FooChild::class);
|
||||
// Psalm knows $r is an object of type FooChild
|
||||
```
|
||||
|
||||
## Template inheritance
|
||||
|
Loading…
Reference in New Issue
Block a user