<p dir="auto">In Symfony <code class="notranslate">2.3.24</code> I'm receiving an PHP Fatal error while trying to throw 404 Exception with <code class="notranslate">createNotFoundException</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="PHP Fatal error:  Cannot redeclare class Symfony\\Component\\Debug\\Exception\\FlattenException in vendor/symfony/symfony/src/Symfony/Component/Debug/Exception/FlattenException.php on line 25"><pre class="notranslate"><code class="notranslate">PHP Fatal error:  Cannot redeclare class Symfony\\Component\\Debug\\Exception\\FlattenException in vendor/symfony/symfony/src/Symfony/Component/Debug/Exception/FlattenException.php on line 25
</code></pre></div>
<p dir="auto">I've checked the file <code class="notranslate">FlattenException.php</code> and noticed that there is a second definition of the <code class="notranslate">FlattenException</code> class (<a href="https://github.com/symfony/symfony/blob/2.3/src/Symfony/Component/Debug/Exception/FlattenException.php#L283">https://github.com/symfony/symfony/blob/2.3/src/Symfony/Component/Debug/Exception/FlattenException.php#L283</a>). It seems that part of the code was added accidentally during the commit <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/symfony/symfony/commit/1d68ad326548b7f8fd991cdbb126961cd26310be/hovercard" href="https://github.com/symfony/symfony/commit/1d68ad326548b7f8fd991cdbb126961cd26310be"><tt>1d68ad3</tt></a></p>
<p dir="auto">In Symfony 2.7, we made it possible to use most features of Symfony without enabling the templating component (assuming you don't use a bundle relying on them of course).<br>
However, we have 3 shortcut methods in the base controller which are not compatible with such setup and force the usage of the templating component:</p>
<ul dir="auto">
<li><code class="notranslate">render</code></li>
<li><code class="notranslate">renderView</code></li>
<li><code class="notranslate">stream</code></li>
</ul>
<p dir="auto">Most projects based on Symfony are probably relying on them, as this is the documented way to render templates.</p>
<p dir="auto">All of them can be implemented on top of Twig directly quite easily. I suggest doing this in 2.8 in case the templating component is not available.</p>