mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-18 21:37:29 +00:00
feature #2969 Make Template::getSourceContext() abstract (fabpot)
This PR was merged into the 3.x branch.
Discussion
----------
Make Template::getSourceContext() abstract
As the implementation is always provided by ModuleNode.
Commits
-------
b3498de4 made Template::getSourceContext() abstract
This commit is contained in:
+1
-4
@@ -66,10 +66,7 @@ abstract class Template
|
||||
*
|
||||
* @return Source
|
||||
*/
|
||||
public function getSourceContext()
|
||||
{
|
||||
return new Source('', $this->getTemplateName());
|
||||
}
|
||||
abstract public function getSourceContext();
|
||||
|
||||
/**
|
||||
* Returns the parent template.
|
||||
|
||||
@@ -16,6 +16,7 @@ use Twig\Loader\ArrayLoader;
|
||||
use Twig\Loader\LoaderInterface;
|
||||
use Twig\Sandbox\SecurityError;
|
||||
use Twig\Sandbox\SecurityPolicy;
|
||||
use Twig\Source;
|
||||
use Twig\Template;
|
||||
|
||||
class Twig_Tests_TemplateTest extends \PHPUnit\Framework\TestCase
|
||||
@@ -440,6 +441,11 @@ class Twig_TemplateTest extends Template
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getSourceContext()
|
||||
{
|
||||
return new Source('', $this->getTemplateName());
|
||||
}
|
||||
|
||||
protected function doGetParent(array $context)
|
||||
{
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user