Skip to content

Commit

Permalink
Merge pull request #1331 from BernhardWebstudio/patch-1319
Browse files Browse the repository at this point in the history
Use `dev` as Symfony default env to fix issue #1319
  • Loading branch information
TomasVotruba authored Apr 21, 2019
2 parents 9eb686f + 1825bcb commit de9eab4
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php declare (strict_types = 1);

namespace Rector\Symfony\Bridge\DependencyInjection;

Expand Down Expand Up @@ -38,7 +38,8 @@ private function createContainerFromKernelClass(string $kernelClass): Container
$containerBuilder->getCompilerPassConfig()->setRemovingPasses([]);

// anonymous class on intention, since this depends on Symfony\DependencyInjection in rector-prefixed
$containerBuilder->getCompilerPassConfig()->addPass(new class() implements CompilerPassInterface {
$containerBuilder->getCompilerPassConfig()->addPass(new class () implements CompilerPassInterface
{
public function process(ContainerBuilder $containerBuilder): void
{
foreach ($containerBuilder->getDefinitions() as $definition) {
Expand All @@ -57,8 +58,8 @@ public function process(ContainerBuilder $containerBuilder): void

private function createKernelFromKernelClass(string $kernelClass): Kernel
{
$environment = $options['environment'] ?? $_ENV['APP_ENV'] ?? $_SERVER['APP_ENV'] ?? 'test';
$debug = (bool) ($options['debug'] ?? $_ENV['APP_DEBUG'] ?? $_SERVER['APP_DEBUG'] ?? true);
$environment = $_ENV['APP_ENV'] ?? $_SERVER['APP_ENV'] ?? 'dev';
$debug = (bool)($_ENV['APP_DEBUG'] ?? $_SERVER['APP_DEBUG'] ?? true);

return new $kernelClass($environment, $debug);
}
Expand Down

0 comments on commit de9eab4

Please sign in to comment.