Skip to content

Commit

Permalink
Wording
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN committed Jan 2, 2025
1 parent ac1f69d commit a6b96ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions doc/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -915,9 +915,11 @@ It is now possible to move the runtime logic to a new

.. note::

By naming the runtime with the ``Runtime`` suffix instead of ``Extension``,
Twig automatically tracks updates to its source file for cache invalidation.
Otherwise, you can implement the method ``getLastModified(): int``.
The extension class should implement the ``Twig\Extension\LastModifiedExtensionInterface``
interface to invalidate the template cache when the runtime class is modified.
The ``AbstractExtension`` class implements this interface and tracks the
runtime class if its name is the same as the extension class but ends with
``Runtime`` instead of ``Extension``.

Testing an Extension
--------------------
Expand Down
2 changes: 1 addition & 1 deletion src/Extension/LastModifiedExtensionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface LastModifiedExtensionInterface extends ExtensionInterface
* Returns the last modification time of the extension for cache invalidation.
*
* This timestamp should be the last time the source code of the extension class
* and all its dependencies were modified.
* and all its dependencies were modified (including the Runtime class).
*/
public function getLastModified(): int;
}

0 comments on commit a6b96ab

Please sign in to comment.