Fix coding standards problems

Fixes #4
This commit is contained in:
Oliver Davies 2020-04-30 00:20:57 +01:00
parent d577510355
commit 3d2290c194
5 changed files with 31 additions and 23 deletions

View file

@ -5,12 +5,18 @@ use Symfony\Component\Dotenv\Dotenv;
require dirname(__DIR__) . '/vendor/autoload.php';
if (!class_exists(Dotenv::class)) {
throw new LogicException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
throw new LogicException(
'Please run "composer require symfony/dotenv" to load the ".env" files
configuring the application.'
);
}
// Load cached env vars if the .env.local.php file exists
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
if (is_array($env = @include dirname(__DIR__).'/.env.local.php') && (!isset($env['APP_ENV']) || ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env['APP_ENV']) === $env['APP_ENV'])) {
if (
is_array($env = @include dirname(__DIR__) . '/.env.local.php') &&
(!isset($env['APP_ENV']) || ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env['APP_ENV']) === $env['APP_ENV'])
) {
(new Dotenv(false))->populate($env);
} else {
// load all the .env files
@ -20,4 +26,5 @@ if (is_array($env = @include dirname(__DIR__).'/.env.local.php') && (!isset($env
$_SERVER += $_ENV;
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
$_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';
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG']
|| filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';

View file

@ -13,7 +13,10 @@ if ($_SERVER['APP_DEBUG']) {
}
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
Request::setTrustedProxies(
explode(',', $trustedProxies),
Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST
);
}
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {

View file

@ -15,5 +15,4 @@ final class EventCollection extends Collection
return !Arr::get($rsvp, 'member.event_context.host');
});
}
}

View file

@ -192,5 +192,4 @@ final class GetRaffleWinnerCommand extends Command
exec(sprintf('xdg-open %s', $photo));
}
}
}