Remove deprecated code

This commit is contained in:
Fabien Potencier
2023-12-10 20:59:32 +01:00
parent ac423430aa
commit f84c2172bf
19 changed files with 0 additions and 858 deletions
-6
View File
@@ -34,12 +34,6 @@
"psr/container": "^1.0|^2.0"
},
"autoload": {
"files": [
"src/Resources/core.php",
"src/Resources/debug.php",
"src/Resources/escaper.php",
"src/Resources/string_loader.php"
],
"psr-4" : {
"Twig\\" : "src/"
}
@@ -1,24 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Twig\Extra\CssInliner;
/**
* @internal
*
* @deprecated since Twig 3.9.0
*/
function twig_inline_css(string $body, string ...$css): string
{
trigger_deprecation('twig/cssinliner-extra', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CssInlinerExtension::inlineCss($body, ...$css);
}
@@ -1,28 +0,0 @@
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Twig\Extra\CssInliner\Tests;
use PHPUnit\Framework\TestCase;
use Twig\Extra\CssInliner\CssInlinerExtension;
use function Twig\Extra\CssInliner\twig_inline_css;
/**
* @group legacy
*/
class LegacyFunctionsTest extends TestCase
{
public function testInlineCss()
{
$this->assertSame(CssInlinerExtension::inlineCss('<p>body</p>', 'p { color: red }'), twig_inline_css('<p>body</p>', 'p { color: red }'));
}
}
-1
View File
@@ -24,7 +24,6 @@
"symfony/phpunit-bridge": "^6.4|^7.0"
},
"autoload": {
"files": [ "Resources/functions.php" ],
"psr-4" : { "Twig\\Extra\\CssInliner\\" : "" },
"exclude-from-classmap": [
"/Tests/"
-24
View File
@@ -1,24 +0,0 @@
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Twig\Extra\Html\HtmlExtension;
/**
* @internal
*
* @deprecated since Twig 3.9.0
*/
function twig_html_classes(...$args): string
{
trigger_deprecation('twig/html-extra', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return HtmlExtension::htmlClasses(...$args);
}
@@ -1,26 +0,0 @@
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Twig\Extra\Html\Tests;
use PHPUnit\Framework\TestCase;
use Twig\Extra\Html\HtmlExtension;
/**
* @group legacy
*/
class LegacyFunctionsTest extends TestCase
{
public function testHtmlToMarkdown()
{
$this->assertSame(HtmlExtension::htmlClasses(['charset' => 'utf-8']), \twig_html_classes(['charset' => 'utf-8']));
}
}
-1
View File
@@ -24,7 +24,6 @@
"symfony/phpunit-bridge": "^6.4|^7.0"
},
"autoload": {
"files": [ "Resources/functions.php" ],
"psr-4" : { "Twig\\Extra\\Html\\" : "" },
"exclude-from-classmap": [
"/Tests/"
-24
View File
@@ -1,24 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Twig\Extra\Inky;
/**
* @internal
*
* @deprecated since Twig 3.9.0
*/
function twig_inky(string $body): string
{
trigger_deprecation('twig/inky-extra', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return InkyExtension::inky($body);
}
@@ -1,28 +0,0 @@
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Twig\Extra\Inky\Tests;
use PHPUnit\Framework\TestCase;
use Twig\Extra\Inky\InkyExtension;
use function Twig\Extra\Inky\twig_inky;
/**
* @group legacy
*/
class LegacyFunctionsTest extends TestCase
{
public function testInlineCss()
{
$this->assertSame(InkyExtension::inky('<p>Foo</p>'), twig_inky('<p>Foo</p>'));
}
}
-1
View File
@@ -24,7 +24,6 @@
"symfony/phpunit-bridge": "^6.4|^7.0"
},
"autoload": {
"files": [ "Resources/functions.php" ],
"psr-4" : { "Twig\\Extra\\Inky\\" : "" },
"exclude-from-classmap": [
"/Tests/"
@@ -1,24 +0,0 @@
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Twig\Extra\Markdown;
/**
* @internal
*
* @deprecated since Twig 3.9.0
*/
function html_to_markdown(string $body, array $options = []): string
{
trigger_deprecation('twig/intl-extra', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return MarkdownExtension::htmlToMarkdown($body, $options);
}
@@ -1,29 +0,0 @@
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Twig\Extra\Markdown\Tests;
use PHPUnit\Framework\TestCase;
use function Twig\Extra\Markdown\html_to_markdown;
use Twig\Extra\Markdown\MarkdownExtension;
/**
* @group legacy
*/
class LegacyFunctionsTest extends TestCase
{
public function testHtmlToMarkdown()
{
$this->assertSame(MarkdownExtension::htmlToMarkdown('<p>foo</p>'), html_to_markdown('<p>foo</p>'));
}
}
-1
View File
@@ -27,7 +27,6 @@
"michelf/php-markdown": "^1.8|^2.0"
},
"autoload": {
"files": [ "Resources/functions.php" ],
"psr-4" : { "Twig\\Extra\\Markdown\\" : "" },
"exclude-from-classmap": [
"/Tests/"
-497
View File
@@ -1,497 +0,0 @@
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Twig\Environment;
use Twig\Extension\CoreExtension;
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_cycle($values, $position)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::cycle($values, $position);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_random(Environment $env, $values = null, $max = null)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::random($env, $values, $max);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_date_format_filter(Environment $env, $date, $format = null, $timezone = null)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::dateFormatFilter($env, $date, $format, $timezone);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_date_modify_filter(Environment $env, $date, $modifier)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::dateModifyFilter($env, $date, $modifier);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_sprintf($format, ...$values)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::sprintf($format, ...$values);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_date_converter(Environment $env, $date = null, $timezone = null)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::dateConverter($env, $date, $timezone);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_replace_filter($str, $from)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::replaceFilter($str, $from);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_round($value, $precision = 0, $method = 'common')
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::round($value, $precision, $method);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_number_format_filter(Environment $env, $number, $decimal = null, $decimalPoint = null, $thousandSep = null)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::numberFormatFilter($env, $number, $decimal, $decimalPoint, $thousandSep);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_urlencode_filter($url)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::urlencodeFilter($url);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_array_merge(...$arrays)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::arrayMerge(...$arrays);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_slice(Environment $env, $item, $start, $length = null, $preserveKeys = false)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::slice($env, $item, $start, $length, $preserveKeys);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_first(Environment $env, $item)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::first($env, $item);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_last(Environment $env, $item)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::last($env, $item);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_join_filter($value, $glue = '', $and = null)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::joinFilter($value, $glue, $and);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_split_filter(Environment $env, $value, $delimiter, $limit = null)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::splitFilter($env, $value, $delimiter, $limit);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_get_array_keys_filter($array)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::getArrayKeysFilter($array);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_reverse_filter(Environment $env, $item, $preserveKeys = false)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::reverseFilter($env, $item, $preserveKeys);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_sort_filter(Environment $env, $array, $arrow = null)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::sortFilter($env, $array, $arrow);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_matches(string $regexp, ?string $str)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::matches($regexp, $str);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_trim_filter($string, $characterMask = null, $side = 'both')
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::trimFilter($string, $characterMask, $side);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_nl2br($string)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::nl2br($string);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_spaceless($content)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::spaceless($content);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_convert_encoding($string, $to, $from)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::convertEncoding($string, $to, $from);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_length_filter(Environment $env, $thing)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::lengthFilter($env, $thing);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_upper_filter(Environment $env, $string)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::upperFilter($env, $string);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_lower_filter(Environment $env, $string)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::lowerFilter($env, $string);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_striptags($string, $allowable_tags = null)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::striptags($string, $allowable_tags);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_title_string_filter(Environment $env, $string)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::titleStringFilter($env, $string);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_capitalize_string_filter(Environment $env, $string)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::capitalizeStringFilter($env, $string);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_test_empty($value)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::testEmpty($value);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_test_iterable($value)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return is_iterable($value);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_include(Environment $env, $context, $template, $variables = [], $withContext = true, $ignoreMissing = false, $sandboxed = false)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::include($env, $context, $template, $variables, $withContext, $ignoreMissing, $sandboxed);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_source(Environment $env, $name, $ignoreMissing = false)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::source($env, $name, $ignoreMissing);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_constant($constant, $object = null)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::constant($constant, $object);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_constant_is_defined($constant, $object = null)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::constantIsDefined($constant, $object);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_array_batch($items, $size, $fill = null, $preserveKeys = true)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::arrayBatch($items, $size, $fill, $preserveKeys);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_array_column($array, $name, $index = null): array
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::arrayColumn($array, $name, $index);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_array_filter(Environment $env, $array, $arrow)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::arrayFilter($env, $array, $arrow);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_array_map(Environment $env, $array, $arrow)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::arrayMap($env, $array, $arrow);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_array_reduce(Environment $env, $array, $arrow, $initial = null)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::arrayReduce($env, $array, $arrow, $initial);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_array_some(Environment $env, $array, $arrow)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::arraySome($env, $array, $arrow);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_array_every(Environment $env, $array, $arrow)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::arrayEvery($env, $array, $arrow);
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_check_arrow_in_sandbox(Environment $env, $arrow, $thing, $type)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return CoreExtension::checkArrowInSandbox($env, $arrow, $thing, $type);
}
-24
View File
@@ -1,24 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Twig\Environment;
use Twig\Extension\DebugExtension;
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_var_dump(Environment $env, $context, ...$vars)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
DebugExtension::dump($env, $context, ...$vars);
}
-35
View File
@@ -1,35 +0,0 @@
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Twig\Environment;
use Twig\Extension\EscaperExtension;
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_raw_filter($string)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return $string;
}
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_escape_filter(Environment $env, $string, $strategy = 'html', $charset = null, $autoescape = false)
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return EscaperExtension::escape($env, $string, $strategy, $charset, $autoescape);
}
-25
View File
@@ -1,25 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Twig\Environment;
use Twig\Extension\StringLoaderExtension;
use Twig\TemplateWrapper;
/**
* @internal
* @deprecated since Twig 3.9.0
*/
function twig_template_from_string(Environment $env, $template, string $name = null): TemplateWrapper
{
trigger_deprecation('twig/twig', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__);
return StringLoaderExtension::templateFromString($env, $template, $name);
}
@@ -1,30 +0,0 @@
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Twig\Tests\Extension;
use PHPUnit\Framework\TestCase;
use Twig\Environment;
use Twig\Extension\DebugExtension;
use Twig\Loader\ArrayLoader;
/**
* @group legacy
*/
class LegacyDebugFunctionsTest extends TestCase
{
public function testDump()
{
$env = new Environment(new ArrayLoader());
$this->assertSame(DebugExtension::dump($env, 'Foo'), twig_var_dump($env, 'Foo'));
}
}
@@ -1,30 +0,0 @@
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Twig\Tests\Extension;
use PHPUnit\Framework\TestCase;
use Twig\Environment;
use Twig\Extension\StringLoaderExtension;
use Twig\Loader\ArrayLoader;
/**
* @group legacy
*/
class LegacyStringLoaderFunctionsTest extends TestCase
{
public function testTemplateFromString()
{
$env = new Environment(new ArrayLoader());
$this->assertSame(StringLoaderExtension::templateFromString($env, 'Foo')->render(), twig_template_from_string($env, 'Foo')->render());
}
}