Closed
Description
When running tests, I get 4 deprecation notices:
Remaining deprecation notices (4)
Global variable "_self" is deprecated in ? at line 87: 1x
1x in DefaultControllerTest::testPublicUrls from AppBundle\Tests\Controller
Global variable "_self" is deprecated in ? at line 62: 1x
1x in DefaultControllerTest::testPublicUrls from AppBundle\Tests\Controller
Global variable "_self" is deprecated in ? at line 28: 1x
1x in BlogControllerTest::testIndex from AppBundle\Tests\Controller
Global variable "_self" is deprecated in ? at line 57: 1x
1x in BlogControllerTest::testAdministratorUsersCanAccessToTheBackend from AppBundle\Tests\Controller\Admin
The reason is that our templates use this code:
{{ show_source_code(_self) }}
The _self
variable is deprecated and it will be removed in Twig 2.0. We need to replace it by:
{{ show_source_code() }}
But then, inside the Twig extension I don't know how to get the name or path or code of the template that called the show_source_code()
function.