mirror of
https://github.com/twigphp/Twig.git
synced 2026-08-30 03:57:21 +00:00
minor #4732 Fix deprecations (fabpot)
This PR was merged into the 3.x branch.
Discussion
----------
Fix deprecations
Commits
-------
8391928896 Fix deprecations
This commit is contained in:
@@ -158,7 +158,6 @@ class CallTest extends TestCase
|
||||
private function getArguments($call, $args)
|
||||
{
|
||||
$m = new \ReflectionMethod($call, 'getArguments');
|
||||
$m->setAccessible(true);
|
||||
|
||||
return $m->invokeArgs($call, $args);
|
||||
}
|
||||
|
||||
@@ -77,7 +77,6 @@ class ParserTest extends TestCase
|
||||
{
|
||||
$parser = $this->getParser();
|
||||
$m = new \ReflectionMethod($parser, 'filterBodyNodes');
|
||||
$m->setAccessible(true);
|
||||
|
||||
$this->assertEquals($expected, $m->invoke($parser, $input));
|
||||
}
|
||||
@@ -108,7 +107,6 @@ class ParserTest extends TestCase
|
||||
$parser = $this->getParser();
|
||||
|
||||
$m = new \ReflectionMethod($parser, 'filterBodyNodes');
|
||||
$m->setAccessible(true);
|
||||
|
||||
$this->expectException(SyntaxError::class);
|
||||
$m->invoke($parser, $input);
|
||||
@@ -130,7 +128,6 @@ class ParserTest extends TestCase
|
||||
$parser = $this->getParser();
|
||||
|
||||
$m = new \ReflectionMethod($parser, 'filterBodyNodes');
|
||||
$m->setAccessible(true);
|
||||
$this->assertNull($m->invoke($parser, new TextNode(\chr(0xEF).\chr(0xBB).\chr(0xBF).$emptyNode, 1)));
|
||||
}
|
||||
|
||||
@@ -165,7 +162,6 @@ class ParserTest extends TestCase
|
||||
], new Source('', '')));
|
||||
|
||||
$p = new \ReflectionProperty($parser, 'parent');
|
||||
$p->setAccessible(true);
|
||||
$this->assertNull($p->getValue($parser));
|
||||
}
|
||||
|
||||
@@ -216,7 +212,6 @@ EOF
|
||||
$parser->setParent(new EmptyNode());
|
||||
|
||||
$p = new \ReflectionProperty($parser, 'stream');
|
||||
$p->setAccessible(true);
|
||||
$p->setValue($parser, new TokenStream([], new Source('', '')));
|
||||
|
||||
return $parser;
|
||||
|
||||
@@ -48,7 +48,6 @@ abstract class ProfilerTestCase extends TestCase
|
||||
];
|
||||
|
||||
$p = new \ReflectionProperty($profile, 'profiles');
|
||||
$p->setAccessible(true);
|
||||
$p->setValue($profile, $subProfiles);
|
||||
|
||||
return $profile;
|
||||
@@ -92,18 +91,15 @@ abstract class ProfilerTestCase extends TestCase
|
||||
$profile = new Profile($templateName, $type, $name);
|
||||
|
||||
$p = new \ReflectionProperty($profile, 'profiles');
|
||||
$p->setAccessible(true);
|
||||
$p->setValue($profile, $subProfiles);
|
||||
|
||||
$starts = new \ReflectionProperty($profile, 'starts');
|
||||
$starts->setAccessible(true);
|
||||
$starts->setValue($profile, [
|
||||
'wt' => 0,
|
||||
'mu' => 0,
|
||||
'pmu' => 0,
|
||||
]);
|
||||
$ends = new \ReflectionProperty($profile, 'ends');
|
||||
$ends->setAccessible(true);
|
||||
$ends->setValue($profile, [
|
||||
'wt' => $duration,
|
||||
'mu' => 0,
|
||||
|
||||
@@ -203,7 +203,7 @@ class TemplateTest extends TestCase
|
||||
}
|
||||
$this->assertSame('FloatButString', $array['1.5']);
|
||||
$this->assertSame('IntegerButStringWithLeadingZeros', $array['01']);
|
||||
$this->assertSame('EmptyString', $array[null]);
|
||||
$this->assertSame('EmptyString', $array['']);
|
||||
|
||||
$this->assertSame('Zero', CoreExtension::getAttribute($twig, $template->getSourceContext(), $array, false), 'false is treated as 0 when accessing a sequence/mapping (equals PHP behavior)');
|
||||
$this->assertSame('One', CoreExtension::getAttribute($twig, $template->getSourceContext(), $array, true), 'true is treated as 1 when accessing a sequence/mapping (equals PHP behavior)');
|
||||
|
||||
Reference in New Issue
Block a user