Skip to content

Commit

Permalink
Remove comparison with 'production' in Template class
Browse files Browse the repository at this point in the history
Everything that is not the same as 'development' must be considered as
production mode.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
  • Loading branch information
MauricioFauth committed Oct 26, 2022
1 parent 2f3aafe commit 35401ad
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
7 changes: 2 additions & 5 deletions libraries/classes/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
use Twig\TemplateWrapper;

use function __;
use function is_array;
use function sprintf;
use function trigger_error;

Expand Down Expand Up @@ -76,15 +75,13 @@ public static function getTwigEnvironment(?string $cacheDir): Environment

$twig->addRuntimeLoader(new ContainerRuntimeLoader(Core::getContainerBuilder()));

if (is_array($GLOBALS['cfg']) && ($GLOBALS['cfg']['environment'] ?? '') === 'development') {
if (($GLOBALS['cfg']['environment'] ?? '') === 'development') {
$twig->enableDebug();
$twig->addExtension(new DebugExtension());
// This will enable debug for the extension to print lines
// It is used in po file lines re-mapping
TransNode::$enableAddDebugInfo = true;
}

if ($GLOBALS['cfg']['environment'] === 'production') {
} else {
$twig->disableDebug();
TransNode::$enableAddDebugInfo = false;
}
Expand Down
3 changes: 0 additions & 3 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13679,9 +13679,6 @@
</PossiblyNullOperand>
</file>
<file src="libraries/classes/Template.php">
<RedundantCondition occurrences="1">
<code>is_array($GLOBALS['cfg'])</code>
</RedundantCondition>
<RedundantConditionGivenDocblockType occurrences="1">
<code>static::$twig !== null</code>
</RedundantConditionGivenDocblockType>
Expand Down

0 comments on commit 35401ad

Please sign in to comment.