Skip to content

Commit c84f52a

Browse files
committed
feature #1039 Updated the project to Symfony 5.0 (javiereguiluz)
This PR was squashed before being merged into the master branch (closes #1039). Discussion ---------- Updated the project to Symfony 5.0 I can't see any deprecation messages, so this could be ready for Symfony 5.0 too. Commits ------- b926e87 Updated the project to Symfony 5.0
2 parents c0ccc57 + b926e87 commit c84f52a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1849
-1896
lines changed

.env

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,29 @@
1-
# This file is a "template" of which env vars needs to be defined in your configuration or in an .env file
2-
# Set variables here that may be different on each deployment target of the app, e.g. development, staging, production.
1+
# In all environments, the following files are loaded if they exist,
2+
# the latter taking precedence over the former:
3+
#
4+
# * .env contains default values for the environment variables needed by the app
5+
# * .env.local uncommitted file with local overrides
6+
# * .env.$APP_ENV committed environment-specific defaults
7+
# * .env.$APP_ENV.local uncommitted environment-specific overrides
8+
#
9+
# Real environment variables win over .env files.
10+
#
11+
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
12+
#
13+
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
314
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration
415

516
###> symfony/framework-bundle ###
617
APP_ENV=dev
7-
APP_DEBUG=1
818
APP_SECRET=67d829bf61dc5f87a73fd814e2c9f629
19+
#TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
20+
#TRUSTED_HOSTS='^localhost|example\.com$'
921
###< symfony/framework-bundle ###
1022

1123
###> doctrine/doctrine-bundle ###
1224
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
1325
# For a MySQL database, use: "mysql://db_user:[email protected]:3306/db_name"
26+
# For a PostgreSQL database, use: "postgresql://db_user:[email protected]:5432/db_name?serverVersion=11"
1427
# Configure your db driver and server_version in config/packages/doctrine.yaml
1528
DATABASE_URL=sqlite:///%kernel.project_dir%/data/database.sqlite
1629
###< doctrine/doctrine-bundle ###

.env.test

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
# This file will be loaded after .env file and override environment
2-
# variables for your test environment.
1+
# define your env variables for the test env here
2+
APP_SECRET='$ecretf0rt3st'
33
DATABASE_URL=sqlite:///%kernel.project_dir%/data/database_test.sqlite
4+
KERNEL_CLASS='App\Kernel'
5+
SYMFONY_DEPRECATIONS_HELPER=999999

.gitignore

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
###> symfony/framework-bundle ###
55
/.env.local
6+
/.env.local.php
67
/.env.*.local
78
/public/bundles/
89
/var/
@@ -11,13 +12,9 @@
1112

1213
###> symfony/phpunit-bridge ###
1314
.phpunit
15+
.phpunit.result.cache
1416
/phpunit.xml
1517
###< symfony/phpunit-bridge ###
16-
17-
###> symfony/web-server-bundle ###
18-
/.web-server-pid
19-
###< symfony/web-server-bundle ###
20-
2118
###> friendsofphp/php-cs-fixer ###
2219
/.php_cs
2320
/.php_cs.cache

.travis.yml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,20 @@ cache:
1010
env:
1111
global:
1212
- SYMFONY_PHPUNIT_DIR=./bin/.phpunit
13-
- SYMFONY_DEPRECATIONS_HELPER=29
13+
- SYMFONY_DEPRECATIONS_HELPER=0
1414
- ACTION="install"
1515

1616
matrix:
1717
fast_finish: true
1818
include:
19-
- php: 7.1.18
2019
- php: 7.2
21-
- php: 7.3
22-
# 'php: nightly' is PHP 8.0
23-
- php: 7.4snapshot
24-
- php: 7.3
25-
env: SYMFONY="4.4.*"
26-
ACTION="update"
2720
- php: 7.3
2821
env: SYMFONY="5.0.*"
2922
ACTION="update"
23+
# 'php: nightly' is PHP 8.0
24+
- php: 7.4snapshot
3025
allow_failures:
3126
- php: 7.4snapshot
32-
- php: 7.3
33-
env: SYMFONY="4.4.*"
34-
ACTION="update"
35-
- php: 7.3
36-
env: SYMFONY="5.0.*"
37-
ACTION="update"
3827

3928
before_install:
4029
- '[[ "$TRAVIS_PHP_VERSION" == "7.4snapshot" ]] || phpenv config-rm xdebug.ini'
@@ -62,9 +51,12 @@ script:
6251
- ./bin/console lint:twig templates --env=prod
6352
# this checks that the XLIFF translations contain no syntax errors
6453
- ./bin/console lint:xliff translations
54+
# this checks that arguments injected into services match type declarations
55+
- ./bin/console lint:container
56+
# TODO: replace the old security checker by the new checker provided by the 'symfony' binary
6557
# this checks that the application doesn't use dependencies with known security vulnerabilities
66-
- ./bin/console security:check
58+
#- ./bin/console security:check
6759
# this checks that Doctrine's mapping configurations are valid
6860
- ./bin/console doctrine:schema:validate --skip-sync -vvv --no-interaction
6961
# Fail CI if the repo is in a dirty state after building assets (only for current release ie install)
70-
- if [[ "$ACTION" == "install" ]]; then yarn install && yarn encore production && git add --all && git diff --staged --exit-code; fi
62+
#- if [[ "$ACTION" == "install" ]]; then yarn install && yarn encore production && git add --all && git diff --staged --exit-code; fi

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ Requirements
1414
Installation
1515
------------
1616

17-
Install the [Symfony client][4] binary and run this command:
17+
[Download Symfony][4] to install the `symfony` binary on your computer and run
18+
this command:
1819

1920
```bash
2021
$ symfony new --demo my_project
@@ -30,17 +31,17 @@ Usage
3031
-----
3132

3233
There's no need to configure anything to run the application. If you have
33-
installed the [Symfony client][4] binary, run this command to run the built-in
34-
web server and access the application in your browser at <http://localhost:8000>:
34+
[installed Symfony][4], run this command and access the application in your
35+
browser at the given URL (<https://localhost:8000> by default):
3536

3637
```bash
3738
$ cd my_project/
3839
$ symfony serve
3940
```
4041

41-
If you don't have the Symfony client installed, run `php bin/console server:run`.
42-
Alternatively, you can [configure a web server][3] like Nginx or Apache to run
43-
the application.
42+
If you don't have the Symfony binary installed, run `php -S localhost:8000 -t public/`
43+
to use the built-in PHP web server or [configure a web server][3] like Nginx or
44+
Apache to run the application.
4445

4546
Tests
4647
-----
@@ -52,7 +53,7 @@ $ cd my_project/
5253
$ ./bin/phpunit
5354
```
5455

55-
[1]: https://symfony.com/doc/current/best_practices/index.html
56+
[1]: https://symfony.com/doc/current/best_practices.html
5657
[2]: https://symfony.com/doc/current/reference/requirements.html
5758
[3]: https://symfony.com/doc/current/cookbook/configuration/web_server_configuration.html
5859
[4]: https://symfony.com/download

bin/console

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
use App\Kernel;
55
use Symfony\Bundle\FrameworkBundle\Console\Application;
66
use Symfony\Component\Console\Input\ArgvInput;
7-
use Symfony\Component\Debug\Debug;
7+
use Symfony\Component\ErrorHandler\Debug;
8+
9+
if (false === in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
10+
echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.\PHP_SAPI.' SAPI'.\PHP_EOL;
11+
}
812

913
set_time_limit(0);
1014

@@ -15,10 +19,8 @@ if (!class_exists(Application::class)) {
1519
}
1620

1721
$input = new ArgvInput();
18-
if (null !== $_ENV['APP_ENV'] = $input->getParameterOption(['--env', '-e'], null, true)) {
19-
putenv('APP_ENV='.$_ENV['APP_ENV']);
20-
// force loading .env files when --env is defined
21-
$_SERVER['APP_ENV'] = null;
22+
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
23+
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
2224
}
2325

2426
if ($input->hasParameterOption('--no-debug', true)) {

bin/phpunit

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env php
22
<?php
33

4-
if (!file_exists(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit')) {
5-
echo "Unable to find the `simple-phpunit` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
4+
if (!file_exists(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
5+
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
66
exit(1);
77
}
88

99
if (false === getenv('SYMFONY_PHPUNIT_DIR')) {
1010
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
1111
}
1212

13-
require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit';
13+
require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';

composer.json

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,52 +5,50 @@
55
"description": "Symfony Demo Application",
66
"minimum-stability": "stable",
77
"require": {
8-
"php": "^7.1.3",
8+
"php": "^7.2.9",
99
"ext-pdo_sqlite": "*",
10-
"doctrine/doctrine-bundle": "^1.6.10",
11-
"doctrine/doctrine-migrations-bundle": "^1.3",
10+
"doctrine/doctrine-bundle": "^1.12|^2.0",
11+
"doctrine/doctrine-migrations-bundle": "^1.3|^2.0",
1212
"doctrine/orm": "^2.5.11",
1313
"erusev/parsedown": "^1.6",
1414
"sensio/framework-extra-bundle": "^5.1",
15-
"sensiolabs/security-checker": "^5.0",
16-
"symfony/asset": "*",
17-
"symfony/console": "*",
18-
"symfony/dotenv": "*",
15+
"symfony/asset": "5.0.*",
16+
"symfony/console": "5.0.*",
17+
"symfony/dotenv": "5.0.*",
1918
"symfony/expression-language": "*",
2019
"symfony/flex": "^1.1",
21-
"symfony/form": "*",
20+
"symfony/form": "5.0.*",
2221
"symfony/framework-bundle": "*",
23-
"symfony/intl": "*",
22+
"symfony/intl": "5.0.*",
2423
"symfony/monolog-bundle": "^3.1",
2524
"symfony/polyfill-intl-messageformatter": "^1.12",
2625
"symfony/polyfill-php72": "^1.8",
27-
"symfony/security-bundle": "*",
26+
"symfony/security-bundle": "5.0.*",
2827
"symfony/swiftmailer-bundle": "^3.1",
29-
"symfony/translation": "*",
30-
"symfony/twig-bundle": "*",
31-
"symfony/validator": "*",
28+
"symfony/translation": "5.0.*",
29+
"symfony/twig-bundle": "5.0.*",
30+
"symfony/validator": "5.0.*",
3231
"symfony/webpack-encore-bundle": "^1.4",
33-
"symfony/yaml": "*",
32+
"symfony/yaml": "5.0.*",
3433
"tgalopin/html-sanitizer-bundle": "^1.1",
3534
"twig/extensions": "^1.5",
3635
"twig/twig": "^2.6"
3736
},
3837
"require-dev": {
39-
"dama/doctrine-test-bundle": "^5.0",
38+
"dama/doctrine-test-bundle": "^6.2",
4039
"doctrine/doctrine-fixtures-bundle": "^3.0",
41-
"friendsofphp/php-cs-fixer": "^2.12",
42-
"symfony/browser-kit": "*",
43-
"symfony/css-selector": "*",
44-
"symfony/debug-bundle": "*",
40+
"friendsofphp/php-cs-fixer": "3.0.x-dev",
41+
"symfony/browser-kit": "5.0.*",
42+
"symfony/css-selector": "5.0.*",
43+
"symfony/debug-bundle": "5.0.*",
4544
"symfony/maker-bundle": "^1.11",
46-
"symfony/phpunit-bridge": "*",
47-
"symfony/stopwatch": "*",
48-
"symfony/web-profiler-bundle": "*",
49-
"symfony/web-server-bundle": "*"
45+
"symfony/phpunit-bridge": "5.0.*",
46+
"symfony/stopwatch": "5.0.*",
47+
"symfony/web-profiler-bundle": "5.0.*"
5048
},
5149
"config": {
5250
"platform": {
53-
"php": "7.1.3"
51+
"php": "7.2.9"
5452
},
5553
"preferred-install": {
5654
"*": "dist"
@@ -70,8 +68,7 @@
7068
"scripts": {
7169
"auto-scripts": {
7270
"cache:clear": "symfony-cmd",
73-
"assets:install --symlink --relative %PUBLIC_DIR%": "symfony-cmd",
74-
"security-checker security:check": "script"
71+
"assets:install --symlink --relative %PUBLIC_DIR%": "symfony-cmd"
7572
},
7673
"post-install-cmd": [
7774
"@auto-scripts"
@@ -86,7 +83,7 @@
8683
"extra": {
8784
"symfony": {
8885
"allow-contrib": true,
89-
"require": "4.3.*"
86+
"require": "5.0.*"
9087
}
9188
}
9289
}

0 commit comments

Comments
 (0)