Skip to content

Commit 0147c8f

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 3411276 + 84ce7e6 commit 0147c8f

File tree

4,191 files changed

+103088
-54833
lines changed

Some content is hidden

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

4,191 files changed

+103088
-54833
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
| Q | A
22
| ------------- | ---
3-
| Branch? | master / 2.7, 2.8, 3.1 or 3.2 <!--see comment below-->
3+
| Branch? | 3.4 or master / 2.7, 2.8 or 3.3 <!-- see comment below -->
44
| Bug fix? | yes/no
5-
| New feature? | yes/no
5+
| New feature? | yes/no <!-- don't forget to update src/**/CHANGELOG.md files -->
66
| BC breaks? | yes/no
7-
| Deprecations? | yes/no
7+
| Deprecations? | yes/no <!-- don't forget to update UPGRADE-*.md files -->
88
| Tests pass? | yes/no
99
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
1010
| License | MIT
@@ -13,7 +13,8 @@
1313
<!--
1414
- Bug fixes must be submitted against the lowest branch where they apply
1515
(lowest branches are regularly merged to upper ones so they get the fixes too).
16-
- Features and deprecations must be submitted against the master branch.
16+
- Features and deprecations must be submitted against the 3.4,
17+
legacy code removals go to the master branch.
1718
- Please fill in this template according to the PR you're about to submit.
1819
- Replace this comment by a description of what your PR is solving.
1920
-->

.github/build-packages.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
$mergeBase = trim(shell_exec(sprintf('git merge-base %s HEAD', array_shift($dirs))));
1212

1313
$packages = array();
14-
$flags = PHP_VERSION_ID >= 50400 ? JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE : 0;
14+
$flags = \PHP_VERSION_ID >= 50400 ? JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE : 0;
1515

