Skip to content

Commit bb0115c

Browse files
committed
Merge branch '5.4' into 6.2
* 5.4: Fix LICENSE CI check fixes retrieving multiple values for extra fields [String] Remove duplicates in fold maps fail with a meaningful error when a needed package is missing [DependencyInjection] Fix combinatory explosion when autowiring union and intersection types Update license years (last time) [Tests] New iteration of removing `$this` occurrences in future static data providers
2 parents 3f6ea83 + 86d108e commit bb0115c

File tree

6 files changed

+54
-53
lines changed

6 files changed

+54
-53
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2004-2023 Fabien Potencier
1+
Copyright (c) 2004-present Fabien Potencier
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

Tests/Console/Descriptor/AbstractDescriptorTest.php

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ public function testDescribeRouteCollection(RouteCollection $routes, $expectedDe
4545
$this->assertDescription($expectedDescription, $routes);
4646
}
4747

48-
public function getDescribeRouteCollectionTestData()
48+
public static function getDescribeRouteCollectionTestData(): array
4949
{
50-
return $this->getDescriptionTestData(ObjectsProvider::getRouteCollections());
50+
return static::getDescriptionTestData(ObjectsProvider::getRouteCollections());
5151
}
5252

5353
/** @dataProvider getDescribeRouteTestData */
@@ -56,9 +56,9 @@ public function testDescribeRoute(Route $route, $expectedDescription)
5656
$this->assertDescription($expectedDescription, $route);
5757
}
5858

59-
public function getDescribeRouteTestData()
59+
public static function getDescribeRouteTestData(): array
6060
{
61-
return $this->getDescriptionTestData(ObjectsProvider::getRoutes());
61+
return static::getDescriptionTestData(ObjectsProvider::getRoutes());
6262
}
6363

6464
/** @dataProvider getDescribeContainerParametersTestData */
@@ -67,9 +67,9 @@ public function testDescribeContainerParameters(ParameterBag $parameters, $expec
6767
$this->assertDescription($expectedDescription, $parameters);
6868
}
6969

70-
public function getDescribeContainerParametersTestData()
70+
public static function getDescribeContainerParametersTestData(): array
7171
{
72-
return $this->getDescriptionTestData(ObjectsProvider::getContainerParameters());
72+
return static::getDescriptionTestData(ObjectsProvider::getContainerParameters());
7373
}
7474

7575
/** @dataProvider getDescribeContainerBuilderTestData */
@@ -78,9 +78,9 @@ public function testDescribeContainerBuilder(ContainerBuilder $builder, $expecte
7878
$this->assertDescription($expectedDescription, $builder, $options);
7979
}
8080

81-
public function getDescribeContainerBuilderTestData()
81+
public static function getDescribeContainerBuilderTestData(): array
8282
{
83-
return $this->getContainerBuilderDescriptionTestData(ObjectsProvider::getContainerBuilders());
83+
return static::getContainerBuilderDescriptionTestData(ObjectsProvider::getContainerBuilders());
8484
}
8585

8686
/**
@@ -91,9 +91,9 @@ public function testDescribeContainerExistingClassDefinition(Definition $definit
9191
$this->assertDescription($expectedDescription, $definition);
9292
}
9393

94-
public function getDescribeContainerExistingClassDefinitionTestData()
94+
public static function getDescribeContainerExistingClassDefinitionTestData(): array
9595
{
96-
return $this->getDescriptionTestData(ObjectsProvider::getContainerDefinitionsWithExistingClasses());
96+
return static::getDescriptionTestData(ObjectsProvider::getContainerDefinitionsWithExistingClasses());
9797
}
9898

9999
/** @dataProvider getDescribeContainerDefinitionTestData */
@@ -102,9 +102,9 @@ public function testDescribeContainerDefinition(Definition $definition, $expecte
102102
$this->assertDescription($expectedDescription, $definition);
103103
}
104104

105-
public function getDescribeContainerDefinitionTestData()
105+
public static function getDescribeContainerDefinitionTestData(): array
106106
{
107-
return $this->getDescriptionTestData(ObjectsProvider::getContainerDefinitions());
107+
return static::getDescriptionTestData(ObjectsProvider::getContainerDefinitions());
108108
}
109109

