Releases: nette/latte
Releases · nette/latte
Released version 3.0.26
- Feature class with setFeature()/hasFeature() – a unified way to toggle engine capabilities. Existing methods like
setStrictTypes()andsetStrictParsing()now delegate to this system, so you can use either style. New features can be added without cluttering the Engine API. - setCacheDirectory() replaces the old
setTempDirectory()– because "temp" was too easily confused with "template". The old method still works but consider it deprecated. - Fixed
!operator priority – the logical NOT operator was incorrectly placed at the same precedence level as bitwise NOT and type casts, aboveinstanceof. It now correctly sits belowinstanceof, matching PHP's actual operator precedence.
Released version 3.1.2
Latte 3.1.2 introduces a clean feature flag system, tightens up the compiler API with two breaking changes, and brings the codebase under stricter static analysis. If you're extending the compiler, pay attention to the TokenStream and custom function changes below.
- Feature enum with setFeature()/hasFeature() – a unified way to toggle engine capabilities like
StrictTypes,StrictParsing, andMigrationWarnings. The old methods (setStrictTypes(),setStrictParsing(),setMigrationWarnings()) still work but are now deprecated in favor of the enum-based API. - setCacheDirectory() replaces the old
setTempDirectory()– because "temp" was way too easily confused with "template". The old method still works but is deprecated. - LinterExtension now correctly validates
::classexpressions – previously{=UnknownClass::class}slipped through validation because it was handled as a class constant instead of a class type check. - Added missing native type declarations across the codebase.
- Improved phpDoc types and descriptions.
- Unified
declare(strict_types=1)to single-line format.
Released version 3.1.1
- added LinterExtension for validating filters, functions, classes and methods
- linter: improved finding files, excludes temp, vendor, node_modules
- support every argument syntax for
clone()in PHP 8.5 - added CustomFunctionCallNode for custom functions
- refactor: decentralize operator precedence to individual nodes
- *CallableNode replaced with solution with VariadicPlaceholder (BC break)
- ErrorSuppressNode & NotNode merged into UnaryOpNode (BC break)
- deprecated
PrintContext::infixOp(),prefixOp(),postfixOp()(BC break) - fixed operator ! priority
Release version 3.0.25
- Escaper: supports converting HTML => TEXT
- Escaper: fixed converting between HTML/ATTR
<=>HTML - added
ModifierNode::removeFilter() - linter: added assets extension
Released version 3.1.0
This major release introduces Smart HTML Attributes, strict_types by default, and several syntax improvements. It requires PHP 8.2+.
Smart HTML Attributes
- Null values: Attributes with
nullvalues are now dropped instead of rendering as empty strings. - Boolean attributes: Attributes like
checkedordisabledrender conditionally based on truthy/falsey values. - Array support:
classandstyleattributes now accept arrays (e.g.,class="{[active: $cond]}"). - Data attributes:
data-*attributes automatically JSON-serialize non-string values (arrays, objects, booleans). - Aria attributes:
aria-*attributes render boolean values as"true"/"false". - Type checking: Passing invalid types (arrays, objects) to standard attributes now triggers a warning and omits the attribute.
New Features
- Added
n:elseifsupport. - Added nullsafe filter operator
?|(e.g.,{$var?|upper}). - Added
|togglefilter for manual boolean attribute control. - Support for unquoted n-attribute syntax:
n:if={$cond}.
Breaking Changes & Deprecations
strictTypesis now enabled by default.- Using
$thisand$__*variables in templates is deprecated. - The undefined unsafe operator
??->is deprecated (use?->). - Global constants should now be prefixed with a slash (e.g.,
\PHP_VERSION). Engine::addFilterLoader()is deprecated.
Released version 3.0.24
- Released version 3.0.24
- support for PHP 8.5
- added support for pipe operator in PHP 8.5
- added support for new deref without parens in PHP 8.4
- added
Engine::setSyntax()to set default syntax (#359) - refactor: moved script tag quote validation from PrintNode to compiler pass
- Tag parser: checks octal sequence overflow
Engine::getCacheKey()reflects strictTypes & strictParsing, ignores filemtime of extensionsElementNode::getAttribute()uses case-insensitive comparison in XML- NAttrNode: renamed temporary variables not to collide with n:snippet
Released version 3.0.22
- TagParser: allowed |
filter()and bitwise OR PrintContext::format()parenthesizes %node if it has lower precedence than the assignment operator- PrintContent: refactoring and updated operator precedence and associativity table
Cache::generateFileName()file name always contains 'latte--'- added /** Generated by Latte */ comment
- n:else: fixed when there are multiple TextNode
- PrintNode moved to Latte\Compiler\Nodes
- Nodes: removes null nodes after traversal
Released version 3.0.22
- added function
hasTemplate() - added |firstLower
- added NodeTraverser::RemoveNode constant #396
- improved block/template dynamic name checking
- optimized global function calls
Released version 3.0.21
Released version 3.0.20
{default}is evaluated lazily|localDaterespects the time zone set in PHP #380- added
|filter - FileLoader: fixed path normalization for phar and absolute paths #378
- TagParser: allow trailing comma in |filter(...)
- TranslatorExtension:
translate()can return \Stringable #372 CachingIterator::__get()does not return a reference