8000 Merge branch '5.2' into 5.x · symfony/symfony@17eaad2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 17eaad2

Browse files
Merge branch '5.2' into 5.x
* 5.2: Cleanup CI scripts use the clock mock to make test more resilient fix code style fix code style take query and request parameters into account when matching routes mistake throw type error when incompatible types are passed fix tests to run assertions on returned Crawler instances [FrameworkBundle] Fix UidNormalizer priority propagate groups to nested constraints
2 parents 4e42149 + 85af7a2 commit 17eaad2

File tree

41 files changed

+109
-88
lines changed

Some content is hidden

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

41 files changed

+109
-88
lines changed

.appveyor.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ install:
4949
- git config --global user.email ""
5050
- git config --global user.name "Symfony"
5151
- FOR /F "tokens=* USEBACKQ" %%F IN (`bash -c "grep branch-version composer.json | grep -o '[0-9.x]*'"`) DO (SET SYMFONY_VERSION=%%F)
52-
- php .github/build-packages.php "HEAD^" %SYMFONY_VERSION% src\Symfony\Bridge\PhpUnit src\Symfony\Contracts
52+
- php .github/build-packages.php HEAD^ %SYMFONY_VERSION% src\Symfony\Bridge\PhpUnit
5353
- SET "SYMFONY_REQUIRE=>=%SYMFONY_VERSION%"
54-
- SET COMPOSER_ROOT_VERSION=%SYMFONY_VERSION%.x-dev
5554
- php composer.phar update --no-progress --ansi
5655
- php phpunit install
5756

.github/build-packages.php

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,12 @@
66
}
77
chdir(dirname(__DIR__));
88

9-
$json = ltrim(file_get_contents('composer.json'));
10-
if ($json !== $package = preg_replace('/\n "repositories": \[\n.*?\n \],/s', '', $json)) {
11-
file_put_contents('composer.json', $package);
12-
}
13-
149
$dirs = $_SERVER['argv'];
1510
array_shift($dirs);
1611
$mergeBase = trim(shell_exec(sprintf('git merge-base "%s" HEAD', array_shift($dirs))));
1712
$version = array_shift($dirs);
1813

19-
$packages = array();
14+
$packages = [];
2015
$flags = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
2116
$preferredInstall = json_decode(file_get_contents(__DIR__.'/composer-config.json'), true)['config']['preferred-install'];
2217

@@ -36,12 +31,12 @@
3631
exit(1);
3732
}
3833

39-
$package->repositories = array(array(
34+
$package->repositories = [[
4035
'type' => 'composer',
4136
'url' => 'file://'.str_replace(DIRECTORY_SEPARATOR, '/', dirname(__DIR__)).'/',
42-
));
37+
]];
4338
if (false === strpos($json, "\n \"repositories\": [\n")) {
44-
$json = rtrim(json_encode(array('repositories' => $package->repositories), $flags), "\n}").','.substr($json, 1);
39+
$json = rtrim(json_encode(['repositories' => $package->repositories], $flags), "\n}").','.substr($json, 1);
4540
file_put_contents($dir.'/composer.json', $json);
4641
}
4742

@@ -61,7 +56,7 @@
6156
$versions = json_decode($versions)->packages->{$package->name};
6257

6358
foreach ($versions as $v => $package) {
64-
$packages[$package->name] += array($v => $package);
59+
$packages[$package->name] += [$v => $package];
6560
}
6661
}
6762

@@ -74,10 +69,12 @@
7469
exit(1);
7570
}
7671

77-
$package->repositories = array(array(
72+
$package->repositories[] = [
7873
'type' => 'composer',
7974
'url' => 'file://'.str_replace(DIRECTORY_SEPARATOR, '/', dirname(__DIR__)).'/',
80-
));
81-
$json = rtrim(json_encode(array('repositories' => $package->repositories), $flags), "\n}").','.substr($json, 1);
75+
];
76+
77+
$json = preg_replace('/\n "repositories": \[\n.*?\n \],/s', '', $json);
78+
$json = rtrim(json_encode(['repositories' => $package->repositories], $flags), "\n}").','.substr($json, 1);
8279
file_put_contents('composer.json', $json);
8380
}