110110
/** @dataProvider getDescribeContainerDefinitionWithArgumentsShownTestData */
@@ -113,7 +113,7 @@ public function testDescribeContainerDefinitionWithArgumentsShown(Definition $de
113113
$this->assertDescription($expectedDescription, $definition, ['show_arguments' => true]);
114114
}
115115

116-
public function getDescribeContainerDefinitionWithArgumentsShownTestData()
116+
public static function getDescribeContainerDefinitionWithArgumentsShownTestData(): array
117117
{
118118
$definitions = ObjectsProvider::getContainerDefinitions();
119119
$definitionsWithArgs = [];
@@ -124,7 +124,7 @@ public function getDescribeContainerDefinitionWithArgumentsShownTestData()
124124

125125
$definitionsWithArgs['definition_arguments_with_enum'] = (new Definition('definition_with_enum'))->setArgument(0, FooUnitEnum::FOO);
126126

127-
return $this->getDescriptionTestData($definitionsWithArgs);
127+
return static::getDescriptionTestData($definitionsWithArgs);
128128
}
129129

130130
/** @dataProvider getDescribeContainerAliasTestData */
@@ -133,9 +133,9 @@ public function testDescribeContainerAlias(Alias $alias, $expectedDescription)
133133
$this->assertDescription($expectedDescription, $alias);
134134
}
135135

136-
public function getDescribeContainerAliasTestData()
136+
public static function getDescribeContainerAliasTestData(): array
137137
{
138-
return $this->getDescriptionTestData(ObjectsProvider::getContainerAliases());
138+
return static::getDescriptionTestData(ObjectsProvider::getContainerAliases());
139139
}
140140

141141
/** @dataProvider getDescribeContainerDefinitionWhichIsAnAliasTestData */
@@ -144,7 +144,7 @@ public function testDescribeContainerDefinitionWhichIsAnAlias(Alias $alias, $exp
144144
$this->assertDescription($expectedDescription, $builder, $options);
145145
}
146146

147-
public function getDescribeContainerDefinitionWhichIsAnAliasTestData()
147+
public static function getDescribeContainerDefinitionWhichIsAnAliasTestData(): array
148148
{
149149
$builder = current(ObjectsProvider::getContainerBuilders());
150150
$builder->setDefinition('service_1', $builder->getDefinition('definition_1'));
@@ -157,7 +157,7 @@ public function getDescribeContainerDefinitionWhichIsAnAliasTestData()
157157
}
158158

159159
$i = 0;
160-
$data = $this->getDescriptionTestData($aliasesWithDefinitions);
160+
$data = static::getDescriptionTestData($aliasesWithDefinitions);
161161
foreach ($aliases as $name => $alias) {
162162
$file = array_pop($data[$i]);
163163
$data[$i][] = $builder;
@@ -175,9 +175,9 @@ public function testDescribeContainerParameter($parameter, $expectedDescription,
175175
$this->assertDescription($expectedDescription, $parameter, $options);
176176
}
177177

178-
public function getDescribeContainerParameterTestData()
178+
public static function getDescribeContainerParameterTestData(): array
179179
{
180-
$data = $this->getDescriptionTestData(ObjectsProvider::getContainerParameter());
180+
$data = static::getDescriptionTestData(ObjectsProvider::getContainerParameter());
181181

182182
$file = array_pop($data[0]);
183183
$data[0][] = ['parameter' => 'database_name'];
@@ -195,9 +195,9 @@ public function testDescribeEventDispatcher(EventDispatcher $eventDispatcher, $e
195195
$this->assertDescription($expectedDescription, $eventDispatcher, $options);
196196
}
197197

198-
public function getDescribeEventDispatcherTestData()
198+
public static function getDescribeEventDispatcherTestData(): array
199199
{
200-
return $this->getEventDispatcherDescriptionTestData(ObjectsProvider::getEventDispatchers());
200+
return static::getEventDispatcherDescriptionTestData(ObjectsProvider::getEventDispatchers());
201201
}
202202

203203
/** @dataProvider getDescribeCallableTestData */
@@ -206,23 +206,24 @@ public function testDescribeCallable($callable, $expectedDescription)
206206
$this->assertDescription($expectedDescription, $callable);
207207
}
208208

209-
public function getDescribeCallableTestData(): array
209+
public static function getDescribeCallableTestData(): array
210210
{
211-
return $this->getDescriptionTestData(ObjectsProvider::getCallables());
211+
return static::getDescriptionTestData(ObjectsProvider::getCallables());
212212
}
213213

214214
/**
215215
* @group legacy
216+
*
216217
* @dataProvider getDescribeDeprecatedCallableTestData
217218
*/
218219
public function testDescribeDeprecatedCallable($callable, $expectedDescription)
219220
{
220221
$this->assertDescription($expectedDescription, $callable);
221222
}
222223

223-
public function getDescribeDeprecatedCallableTestData(): array
224+
public static function getDescribeDeprecatedCallableTestData(): array
224225
{
225-
return $this->getDescriptionTestData(ObjectsProvider::getDeprecatedCallables());
226+
return static::getDescriptionTestData(ObjectsProvider::getDeprecatedCallables());
226227
}
227228

228229
/** @dataProvider getClassDescriptionTestData */
@@ -231,7 +232,7 @@ public function testGetClassDescription($object, $expectedDescription)
231232
$this->assertEquals($expectedDescription, $this->getDescriptor()->getClassDescription($object));
232233
}
233234

