diff --git a/docs/annotating_code/templated_annotations.md b/docs/annotating_code/templated_annotations.md index 2cb89f93b..bb5940335 100644 --- a/docs/annotating_code/templated_annotations.md +++ b/docs/annotating_code/templated_annotations.md @@ -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