mirror of
https://github.com/twigphp/Twig.git
synced 2026-10-02 18:07:35 +00:00
Deprecate calling TemplateWrapper::unwrap() without arguments as of 3.30 and list the fix in the CHANGELOG
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
* Fix `IntlExtension` letting the pattern derived from a date formatter prototype override an explicit locale
|
||||
* Fix `IntlExtension` not honoring the locale of a date formatter prototype configured with no date and time styles
|
||||
* Speed up macro calls
|
||||
* Fix `TemplateWrapper::unwrap()` failing when called without arguments, which is now deprecated
|
||||
* Add `TemplateWrapper::getDefaultEscapeStrategy()` to know the escaping strategy a template was compiled with
|
||||
* Report a clear error when `random`, `reverse`, `shuffle`, and `split` receive a string that is not valid UTF-8
|
||||
* Fix the deprecation about omitting parentheses when calling a macro being reported twice for the same call
|
||||
|
||||
@@ -124,7 +124,7 @@ final class TemplateWrapper
|
||||
public function unwrap(?Environment $env = null): Template
|
||||
{
|
||||
if (null === $env) {
|
||||
trigger_deprecation('twig/twig', '3.29', 'Calling "%s()" without arguments is deprecated, pass the Twig environment instead.', __METHOD__);
|
||||
trigger_deprecation('twig/twig', '3.30', 'Calling "%s()" without arguments is deprecated, pass the Twig environment instead.', __METHOD__);
|
||||
} elseif (!$this->isOwnedBy($env)) {
|
||||
throw new RuntimeError(\sprintf('A "%s" can only be used with the "%s" that created it.', self::class, Environment::class));
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ class TemplateWrapperTest extends TestCase
|
||||
$twig = new Environment(new ArrayLoader(['index' => 'content']));
|
||||
$wrapper = $twig->load('index');
|
||||
|
||||
$this->expectDeprecation('Since twig/twig 3.29: Calling "Twig\TemplateWrapper::unwrap()" without arguments is deprecated, pass the Twig environment instead.');
|
||||
$this->expectDeprecation('Since twig/twig 3.30: Calling "Twig\TemplateWrapper::unwrap()" without arguments is deprecated, pass the Twig environment instead.');
|
||||
|
||||
$this->assertInstanceOf(Template::class, $wrapper->unwrap());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user