Changelog - Version 7.0
Status: in development. This document tracks changes landing on the
7.0branch. Nothing here is released yet, and the contents may still change.
New Features
- Comments.
{# ... #}is removed from the output. It was documented but not implemented: the comment was printed as it was written. A comment can span lines, and what is inside it is not evaluated.
Breaking Changes
-
A boolean is printed as
trueorfalse.{{ 1 == 2 }},{{ flag }}and{{ loop.first }}printed1for true and nothing at all for false. Conditions are not affected:{% if flag %}behaves as before. Inside a concatenation or a string filter a boolean is still1or empty. -
defaultno longer replaces a variable that isfalse. Afalsevariable used to reach the filter as an empty string;{{ flag | default("x") }}now printsfalse. -
An array is printed as JSON.
{{ items }}and{{ "a-b" | split("-") }}print["a","b"]. They used to raise PHP's "Array to string conversion" warning and printArray. -
FileSystemLoaderthrowsLoaderExceptionfor a directory or a template that cannot be loaded.LoaderExceptionnow extendsInvalidArgumentException, which is what was thrown before, so acatch (InvalidArgumentException)keeps working. Code that caughtLoaderExceptionas a plainExceptionsubclass is not affected either. -
FileSystemLoaderonly loads from its own directory. A template name is joined to the directory, so../in a name used to load a file from somewhere else. The loader now resolves the path and refuses a file outside the directory with the sameLoaderExceptionas a missing template. Names in subdirectories keep working. A symbolic link inside the directory that points outside it is refused as well.
Documentation
- The loader pages documented a
getSource()method that does not exist. They now describegetTemplate(), the.jinjadefault extension andStringLoader. - Examples that did not run were corrected, and the constructs the engine does not support are
listed in Current Limitations:
else/elifinside a nested block,elseon an inner loop, whitespace control on closing tags, the ternary operator,not, and commas in filter arguments.
Requirements
- PHP 8.3, 8.4, 8.5 and 8.6 are now supported:
"php": ">=8.3 <8.7". The previous<8.6upper bound excluded PHP 8.6, since<8.6is exclusive.
Toolchain
-
PHPUnit updated to
^12.5. -
Psalm is installed as
psalm/phar(^6.16) instead ofvimeo/psalm.vimeo/psalmlists the PHP versions it supports and no published release includes 8.6, so as a dev dependency it madecomposer installfail on the 8.6 build job before any test ran.psalm/pharrequires onlyphp ^8.2and bundles its own dependencies, so it installs on every PHP version in the matrix and cannot conflict with the project's. Psalm itself still refuses to run on 8.6, which is why the Psalm job uses 8.5.composer psalmruns it.PHPUnit 13 is deliberately not used. It requires PHP
>=8.4.1, which would break the 8.3 floor.
Continuous Integration
- The build matrix now includes PHP 8.6.
- The Psalm job now runs on PHP 8.5. Psalm declares
~8.1.31 || ~8.2.27 || ~8.3.16 || ~8.4.3 || ~8.5.0and therefore does not run on PHP 8.6.
Housekeeping
phpunit.xml.distrenamed tophpunit.xml.- Added the
LICENSEfile (MIT); the license was already declared incomposer.json.