.github/rm-invalid-lowest-lock-files.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
function getRelevantContent(array $composerJson)
1313
{
14-
$relevantKeys = array(
14+
$relevantKeys = [
1515
'name',
1616
'require',
1717
'require-dev',
@@ -22,9 +22,9 @@ function getRelevantContent(array $composerJson)
2222
'prefer-stable',
2323
'repositories',
2424
'extra',
25-
);
25+
];
2626

27-
$relevantContent = array();
27+
$relevantContent = [];
2828

2929
foreach (array_intersect($relevantKeys, array_keys($composerJson)) as $key) {
3030
$relevantContent[$key] = $composerJson[$key];
@@ -44,7 +44,7 @@ function getContentHash(array $composerJson)
4444
return md5(json_encode($relevantContent));
4545
}
4646

47-
$composerJsons = array();
47+
$composerJsons = [];
4848

4949
foreach ($dirs as $dir) {
5050
if (!file_exists($dir.'/composer.lock') || !$composerLock = @json_decode(file_get_contents($dir. 426B 9;/composer.lock'), true)) {
@@ -61,11 +61,11 @@ function getContentHash(array $composerJson)
6161
@unlink($dir.'/composer.lock');
6262
continue;
6363
}
64-
$composerLock += array('packages' => array(), 'packages-dev' => array());
65-
$composerJsons[$composerJson['name']] = array($dir, $composerLock['packages'] + $composerLock['packages-dev'], getRelevantContent($composerJson));
64+
$composerLock += ['packages' => [], 'packages-dev' => []];
65+
$composerJsons[$composerJson['name']] = [$dir, $composerLock['packages'] + $composerLock['packages-dev'], getRelevantContent($composerJson)];
6666
}
6767

68-
$referencedCommits = array();
68+
$referencedCommits = [];
6969

7070
foreach ($composerJsons as list($dir, $lockedPackages)) {
7171
foreach ($lockedPackages as $lockedJson) {
@@ -85,7 +85,7 @@ function getContentHash(array $composerJson)
8585
continue;
8686
}
8787

88-
foreach (array('minimum-stability', 'prefer-stable') as $key) {
88+
foreach (['minimum-stability', 'prefer-stable'] as $key) {
8989
if (array_key_exists($key, $composerJsons[$name][2])) {
9090
$lockedJson[$key] = $composerJsons[$name][2][$key];
9191
}
@@ -116,10 +116,10 @@ function getContentHash(array $composerJson)
116116
curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
117117
curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
118118
curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION);
119-
$chs = array();
119+
$chs = [];
120120

121121
foreach ($referencedCommits as $name => $dirsByCommit) {
122-
$chs[] = $ch = array(curl_init(), fopen($_SERVER['HOME'].'/.cache/composer/repo/https---repo.packagist.org/provider-'.strtr($name, '/', '$').'.json', 'wb'));
122+
$chs[] = $ch = [curl_init(), fopen($_SERVER['HOME'].'/.cache/composer/repo/https---repo.packagist.org/provider-'.strtr($name, '/', '$').'.json', 'wb')];
123123
curl_setopt($ch[0], CURLOPT_URL, 'https://repo.packagist.org/p/'.$name.'.json');
124124
curl_setopt($ch[0], CURLOPT_FILE, $ch[1]);
125125
curl_setopt($ch[0], CURLOPT_SHARE, $sh);

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ jobs:
155155
run: |
156156
echo "::group::composer update"
157157
composer require --dev --no-update mongodb/mongodb:@stable
158-
composer update --no-progress --no-suggest --ansi
158+
composer update --no-progress --ansi
159159
echo "::endgroup::"
160160
echo "::group::install phpunit"
161161
./phpunit install

.travis.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ install:
185185
export SYMFONY_VERSION=$(grep branch-version composer.json | grep -o '[0-9.x]*')
186186
187187
if [[ ! $deps ]]; then
188-
php .github/build-packages.php HEAD^ $SYMFONY_VERSION src/Symfony/Bridge/PhpUnit src/Symfony/Contracts
188+
php .github/build-packages.php HEAD^ $SYMFONY_VERSION src/Symfony/Bridge/PhpUnit
189189
else
190190
export SYMFONY_DEPRECATIONS_HELPER=weak &&
191191
cp composer.json composer.json.orig &&
@@ -228,7 +228,6 @@ install:
228228
# Legacy tests are skipped when deps=high and when the current branch version has not the same major version number as the next one
229229
[[ $deps = high && ${SYMFONY_VERSION%.*} != $(git ls-remote -q --heads | cut -f2 | grep -FA1 /$SYMFONY_VERSION | tail -n 1 | grep -o '[0-9]*' | head -n 1) ]] && export LEGACY=,legacy
230230
231-
export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev
232231
if [[ $deps ]]; then mv composer.json.phpunit composer.json; fi
233232
234233
- |
@@ -268,7 +267,6 @@ install:
268267
SYMFONY_VERSION=$(echo $SYMFONY_VERSION | awk '{print $1 - 1}')
269268
echo -e "\\n\\e[33;1mChecking out Symfony $SYMFONY_VERSION and running tests with patched components as deps\\e[0m"
270269
export SYMFONY_REQUIRE=">=$SYMFONY_VERSION"
271-
export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev
272270
git fetch --depth=2 origin $SYMFONY_VERSION
273271
git checkout -m FETCH_HEAD
274272
COMPONENTS=$(echo "$COMPONENTS" | xargs dirname | xargs -n1 -I{} bash -c "[ -e '{}/phpunit.xml.dist' ] && echo '{}'" | sort)
@@ -287,8 +285,6 @@ install:
287285
else
288286
if [[ $PHP = 7.4* ]]; then
289287
# add return types before running the test suite
290-
rm src/Symfony/Contracts -Rf && mv vendor/symfony/contracts src/Symfony/Contracts
291-
ln -sd $(realpath src/Symfony/Contracts) vendor/symfony/contracts
292288
sed -i 's/"\*\*\/Tests\/"//' composer.json
293289
composer install --optimize-autoloader
294290
SYMFONY_PATCH_TYPE_DECLARATIONS=force=object php .github/patch-types.php

UPGRADE-6.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ PhpUnitBridge
145145
PropertyAccess
146146
--------------
147147

148-
* Dropped support of a boolean as the first argument of `PropertyAccessor::__construct()`.
148+
* Dropped support for booleans as the first argument of `PropertyAccessor::__construct()`.
149149
Pass a combination of bitwise flags instead.
150150

151151
PropertyInfo

src/Symfony/Bridge/Monolog/Handler/FingersCrossed/HttpCodeActivationStrategy.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ public function __construct(RequestStack $requestStack, array $exclusions, $inne
4545

4646
foreach ($exclusions as $exclusion) {
4747
if (!\array_key_exists('code', $exclusion)) {
48-
throw new \LogicException(sprintf('An exclusion must have a "code" key.'));
48+
throw new \LogicException('An exclusion must have a "code" key.');
4949
}
5050
if (!\array_key_exists('urls', $exclusion)) {
51-
throw new \LogicException(sprintf('An exclusion must have a "urls" key.'));
51+
throw new \LogicException('An exclusion must have a "urls" key.');
5252
}
5353
}
5454

src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
->tag('serializer.normalizer', ['priority' => 1000])
110110

111111
->set('serializer.normalizer.uid', UidNormalizer::class)
112-
->tag('serializer.normalizer', ['priority' => -915])
112+
->tag('serializer.normalizer', ['priority' => -890])
113113

114114
->set('serializer.normalizer.form_error', FormErrorNormalizer::class)
115115
->tag('serializer.normalizer', ['priority' => -915])

src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ private function getEventDispatcherDescriptionTestData(array $objects)
302302
}
303303

304304
/** @dataProvider getDescribeContainerBuilderWithPriorityTagsTestData */
305-
public function testDescribeContainerBuilderWithPriorityTags(ContainerBuilder $builder, $expectedDescription, array $options): void
305+
public function testDescribeContainerBuilderWithPriorityTags(ContainerBuilder $builder, $expectedDescription, array $options)
306306
{
307307
$this->assertDescription($expectedDescription, $builder, $options);
308308
}

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflows.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
'initial_marking' => ['draft'],
1313
'metadata' => [
1414
'title' => 'article workflow',
15-
'description' => 'workflow for articles'
15+
'description' => 'workflow for articles',
1616
],
1717
'places' => [
1818
'draft',

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/ClassAliasExampleClass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
class_alias(
66
ClassAliasTargetClass::class,
7-
__NAMESPACE__ . '\ClassAliasExampleClass'
7+
__NAMESPACE__.'\ClassAliasExampleClass'
88
);
99

1010
if (false) {

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Validation/Category.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class Category
88
{
9-
const NAME_PATTERN = '/\w+/';
9+
public const NAME_PATTERN = '/\w+/';
1010

1111
public $id;
1212

src/Symfony/Bundle/SecurityBundle/Tests/DataCollector/SecurityDataCollectorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ public function providerCollectDecisionLog(): \Generator
313313
*
314314
* @dataProvider providerCollectDecisionLog
315315
*/
316-
public function testCollectDecisionLog(string $strategy, array $decisionLog, array $voters, array $expectedVoterClasses, array $expectedDecisionLog): void
316+
public function testCollectDecisionLog(string $strategy, array $decisionLog, array $voters, array $expectedVoterClasses, array $expectedDecisionLog)
317317
{
318318
$accessDecisionManager = $this
319319
->getMockBuilder(TraceableAccessDecisionManager::class)

src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ private function getTraces(RequestDataCollector $request, string $method): array
9090
$traceRequest = Request::create(
9191
$request->getPathInfo(),
9292
$request->getRequestServer(true)->get('REQUEST_METHOD'),
93-
[],
93+
\in_array($request->getMethod(), ['DELETE', 'PATCH', 'POST', 'PUT'], true) ? $request->getRequestRequest()->all() : $request->getRequestQuery()->all(),
9494
$request->getRequestCookies(true)->all(),
9595
[],
9696
$request->getRequestServer(true)->all()

src/Symfony/Component/Cache/Tests/Messenger/EarlyExpirationHandlerTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ public static function tearDownAfterClass(): void
3131
(new Filesystem())->remove(sys_get_temp_dir().'/symfony-cache');
3232
}
3333

34+
/**
35+
* @group time-sensitive
36+
*/
3437
public function testHandle()
3538
{
3639
$pool = new FilesystemAdapter();

src/Symfony/Component/Config/Definition/Processor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ public static function normalizeConfig(array $config, string $key, string $plura
8484
if (isset($config[$key])) {
8585
if (\is_string($config[$key]) || !\is_int(key($config[$key]))) {
8686
// only one
87-
return [$config[$key]];
87+
return [$config[$key]];
8888
}
8989

90-
return $config[$key];
90+
return $config[$key];
9191
}
9292

9393
return [];

src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ private function getArgumentsAsPhp(\DOMElement $node, string $name, string $file
478478
break;
479479
case 'expression':
480480
if (!class_exists(Expression::class)) {
481-
throw new \LogicException(sprintf('The type="expression" attribute cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".'));
481+
throw new \LogicException('The type="expression" attribute cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".');
482482
}
483483

484484
$arguments[$key] = new Expression($arg->nodeValue);

src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ private function resolveServices($value, string $file, bool $isParameter = false
868868
}
869869 10000
} elseif (\is_string($value) && 0 === strpos($value, '@=')) {
870870
if (!class_exists(Expression::class)) {
871-
throw new \LogicException(sprintf('The "@=" expression syntax cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".'));
871+
throw new \LogicException('The "@=" expression syntax cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".');
872872
}
873873

874874
return new Expression(substr($value, 2));

src/Symfony/Component/DependencyInjection/Tests/Fixtures/CheckTypeDeclarationsPass/Foo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public static function createBarArguments(\stdClass $stdClass, \stdClass $stdCla
1616

1717
public static function createCallable(): callable
1818
{
19-
return function() {};
19+
return function () {};
2020
}
2121

2222
public static function createArray(): array

src/Symfony/Component/DependencyInjection/Tests/Fixtures/FactoryDummy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
class FactoryDummy extends FactoryParent
1515
{
16-
public static function createFactory(): FactoryDummy
16+
public static function createFactory(): self
1717
{
1818
}
1919

src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/MultipleArgumentsOptionalScalarNotReallyOptional.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ public function __construct(A $a, $foo = 'default_val', Lille $lille)
1111
{
1212
}
1313
}
14-

src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/autowiring_classes.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Psr\Log\LoggerInterface;
66

7-
if (PHP_VERSION_ID >= 80000) {
7+
if (\PHP_VERSION_ID >= 80000) {
88
require __DIR__.'/uniontype_classes.php';
99
require __DIR__.'/autowiring_classes_80.php';
1010
}
@@ -276,6 +276,7 @@ public function setFoo(Foo $foo)
276276

277277
/**
278278
* @required
279+
*
279280
* @return static
280281
*/
281282
public function withFoo1(Foo $foo): self
@@ -285,6 +286,7 @@ public function withFoo1(Foo $foo): self
285286

286287
/**
287288
* @required
289+
*
288290
* @return static
289291
*/
290292
public function withFoo2(Foo $foo): self

0 commit comments

Comments
 (0)
0