I want to override a core Symfony2 Class.
Specifically I want to override vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateReference.php, th
You can easily override some classes defined as service (you can check on app/cache/dev/appDevDebugProejctContainer.xml), and override the service name on your parameter.ini.
BUT if the class it not defined like this, you can create your own "patch" you apply after a composer update.
Lot of people will say its dirty to edit core classes, but if you want good performance, its often the only solution to achieve it ;-), its simple, fast & easy.
Other solutions are welcome ..