1616
foreach ($dirs as $k => $dir) {
1717
if (!system("git diff --name-only $mergeBase -- $dir", $exitStatus)) {

.php_cs.dist

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,45 @@
11
<?php
22

3+
if (!file_exists(__DIR__.'/src')) {
4+
exit(0);
5+
}
6+
37
return PhpCsFixer\Config::create()
48
->setRules(array(
59
'@Symfony' => true,
610
'@Symfony:risky' => true,
711
'array_syntax' => array('syntax' => 'long'),
8-
'no_unreachable_default_argument_value' => false,
9-
'braces' => array('allow_single_line_closure' => true),
10-
'heredoc_to_nowdoc' => false,
12+
'protected_to_private' => false,
1113
))
1214
->setRiskyAllowed(true)
1315
->setFinder(
1416
PhpCsFixer\Finder::create()
15-
->in(__DIR__)
17+
->in(__DIR__.'/src')
18+
->append(array(__FILE__))
1619
->exclude(array(
1720
// directories containing files with content that is autogenerated by `var_export`, which breaks CS in output code
18-
'src/Symfony/Component/DependencyInjection/Tests/Fixtures',
19-
'src/Symfony/Component/Routing/Tests/Fixtures/dumper',
21+
'Symfony/Component/DependencyInjection/Tests/Fixtures',
22+
'Symfony/Component/Routing/Tests/Fixtures/dumper',
2023
// fixture templates
21-
'src/Symfony/Component/Templating/Tests/Fixtures/templates',
22-
'src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom',
24+
'Symfony/Component/Templating/Tests/Fixtures/templates',
25+
'Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom',
2326
// generated fixtures
24-
'src/Symfony/Component/VarDumper/Tests/Fixtures',
27+
'Symfony/Component/VarDumper/Tests/Fixtures',
2528
// resource templates
26-
'src/Symfony/Bundle/FrameworkBundle/Resources/views/Form',
29+
'Symfony/Bundle/FrameworkBundle/Resources/views/Form',
2730
))
2831
// file content autogenerated by `var_export`
29-
->notPath('src/Symfony/Component/Translation/Tests/fixtures/resources.php')
32+
->notPath('Symfony/Component/Translation/Tests/fixtures/resources.php')
3033
// autogenerated xmls
31-
->notPath('src/Symfony/Component/Console/Tests/Fixtures/application_1.xml')
32-
->notPath('src/Symfony/Component/Console/Tests/Fixtures/application_2.xml')
34+
->notPath('Symfony/Component/Console/Tests/Fixtures/application_1.xml')
35+
->notPath('Symfony/Component/Console/Tests/Fixtures/application_2.xml')
3336
// yml
34-
->notPath('src/Symfony/Component/Yaml/Tests/Fixtures/sfTests.yml')
37+
->notPath('Symfony/Component/Yaml/Tests/Fixtures/sfTests.yml')
3538
// test template
36-
->notPath('src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_entry_label.html.php')
39+
->notPath('Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_entry_label.html.php')
3740
// explicit heredoc test
38-
->notPath('src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php')
41+
->notPath('Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php')
42+
// purposefully invalid JSON
43+
->notPath('Symfony/Component/Asset/Tests/fixtures/manifest-invalid.json')
3944
)
4045
;

.travis.yml

Lines changed: 147 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
language: php
22

3+
dist: trusty
34
sudo: false
45

56
git:
@@ -14,19 +15,13 @@ addons:
1415

1516
env:
1617
global:
17-
- MIN_PHP=5.5.9
18-
- SYMFONY_PROCESS_PHP_TEST_BINARY=~/.phpenv/versions/5.6/bin/php
18+
- MIN_PHP=7.1.3
19+
- SYMFONY_PROCESS_PHP_TEST_BINARY=~/.phpenv/versions/7.1/bin/php
1920

2021
matrix:
2122
include:
22-
# Use the newer stack for HHVM as HHVM does not support Precise anymore since a long time and so Precise has an outdated version
23-
- php: hhvm-3.15
24-
sudo: required
25-
dist: trusty
26-
group: edge
27-
- php: 5.5
28-
- php: 5.6
29-
- php: 7.0
23+
- php: 7.1.3
24+
- php: 7.1
3025
env: deps=high
3126
- php: 7.1
3227
env: deps=low
@@ -43,61 +38,150 @@ services:
4338
- redis-server
4439

4540
before_install:
46-
- stty cols 120
47-
- mkdir /tmp/slapd
48-
- slapd -f src/Symfony/Component/Ldap/Tests/Fixtures/conf/slapd.conf -h ldap://localhost:3389 &
49-
- PHP=$TRAVIS_PHP_VERSION
50-
# Matrix lines for intermediate PHP versions are skipped for pull requests
51-
- if [[ ! $deps && ! $PHP = ${MIN_PHP%.*} && ! $PHP = hhvm* && $TRAVIS_PULL_REQUEST != false ]]; then deps=skip; skip=1; fi
52-
# A sigchild-enabled-PHP is used to test the Process component on the lowest PHP matrix line
53-
- if [[ ! $deps && $PHP = ${MIN_PHP%.*} && ! -d php-$MIN_PHP/sapi ]]; then wget http://museum.php.net/php5/php-$MIN_PHP.tar.bz2 -O - | tar -xj; (cd php-$MIN_PHP; ./configure --enable-sigchild --enable-pcntl; make -j2); fi
54-
- if [[ ! $PHP = hhvm* ]]; then INI_FILE=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; else INI_FILE=/etc/hhvm/php.ini; fi
55-
- if [[ ! $skip ]]; then echo date.timezone = Europe/Paris >> $INI_FILE; fi
56-
- if [[ ! $skip ]]; then echo memory_limit = -1 >> $INI_FILE; fi
57-
- if [[ ! $skip ]]; then echo session.gc_probability = 0 >> $INI_FILE; fi
58-
- if [[ ! $skip ]]; then echo opcache.enable_cli = 1 >> $INI_FILE; fi
59-
- if [[ ! $skip && $PHP = 5.* ]]; then echo extension = mongo.so >> $INI_FILE; fi
60-
- if [[ ! $skip && $PHP = 5.* ]]; then echo extension = memcache.so >> $INI_FILE; fi
61-
- if [[ ! $skip && $PHP = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.11 && echo apc.enable_cli = 1 >> $INI_FILE); fi
62-
- if [[ ! $skip && $PHP = 7.* ]]; then (echo yes | pecl install -f apcu-5.1.6 && echo apc.enable_cli = 1 >> $INI_FILE); fi
63-
- if [[ ! $deps && $PHP = 5.* ]]; then (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> $INI_FILE); fi
64-
- if [[ ! $skip && ! $PHP = hhvm* ]]; then echo extension = memcached.so >> $INI_FILE; fi
65-
- if [[ ! $skip && ! $PHP = hhvm* ]]; then echo extension = ldap.so >> $INI_FILE; fi
66-
- if [[ ! $skip && ! $PHP = hhvm* ]]; then echo extension = redis.so >> $INI_FILE; fi;
67-
- if [[ ! $skip && ! $PHP = hhvm* ]]; then phpenv config-rm xdebug.ini || echo "xdebug not available"; fi
68-
- if [[ ! $skip ]]; then [ -d ~/.composer ] || mkdir ~/.composer; cp .composer/* ~/.composer/; fi
69-
- if [[ ! $skip ]]; then export PHPUNIT=$(readlink -f ./phpunit); fi
70-
- if [[ ! $skip ]]; then ldapadd -h localhost:3389 -D cn=admin,dc=symfony,dc=com -w symfony -f src/Symfony/Component/Ldap/Tests/Fixtures/data/base.ldif; fi
71-
- if [[ ! $skip ]]; then ldapadd -h localhost:3389 -D cn=admin,dc=symfony,dc=com -w symfony -f src/Symfony/Component/Ldap/Tests/Fixtures/data/fixtures.ldif; fi
41+
- |
42+
# General configuration
43+
stty cols 120
44+
mkdir /tmp/slapd
45+
slapd -f src/Symfony/Component/Ldap/Tests/Fixtures/conf/slapd.conf -h ldap://localhost:3389 &
46+
PHP=$TRAVIS_PHP_VERSION
47+
[ -d ~/.composer ] || mkdir ~/.composer
48+
cp .composer/* ~/.composer/
49+
export PHPUNIT=$(readlink -f ./phpunit)
50+
export PHPUNIT_X="$PHPUNIT --exclude-group tty,benchmark,intl-data"
51+
export COMPOSER_UP='composer update --no-progress --no-suggest --ansi'
52+
53+
nanoseconds() {
54+
local cmd="date"
55+
local format="+%s%N"
56+
local os=$(uname)
57+
if hash gdate > /dev/null 2>&1; then
58+
cmd="gdate"
59+
elif [[ "$os" = Darwin ]]; then
60+
format="+%s000000000"
61+
fi
62+
$cmd -u $format
63+
}
64+
export -f nanoseconds
65+
66+
# tfold is a helper to create folded reports
67+
tfold () {
68+
local title=$1
69+
local fold=$(echo $title | sed -r 's/[^-_A-Za-z0-9]+/./g')
70+
shift
71+
local id=$(printf %08x $(( RANDOM * RANDOM )))
72+
local start=$(nanoseconds)
73+
echo -e "travis_fold:start:$fold"
74+
echo -e "travis_time:start:$id"
75+
echo -e "\\e[1;34m$title\\e[0m"
76+
77+
bash -xc "$*" 2>&1
78+
local ok=$?
79+
local end=$(nanoseconds)
80+
echo -e "\\ntravis_time:end:$id:start=$start,finish=$end,duration=$(($end-$start))"
81+
(exit $ok) &&
82+
echo -e "\\e[32mOK\\e[0m $title\\n\\ntravis_fold:end:$fold" ||
83+
echo -e "\\e[41mKO\\e[0m $title\\n"
84+
(exit $ok)
85+
}
86+
export -f tfold
87+
88+
# php.ini configuration
89+
INI=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
90+
phpenv config-rm xdebug.ini || echo "xdebug not available"
91+
echo date.timezone = Europe/Paris >> $INI
92+
echo memory_limit = -1 >> $INI
93+
echo session.gc_probability = 0 >> $INI
94+
echo opcache.enable_cli = 1 >> $INI
95+
echo apc.enable_cli = 1 >> $INI
96+
echo extension = redis.so >> $INI
97+
echo extension = memcached.so >> $INI
98+
echo extension = mongodb.so >> $INI
99+
100+
# Matrix lines for intermediate PHP versions are skipped for pull requests
101+
if [[ ! $deps && ! $PHP = $MIN_PHP && $TRAVIS_PULL_REQUEST != false ]]; then
102+
deps=skip
103+
skip=1
104+
else
105+
COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n')
106+
fi
107+
108+
- |
109+
# Install sigchild-enabled PHP to test the Process component on the lowest PHP matrix line
110+
if [[ ! $deps && $PHP = $MIN_PHP && ! -d php-$MIN_PHP/sapi ]]; then
111+
wget http://php.net/get/php-$MIN_PHP.tar.bz2/from/this/mirror -O - | tar -xj &&
112+
(cd php-$MIN_PHP && ./configure --enable-sigchild --enable-pcntl && make -j2)
113+
fi
114+
115+
- |
116+
# Install extra PHP extensions
117+
if [[ ! $skip && $PHP = 7.* ]]; then
118+
tfold ext.apcu5 'echo yes | pecl install -f apcu-5.1.6'
119+
fi
120+
121+
- |
122+
# Load fixtures
123+
if [[ ! $skip ]]; then
124+
ldapadd -h localhost:3389 -D cn=admin,dc=symfony,dc=com -w symfony -f src/Symfony/Component/Ldap/Tests/Fixtures/data/base.ldif &&
125+
ldapadd -h localhost:3389 -D cn=admin,dc=symfony,dc=com -w symfony -f src/Symfony/Component/Ldap/Tests/Fixtures/data/fixtures.ldif
126+
fi
72127
73128
install:
74-
- if [[ ! $skip && $deps ]]; then cp composer.json composer.json.orig; fi
75-
- if [[ ! $skip && $deps ]]; then echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json; fi
76-
- if [[ ! $skip ]]; then COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); fi
77-
# Create local composer packages for each patched components and reference them in composer.json files when cross-testing components
78-
- if [[ ! $skip && $deps ]]; then php .github/build-packages.php HEAD^ $COMPONENTS; fi
79-
- if [[ ! $skip && $deps ]]; then mv composer.json composer.json.phpunit; mv composer.json.orig composer.json; fi
80-
- if [[ ! $skip && ! $deps ]]; then php .github/build-packages.php HEAD^ src/Symfony/Bridge/PhpUnit; fi
81-
# For the master branch when deps=high, the version before master is checked out and tested with the locally patched components
82-
- if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then SYMFONY_VERSION=$(git ls-remote --heads | grep -o '/[1-9].*' | tail -n 1 | sed s/.//); else SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*'); fi
83-
- if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then git fetch origin $SYMFONY_VERSION; git checkout -m FETCH_HEAD; COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); fi
84-
# Legacy tests are skipped when deps=high and when the current branch version has not the same major version number than the next one
85-
- if [[ $deps = high && ${SYMFONY_VERSION%.*} != $(git show $(git ls-remote --heads | grep -FA1 /$SYMFONY_VERSION | tail -n 1):composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9]*' | head -n 1) ]]; then LEGACY=,legacy; fi
86-
- export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev
87-
- if [[ ! $skip && $deps ]]; then export SYMFONY_DEPRECATIONS_HELPER=weak; fi
88-
- if [[ ! $skip && $deps ]]; then mv composer.json.phpunit composer.json; fi
89-
- if [[ ! $skip ]]; then composer update; fi
129+
- |
130+
# Create local composer packages for each patched components and reference them in composer.json files when cross-testing components
131+
if [[ ! $deps ]]; then
132+
php .github/build-packages.php HEAD^ src/Symfony/Bridge/PhpUnit
133+
elif [[ ! $skip ]]; then
134+
export SYMFONY_DEPRECATIONS_HELPER=weak &&
135+
cp composer.json composer.json.orig &&
136+
echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json &&
137+
php .github/build-packages.php HEAD^ $COMPONENTS &&
138+
mv composer.json composer.json.phpunit &&
139+
mv composer.json.orig composer.json
140+
fi
141+
142+
- |
143+
# For the master branch, when deps=high, the version before master is checked out and tested with the locally patched components
144+
if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then
145+
SYMFONY_VERSION=$(git ls-remote --heads | grep -o '/[1-9].*' | tail -n 1 | sed s/.//) &&
146+
git fetch origin $SYMFONY_VERSION &&
147+
git checkout -m FETCH_HEAD &&
148+
COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n')
149+
elif [[ ! $skip ]]; then
150+
SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*')
151+
fi
152+
153+
- |
154+
# Legacy tests are skipped when deps=high and when the current branch version has not the same major version number than the next one
155+
[[ $deps = high && ${SYMFONY_VERSION%.*} != $(git show $(git ls-remote --heads | grep -FA1 /$SYMFONY_VERSION | tail -n 1):composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9]*' | head -n 1) ]] && LEGACY=,legacy
156+
157+
export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev
158+
if [[ ! $skip && $deps ]]; then mv composer.json.phpunit composer.json; fi
159+
160+
if [[ ! $skip ]]; then
161+
([[ $deps ]] && cd src/Symfony/Component/HttpFoundation; composer require --dev --no-update mongodb/mongodb)
162+
fi
163+
164+
- if [[ ! $skip ]]; then $COMPOSER_UP; fi
90165
- if [[ ! $skip ]]; then ./phpunit install; fi
91-
- if [[ ! $skip && ! $PHP = hhvm* ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi
166+
- php -i
167+
168+
- |
169+
run_tests () {
170+
set -e
171+
if [[ $skip ]]; then
172+
echo -e "\\n\\e[1;34mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m"
173+
elif [[ $deps = high ]]; then
174+
echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP && $PHPUNIT_X$LEGACY'"
175+
elif [[ $deps = low ]]; then
176+
echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT_X'"
177+
else
178+
echo "$COMPONENTS" | parallel --gnu "tfold {} $PHPUNIT_X {}"
179+
tfold tty-group $PHPUNIT --group tty
180+
if [[ $PHP = $MIN_PHP ]]; then
181+
tfold src/Symfony/Component/Process.sigchild SYMFONY_DEPRECATIONS_HELPER=weak php-$MIN_PHP/sapi/cli/php ./phpunit --colors=always src/Symfony/Component/Process/
182+
fi
183+
fi
184+
}
92185
93186
script:
94-
- REPORT=' && echo -e "\\e[32mOK\\e[0m {}\\n\\n" || (echo -e "\\e[41mKO\\e[0m {}\\n\\n" && $(exit 1))'
95-
- if [[ $skip ]]; then echo -e "\\n\\e[1;34mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m"; fi
96-
- if [[ ! $deps && ! $PHP = hhvm* ]]; then echo "$COMPONENTS" | parallel --gnu '$PHPUNIT --exclude-group tty,benchmark,intl-data {}'"$REPORT"; fi
97-
- if [[ ! $deps && ! $PHP = hhvm* ]]; then echo -e "\\nRunning tests requiring tty"; $PHPUNIT --group tty; fi
98-
- if [[ ! $deps && $PHP = hhvm* ]]; then $PHPUNIT --exclude-group benchmark,intl-data; fi
99-
- if [[ ! $deps && $PHP = ${MIN_PHP%.*} ]]; then echo -e "1\\n0" | xargs -I{} sh -c 'echo "\\nPHP --enable-sigchild enhanced={}" && ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/'; fi
100-
- if [[ $deps = high ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update --no-progress --ansi; $PHPUNIT --exclude-group tty,benchmark,intl-data'$LEGACY"$REPORT"; fi
101-
- if [[ $deps = low ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update --no-progress --ansi --prefer-lowest --prefer-stable; $PHPUNIT --exclude-group tty,benchmark,intl-data'"$REPORT"; fi
102-
# Test the PhpUnit bridge using the original phpunit script
103-
- if [[ $deps = low ]]; then (cd src/Symfony/Bridge/PhpUnit && phpenv global 5.3 && php --version && composer update && phpunit); fi
187+
- (run_tests)

0 commit comments

Comments
 (0)