234-
public function getClassDescriptionTestData()
235+
public static function getClassDescriptionTestData(): array
235236
{
236237
return [
237238
[ClassWithDocCommentOnMultipleLines::class, 'This is the first line of the description. This is the second line.'],
@@ -249,14 +250,14 @@ public function testGetDeprecations(ContainerBuilder $builder, $expectedDescript
249250
$this->assertDescription($expectedDescription, $builder, ['deprecations' => true]);
250251
}
251252

252-
public function getDeprecationsTestData()
253+
public static function getDeprecationsTestData(): array
253254
{
254-
return $this->getDescriptionTestData(ObjectsProvider::getContainerDeprecations());
255+
return static::getDescriptionTestData(ObjectsProvider::getContainerDeprecations());
255256
}
256257

257-
abstract protected function getDescriptor();
258+
abstract protected static function getDescriptor();
258259

259-
abstract protected function getFormat();
260+
abstract protected static function getFormat();
260261

261262
private function assertDescription($expectedDescription, $describedObject, array $options = [])
262263
{
@@ -278,19 +279,19 @@ private function assertDescription($expectedDescription, $describedObject, array
278279
}
279280
}
280281

281-
private function getDescriptionTestData(iterable $objects)
282+
private static function getDescriptionTestData(iterable $objects): array
282283
{
283284
$data = [];
284285
foreach ($objects as $name => $object) {
285-
$file = sprintf('%s.%s', trim($name, '.'), $this->getFormat());
286+
$file = sprintf('%s.%s', trim($name, '.'), static::getFormat());
286287
$description = file_get_contents(__DIR__.'/../../Fixtures/Descriptor/'.$file);
287288
$data[] = [$object, $description, $file];
288289
}
289290

290291
return $data;
291292
}
292293

293-
private function getContainerBuilderDescriptionTestData(array $objects)
294+
private static function getContainerBuilderDescriptionTestData(array $objects): array
294295
{
295296
$variations = [
296297
'services' => ['show_hidden' => true],
@@ -303,7 +304,7 @@ private function getContainerBuilderDescriptionTestData(array $objects)
303304
$data = [];
304305
foreach ($objects as $name => $object) {
305306
foreach ($variations as $suffix => $options) {
306-
$file = sprintf('%s_%s.%s', trim($name, '.'), $suffix, $this->getFormat());
307+
$file = sprintf('%s_%s.%s', trim($name, '.'), $suffix, static::getFormat());
307308
$description = file_get_contents(__DIR__.'/../../Fixtures/Descriptor/'.$file);
308309
$data[] = [$object, $description, $options, $file];
309310
}
@@ -312,7 +313,7 @@ private function getContainerBuilderDescriptionTestData(array $objects)
312313
return $data;
313314
}
314315

315-
private function getEventDispatcherDescriptionTestData(array $objects)
316+
private static function getEventDispatcherDescriptionTestData(array $objects): array
316317
{
317318
$variations = [
318319
'events' => [],
@@ -322,7 +323,7 @@ private function getEventDispatcherDescriptionTestData(array $objects)
322323
$data = [];
323324
foreach ($objects as $name => $object) {
324325
foreach ($variations as $suffix => $options) {
325-
$file = sprintf('%s_%s.%s', trim($name, '.'), $suffix, $this->getFormat());
326+
$file = sprintf('%s_%s.%s', trim($name, '.'), $suffix, static::getFormat());
326327
$description = file_get_contents(__DIR__.'/../../Fixtures/Descriptor/'.$file);
327328
$data[] = [$object, $description, $options, $file];
328329
}
@@ -337,13 +338,13 @@ public function testDescribeContainerBuilderWithPriorityTags(ContainerBuilder $b
337338
$this->assertDescription($expectedDescription, $builder, $options);
338339
}
339340

340-
public function getDescribeContainerBuilderWithPriorityTagsTestData(): array
341+
public static function getDescribeContainerBuilderWithPriorityTagsTestData(): array
341342
{
342343
$variations = ['priority_tag' => ['tag' => 'tag1']];
343344
$data = [];
344345
foreach (ObjectsProvider::getContainerBuildersWithPriorityTags() as $name => $object) {
345346
foreach ($variations as $suffix => $options) {
346-
$file = sprintf('%s_%s.%s', trim($name, '.'), $suffix, $this->getFormat());
347+
$file = sprintf('%s_%s.%s', trim($name, '.'), $suffix, static::getFormat());
347348
$description = file_get_contents(__DIR__.'/../../Fixtures/Descriptor/'.$file);
348349
$data[] = [$object, $description, $options];
349350
}

Tests/Console/Descriptor/JsonDescriptorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515

1616
class JsonDescriptorTest extends AbstractDescriptorTest
1717
{
18-
protected function getDescriptor()
18+
protected static function getDescriptor()
1919
{
2020
return new JsonDescriptor();
2121
}
2222

23-
protected function getFormat()
23+
protected static function getFormat()
2424
{
2525
return 'json';
2626
}

Tests/Console/Descriptor/MarkdownDescriptorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515

1616
class MarkdownDescriptorTest extends AbstractDescriptorTest
1717
{
18-
protected function getDescriptor()
18+
protected static function getDescriptor()
1919
{
2020
return new MarkdownDescriptor();
2121
}
2222

23-
protected function getFormat()
23+
protected static function getFormat()
2424
{
2525
return 'md';
2626
}

Tests/Console/Descriptor/TextDescriptorTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@
1717

1818
class TextDescriptorTest extends AbstractDescriptorTest
1919
{
20-
private $fileLinkFormatter = null;
20+
private static $fileLinkFormatter = null;
2121

22-
protected function getDescriptor()
22+
protected static function getDescriptor()
2323
{
24-
return new TextDescriptor($this->fileLinkFormatter);
24+
return new TextDescriptor(static::$fileLinkFormatter);
2525
}
2626

27-
protected function getFormat()
27+
protected static function getFormat()
2828
{
2929
return 'txt';
3030
}
3131

32-
public function getDescribeRouteWithControllerLinkTestData()
32+
public static function getDescribeRouteWithControllerLinkTestData()
3333
{
34-
$getDescribeData = $this->getDescribeRouteTestData();
34+
$getDescribeData = static::getDescribeRouteTestData();
3535

3636
foreach ($getDescribeData as $key => &$data) {
3737
$routeStub = $data[0];
@@ -48,7 +48,7 @@ public function getDescribeRouteWithControllerLinkTestData()
4848
/** @dataProvider getDescribeRouteWithControllerLinkTestData */
4949
public function testDescribeRouteWithControllerLink(Route $route, $expectedDescription)
5050
{
51-
$this->fileLinkFormatter = new FileLinkFormatter('myeditor://open?file=%f&line=%l');
51+
static::$fileLinkFormatter = new FileLinkFormatter('myeditor://open?file=%f&line=%l');
5252
parent::testDescribeRoute($route, str_replace('[:file:]', __FILE__, $expectedDescription));
5353
}
5454
}

Tests/Console/Descriptor/XmlDescriptorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515

1616
class XmlDescriptorTest extends AbstractDescriptorTest
1717
{
18-
protected function getDescriptor()
18+
protected static function getDescriptor()
1919
{
2020
return new XmlDescriptor();
2121
}
2222

23-
protected function getFormat()
23+
protected static function getFormat()
2424
{
2525
return 'xml';
2626
}

0 commit comments

Comments
 (0)