From c3f8285eedea0371fb45b6d910cfb80ff39b817c Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Mon, 11 Feb 2019 18:13:54 +0000 Subject: [PATCH] adjusting header depth to reflect separate document --- docs/templated_annotations.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/templated_annotations.md b/docs/templated_annotations.md index 0bddd5d3b..78fdccc69 100644 --- a/docs/templated_annotations.md +++ b/docs/templated_annotations.md @@ -1,6 +1,6 @@ -## Templating +# Templating -### `@template` +## `@template` The `@template` tag allows classes and functions to implement type parameter-like functionality found in many other languages. @@ -38,7 +38,7 @@ Psalm also uses `@template` annotations in its stubbed versions of PHP array fun function array_combine(array $arr, array $arr2) {} ``` -### `@param class-string` +## `@param class-string` Psalm also allows you to parameterise class types @@ -57,7 +57,7 @@ class Foo {} $a = instantiator(Foo::class); // Psalm knows the result is an object of type Foo ``` -### Template inheritance +## Template inheritance Psalm allows you to extend templated classes with `@extends`/`@template-extends`: @@ -118,7 +118,7 @@ class ParentClass {} class ChildClass extends ParentClass {} ``` -### Template constraints +## Template constraints You can use `@template of ` to restrict input. For example, to restrict to a given class you can use @@ -199,7 +199,7 @@ class Baz extends Foo { } ``` -### Builtin templated classes and interfaces +## Builtin templated classes and interfaces Psalm has support for a number of builtin classes and interfaces that you can extend/implement in your own code.