diff --git a/doc/templates.rst b/doc/templates.rst index 6626d4ee8..b651851ee 100644 --- a/doc/templates.rst +++ b/doc/templates.rst @@ -76,8 +76,24 @@ Twig templates have access to variables provided by the PHP application and variables created in templates via the :doc:`set ` tag. These variables can be manipulated and displayed in the template. -Use a dot (``.``) to access attributes of a variable (methods, properties -or constants of a PHP object, or items of a PHP array): +Twig tries to abstract PHP types as much as possible and works with a few basic +types, supported by ``filters``, ``functions``, and ``tests`` among others: + +=================== =============================== +Twig Type PHP Type +=================== =============================== +string A string or a Stringable object +number An integer or a float +boolean ``true`` or ``false`` +null ``null`` +iterable (mapping) An array +iterable (sequence) An array +iterable (object) An iterable object +object An object +=================== =============================== + +The ``iterable`` and ``object`` types expose attributes you can access via the +dot (``.``) operator: .. code-block:: twig