Skip to content

Commit

Permalink
Get rid of config/bootstrap.php for 5.1 apps
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Jan 29, 2020
1 parent 990f591 commit a0cb2ea
Show file tree
Hide file tree
Showing 45 changed files with 132 additions and 46 deletions.
1 change: 0 additions & 1 deletion behat/symfony2-extension/2.1/config/bootstrap.php

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
<?php

use Symfony\Component\Dotenv\Dotenv;

putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = 'test');
require dirname(__DIR__, 2).'/config/bootstrap.php';

if (file_exists(dirname(__DIR__, 2).'/config/bootstrap.php')) {
require dirname(__DIR__, 2).'/config/bootstrap.php';
} elseif (method_exists(Dotenv::class, 'bootEnv')) {
(new Dotenv())->bootEnv(dirname(__DIR__, 2).'/.env');
}
1 change: 0 additions & 1 deletion behat/symfony2-extension/2.1/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"copy-from-recipe": {
"behat.yml.dist": "behat.yml.dist",
"config/": "%CONFIG_DIR%/",
"features/": "features/"
},
"aliases": ["behat"],
Expand Down
1 change: 0 additions & 1 deletion phpunit/phpunit/4.7/config/bootstrap.php

This file was deleted.

1 change: 0 additions & 1 deletion phpunit/phpunit/4.7/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"copy-from-recipe": {
".env.test": ".env.test",
"phpunit.xml.dist": "phpunit.xml.dist",
"config/": "%CONFIG_DIR%/",
"tests/": "tests/"
},
"gitignore": [
Expand Down
2 changes: 1 addition & 1 deletion phpunit/phpunit/4.7/phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="config/bootstrap.php"
bootstrap="tests/bootstrap.php"
>
<php>
<ini name="error_reporting" value="-1" />
Expand Down
1 change: 1 addition & 0 deletions phpunit/phpunit/4.7/tests
Empty file.
43 changes: 43 additions & 0 deletions symfony/console/5.1/bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env php
<?php

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

if (!in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
}

set_time_limit(0);

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

if (!class_exists(Application::class) || !class_exists(Dotenv::class)) {
throw new LogicException('You need to add "symfony/framework-bundle" and "symfony/dotenv" as Composer dependencies.');
}

$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');
}

(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');

if ($_SERVER['APP_DEBUG']) {
umask(0000);

if (class_exists(Debug::class)) {
Debug::enable();
}
}

$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$application = new Application($kernel);
$application->run($input);
6 changes: 6 additions & 0 deletions symfony/console/5.1/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"copy-from-recipe": {
"bin/": "%BIN_DIR%/"
},
"aliases": ["cli"]
}
1 change: 0 additions & 1 deletion symfony/framework-bundle/5.1/config

This file was deleted.

1 change: 1 addition & 0 deletions symfony/framework-bundle/5.1/config/packages/cache.yaml
15 changes: 15 additions & 0 deletions symfony/framework-bundle/5.1/config/packages/framework.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
framework:
#csrf_protection: true
#http_method_override: true

# Enables session support. Note that the session will ONLY be started if you read or write from it.
# Remove or comment this section to explicitly disable session support.
session:
handler_id: null
cookie_secure: auto
cookie_samesite: lax

#esi: true
#fragments: true
php_errors:
log: true
1 change: 1 addition & 0 deletions symfony/framework-bundle/5.1/config/packages/test
1 change: 1 addition & 0 deletions symfony/framework-bundle/5.1/config/routes
1 change: 1 addition & 0 deletions symfony/framework-bundle/5.1/config/services.yaml
2 changes: 1 addition & 1 deletion symfony/framework-bundle/5.1/manifest.json
2 changes: 1 addition & 1 deletion symfony/framework-bundle/5.1/post-install.txt
1 change: 0 additions & 1 deletion symfony/framework-bundle/5.1/public

This file was deleted.

30 changes: 30 additions & 0 deletions symfony/framework-bundle/5.1/public/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

use App\Kernel;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;

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

(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');

if ($_SERVER['APP_DEBUG']) {
umask(0000);

Debug::enable();
}

if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) {
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
}

if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts([$trustedHosts]);
}

$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
1 change: 0 additions & 1 deletion symfony/phpunit-bridge/3.3/config/bootstrap.php

This file was deleted.

2 changes: 1 addition & 1 deletion symfony/phpunit-bridge/3.3/phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xsi:noNamespaceSchemaLocation="bin/.phpunit/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="config/bootstrap.php"
bootstrap="tests/bootstrap.php"
>
<php>
<ini name="error_reporting" value="-1" />
Expand Down
Empty file.
11 changes: 11 additions & 0 deletions symfony/phpunit-bridge/3.3/tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

use Symfony\Component\Dotenv\Dotenv;

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

if (file_exists(dirname(__DIR__).'/config/bootstrap.php')) {
require dirname(__DIR__).'/config/bootstrap.php';
} elseif (method_exists(Dotenv::class, 'bootEnv')) {
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
}
1 change: 1 addition & 0 deletions symfony/phpunit-bridge/4.1/config
1 change: 0 additions & 1 deletion symfony/phpunit-bridge/4.1/config/bootstrap.php

This file was deleted.

15 changes: 0 additions & 15 deletions symfony/phpunit-bridge/4.1/manifest.json

This file was deleted.

1 change: 1 addition & 0 deletions symfony/phpunit-bridge/4.1/manifest.json
2 changes: 1 addition & 1 deletion symfony/phpunit-bridge/4.1/phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xsi:noNamespaceSchemaLocation="bin/.phpunit/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="config/bootstrap.php"
bootstrap="tests/bootstrap.php"
>
<php>
<ini name="error_reporting" value="-1" />
Expand Down
6 changes: 0 additions & 6 deletions symfony/phpunit-bridge/4.1/post-install.txt

This file was deleted.

1 change: 1 addition & 0 deletions symfony/phpunit-bridge/4.1/post-install.txt
1 change: 1 addition & 0 deletions symfony/phpunit-bridge/4.1/tests
Empty file.
1 change: 0 additions & 1 deletion symfony/phpunit-bridge/4.2/.env.test

This file was deleted.

1 change: 0 additions & 1 deletion symfony/phpunit-bridge/4.2/bin

This file was deleted.

1 change: 0 additions & 1 deletion symfony/phpunit-bridge/4.2/config/bootstrap.php

This file was deleted.

1 change: 0 additions & 1 deletion symfony/phpunit-bridge/4.2/manifest.json

This file was deleted.

1 change: 0 additions & 1 deletion symfony/phpunit-bridge/4.2/phpunit.xml.dist

This file was deleted.

1 change: 0 additions & 1 deletion symfony/phpunit-bridge/4.2/post-install.txt

This file was deleted.

1 change: 0 additions & 1 deletion symfony/phpunit-bridge/4.2/tests

This file was deleted.

1 change: 1 addition & 0 deletions symfony/phpunit-bridge/4.3/config
1 change: 0 additions & 1 deletion symfony/phpunit-bridge/4.3/config/bootstrap.php

This file was deleted.

2 changes: 1 addition & 1 deletion symfony/phpunit-bridge/4.3/manifest.json
2 changes: 1 addition & 1 deletion symfony/phpunit-bridge/4.3/phpunit.xml.dist
2 changes: 1 addition & 1 deletion symfony/phpunit-bridge/4.3/post-install.txt
1 change: 1 addition & 0 deletions symfony/phpunit-bridge/4.3/tests
Empty file.

0 comments on commit a0cb2ea

Please sign in to comment.