Skip to content

Commit

Permalink
Merge branch '3.x' into 4.x
Browse files Browse the repository at this point in the history
* 3.x:
  Remove the templateClassPrefix property on Environment
  • Loading branch information
fabpot committed Jul 31, 2024
2 parents 96b11f7 + 205ea9e commit 01a3831
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
3 changes: 1 addition & 2 deletions src/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ class Environment
*/
private array $loadedTemplates;
private bool $strictVariables;
private string $templateClassPrefix = '__TwigTemplate_';
private CacheInterface|string|false $originalCache;
private ExtensionSet $extensionSet;
/**
Expand Down Expand Up @@ -280,7 +279,7 @@ public function getTemplateClass(string $name, ?int $index = null): string
{
$key = $this->getLoader()->getCacheKey($name).$this->optionsHash;

return $this->templateClassPrefix.hash('xxh128', $key).(null === $index ? '' : '___'.$index);
return '__TwigTemplate_'.hash('xxh128', $key).(null === $index ? '' : '___'.$index);
}

/**
Expand Down
4 changes: 0 additions & 4 deletions src/Test/IntegrationTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,6 @@ protected function doIntegrationTest($file, $message, $condition, $templates, $e
$twig->addFunction($function);
}

// avoid using the same PHP class name for different cases
$p = new \ReflectionProperty($twig, 'templateClassPrefix');
$p->setValue($twig, '__TwigTemplate_'.hash('xxh128', random_bytes(32), false).'_');

$deprecations = [];
try {
$prevHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) use (&$deprecations, &$prevHandler) {
Expand Down

0 comments on commit 01a3831

Please sign in to comment.