Skip to content

Commit

Permalink
fix phpstan error.
Browse files Browse the repository at this point in the history
  • Loading branch information
mike4git committed Jan 16, 2024
1 parent 87825d1 commit 2a3e1db
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tests/app/bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env php
<?php

use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\ErrorHandler\Debug;

set_time_limit(0);

require dirname(__DIR__, 3) . '/vendor/autoload.php';
require dirname(__DIR__) . '/TestKernel.php';

$input = new ArgvInput();
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
}

if ($input->hasParameterOption('--no-debug', true)) {
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
}

$_SERVER += $_ENV;
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'test';
$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? ('prod' !== $_SERVER['APP_ENV']);
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';

//if ($_SERVER['APP_DEBUG']) {
// umask(0000);
//
// if (class_exists(Debug::class)) {
// Debug::enable();
// }
//}

$kernel = new TestKernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$application = new Application($kernel);
$application->run($input);

0 comments on commit 2a3e1db

Please sign in to comment.