From 5bfb7389052f94ff0cc2647610dee8a90328a58b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Tue, 26 Dec 2023 21:03:32 +0100 Subject: [PATCH] Rename ModificationAwareInterface --- src/Extension/AttributeExtension.php | 2 +- .../{WithLastModified.php => ModificationAwareInterface.php} | 4 ++-- src/ExtensionSet.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) rename src/Extension/{WithLastModified.php => ModificationAwareInterface.php} (64%) diff --git a/src/Extension/AttributeExtension.php b/src/Extension/AttributeExtension.php index c86465da396..1fc64b69eb7 100644 --- a/src/Extension/AttributeExtension.php +++ b/src/Extension/AttributeExtension.php @@ -24,7 +24,7 @@ * * @author Jérôme Tamarelle */ -final class AttributeExtension extends AbstractExtension implements WithLastModified +final class AttributeExtension extends AbstractExtension implements ModificationAwareInterface { private array $filters; private array $functions; diff --git a/src/Extension/WithLastModified.php b/src/Extension/ModificationAwareInterface.php similarity index 64% rename from src/Extension/WithLastModified.php rename to src/Extension/ModificationAwareInterface.php index 055b1df8804..e85c3ca4ed0 100644 --- a/src/Extension/WithLastModified.php +++ b/src/Extension/ModificationAwareInterface.php @@ -4,9 +4,9 @@ /** * Freshness of templates use the last modification date of each extension class. - * Implement this interface to provide a different last modification date. + * Implement this interface to provide a different modification date for the extension. */ -interface WithLastModified +interface ModificationAwareInterface { /** * @return int A UNIX timestamp diff --git a/src/ExtensionSet.php b/src/ExtensionSet.php index 183bb58dc84..d77d86e3e18 100644 --- a/src/ExtensionSet.php +++ b/src/ExtensionSet.php @@ -15,7 +15,7 @@ use Twig\Extension\ExtensionInterface; use Twig\Extension\GlobalsInterface; use Twig\Extension\StagingExtension; -use Twig\Extension\WithLastModified; +use Twig\Extension\ModificationAwareInterface; use Twig\Node\Expression\Binary\AbstractBinary; use Twig\Node\Expression\Unary\AbstractUnary; use Twig\NodeVisitor\NodeVisitorInterface; @@ -116,7 +116,7 @@ public function getLastModified(): int if (is_file($r->getFileName()) && $this->lastModified < $extensionTime = filemtime($r->getFileName())) { $this->lastModified = $extensionTime; } - if ($extension instanceof WithLastModified && $this->lastModified < $extensionTime = $extension->getLastModified()) { + if ($extension instanceof ModificationAwareInterface && $this->lastModified < $extensionTime = $extension->getLastModified()) { $this->lastModified = $extensionTime; } }