mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-13 10:56:38 +00:00
Remove deprecated clode
This commit is contained in:
@@ -11,7 +11,6 @@
|
||||
|
||||
namespace Twig\Test;
|
||||
|
||||
use PHPUnit\Framework\Attributes\BeforeClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Twig\Compiler;
|
||||
@@ -23,26 +22,15 @@ abstract class NodeTestCase extends TestCase
|
||||
{
|
||||
private Environment $currentEnv;
|
||||
|
||||
public function getTests()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return iterable<array{0: Node, 1: string, 2?: Environment|null, 3?: bool}>
|
||||
*/
|
||||
public static function provideTests(): iterable
|
||||
{
|
||||
trigger_deprecation('twig/twig', '3.13', 'Not implementing "%s()" in "%s" is deprecated. This method will be abstract in 4.0.', __METHOD__, static::class);
|
||||
|
||||
return [];
|
||||
}
|
||||
abstract public static function provideTests(): iterable;
|
||||
|
||||
/**
|
||||
* @dataProvider getTests
|
||||
* @dataProvider provideTests
|
||||
*/
|
||||
#[DataProvider('getTests'), DataProvider('provideTests')]
|
||||
#[DataProvider('provideTests')]
|
||||
public function testCompile($node, $source, $environment = null, $isPattern = false)
|
||||
{
|
||||
$this->assertNodeCompilation($source, $node, $environment, $isPattern);
|
||||
@@ -78,16 +66,6 @@ abstract class NodeTestCase extends TestCase
|
||||
return new Environment(new ArrayLoader());
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Twig 3.13, use createVariableGetter() instead.
|
||||
*/
|
||||
protected function getVariableGetter($name, $line = false)
|
||||
{
|
||||
trigger_deprecation('twig/twig', '3.13', 'Method "%s()" is deprecated, use "createVariableGetter()" instead.', __METHOD__);
|
||||
|
||||
return self::createVariableGetter($name, $line);
|
||||
}
|
||||
|
||||
final protected static function createVariableGetter(string $name, bool $line = false): string
|
||||
{
|
||||
$line = $line > 0 ? "// line $line\n" : '';
|
||||
@@ -95,28 +73,8 @@ abstract class NodeTestCase extends TestCase
|
||||
return \sprintf('%s($context["%s"] ?? null)', $line, $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Twig 3.13, use createAttributeGetter() instead.
|
||||
*/
|
||||
protected function getAttributeGetter()
|
||||
{
|
||||
trigger_deprecation('twig/twig', '3.13', 'Method "%s()" is deprecated, use "createAttributeGetter()" instead.', __METHOD__);
|
||||
|
||||
return self::createAttributeGetter();
|
||||
}
|
||||
|
||||
final protected static function createAttributeGetter(): string
|
||||
{
|
||||
return 'CoreExtension::getAttribute($this->env, $this->source, ';
|
||||
}
|
||||
|
||||
/** @beforeClass */
|
||||
#[BeforeClass]
|
||||
final public static function checkDataProvider(): void
|
||||
{
|
||||
$r = new \ReflectionMethod(static::class, 'getTests');
|
||||
if ($r->getDeclaringClass()->getName() !== self::class) {
|
||||
trigger_deprecation('twig/twig', '3.13', 'Implementing "%s::getTests()" in "%s" is deprecated, implement "provideTests()" instead.', self::class, static::class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user