Skip to content

Commit e8882a3

Browse files
Merge branch '5.4' into 6.2
* 5.4: [Finder] Fix initial directory is opened twice typo fix Fix test Fix some return types in tests
2 parents 0d71cba + 99fa865 commit e8882a3

File tree

8 files changed

+29
-79
lines changed

8 files changed

+29
-79
lines changed

.github/expected-missing-return-types.diff

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,6 @@ head=$(sed '/^diff /Q' .github/expected-missing-return-types.diff)
66
(echo "$head" && echo && git diff -U2 src/) > .github/expected-missing-return-types.diff
77
git checkout composer.json src/
88

9-
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/ORMQueryBuilderLoaderTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/ORMQueryBuilderLoaderTest.php
10-
index f52a1ce1e9..1fb72535e1 100644
11-
--- a/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/ORMQueryBuilderLoaderTest.php
12-
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/ORMQueryBuilderLoaderTest.php
13-
@@ -285,5 +285,5 @@ class QueryMock extends AbstractQuery
14-
* @return array|string
15-
*/
16-
- public function getSQL()
17-
+ public function getSQL(): array|string
18-
{
19-
}
20-
@@ -292,5 +292,5 @@ class QueryMock extends AbstractQuery
21-
* @return Result|int
22-
*/
23-
- protected function _doExecute()
24-
+ protected function _doExecute(): Result|int
25-
{
26-
}
279
diff --git a/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php b/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php
2810
index bb5560a7b5..be86cbf98e 100644
2911
--- a/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php
@@ -35,17 +17,6 @@ index bb5560a7b5..be86cbf98e 100644
3517
+ protected static function getContainer(): Container
3618
{
3719
if (!static::$booted) {
38-
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/Controller/ProfilerControllerTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/Controller/ProfilerControllerTest.php
39-
index 67355d9030..b2006ecd2f 100644
40-
--- a/src/Symfony/Bundle/WebProfilerBundle/Tests/Controller/ProfilerControllerTest.php
41-
+++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/Controller/ProfilerControllerTest.php
42-
@@ -449,5 +449,5 @@ class ProfilerControllerTest extends WebTestCase
43-
* @return MockObject&DumpDataCollector
44-
*/
45-
- private function createDumpDataCollector(): MockObject
46-
+ private function createDumpDataCollector(): MockObject&DumpDataCollector
47-
{
48-
$dumpDataCollector = $this->createMock(DumpDataCollector::class);
4920
diff --git a/src/Symfony/Component/BrowserKit/AbstractBrowser.php b/src/Symfony/Component/BrowserKit/AbstractBrowser.php
5021
index b27ca37529..5b80175850 100644
5122
--- a/src/Symfony/Component/BrowserKit/AbstractBrowser.php
@@ -352,7 +323,7 @@ index 895c155e07..3955c902d4 100644
352323
{
353324
try {
354325
diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php
355-
index f5d33682ff..e644489097 100644
326+
index b9a784ec21..a7f252787d 100644
356327
--- a/src/Symfony/Component/DependencyInjection/Container.php
357328
+++ b/src/Symfony/Component/DependencyInjection/Container.php
358329
@@ -110,5 +110,5 @@ class Container implements ContainerInterface, ResetInterface

src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/ORMQueryBuilderLoaderTest.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -281,17 +281,11 @@ public function __construct()
281281
{
282282
}
283283

284-
/**
285-
* @return array|string
286-
*/
287-
public function getSQL()
284+
public function getSQL(): array|string
288285
{
289286
}
290287

291-
/**
292-
* @return Result|int
293-
*/
294-
protected function _doExecute()
288+
protected function _doExecute(): Result|int
295289
{
296290
}
297291
}

src/Symfony/Bundle/WebProfilerBundle/Tests/Controller/ProfilerControllerTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,10 +445,7 @@ public function testDumpPanel()
445445
$this->assertDefaultPanel($dumpDataCollector->getName(), $profile);
446446
}
447447

448-
/**
449-
* @return MockObject&DumpDataCollector
450-
*/
451-
private function createDumpDataCollector(): MockObject
448+
private function createDumpDataCollector(): MockObject&DumpDataCollector
452449
{
453450
$dumpDataCollector = $this->createMock(DumpDataCollector::class);
454451
$dumpDataCollector

src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function process(ContainerBuilder $container)
8888

8989
if (null !== ($class = $container->getDefinition($id)->getClass()) && ($r = $container->getReflectionClass($class, false)) && !$r->hasMethod($event['method'])) {
9090
if (!$r->hasMethod('__invoke')) {
91-
throw new InvalidArgumentException(sprintf('None of the "%s" or "__invoke" methods exist for the service "foo". Please define the "method" attribute on "kernel.event_listener" tags.', $event['method'], $id));
91+
throw new InvalidArgumentException(sprintf('None of the "%s" or "__invoke" methods exist for the service "%s". Please define the "method" attribute on "kernel.event_listener" tags.', $event['method'], $id));
9292
}
9393

9494
$event['method'] = '__invoke';

src/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
2525
{
2626
private bool $ignoreUnreadableDirs;
27+
private bool $ignoreFirstRewind = true;
2728
private ?bool $rewindable = null;
2829

2930
// these 3 properties take part of the performance optimization to avoid redoing the same work in all iterations
@@ -102,7 +103,6 @@ public function getChildren(): \RecursiveDirectoryIterator
102103
$children->ignoreUnreadableDirs = $this->ignoreUnreadableDirs;
103104

104105
// performance optimization to avoid redoing the same work in all children
105-
$children->rewindable = &$this->rewindable;
106106
$children->rootPath = $this->rootPath;
107107
}
108108

@@ -112,36 +112,23 @@ public function getChildren(): \RecursiveDirectoryIterator
112112
}
113113
}
114114

115-
/**
116-
* Do nothing for non rewindable stream.
117-
*/
118-
public function rewind(): void
115+
public function next(): void
119116
{
120-
if (false === $this->isRewindable()) {
121-
return;
122-
}
117+
$this->ignoreFirstRewind = false;
123118

124-
parent::rewind();
119+
parent::next();
125120
}
126121

127-
/**
128-
* Checks if the stream is rewindable.
129-
*/
130-
public function isRewindable(): bool
122+
public function rewind(): void
131123
{
132-
if (null !== $this->rewindable) {
133-
return $this->rewindable;
134-
}
135-
136-
if (false !== $stream = @opendir($this->getPath())) {
137-
$infos = stream_get_meta_data($stream);
138-
closedir($stream);
124+
// some streams like FTP are not rewindable, ignore the first rewind after creation,
125+
// as newly created DirectoryIterator does not need to be rewound
126+
if ($this->ignoreFirstRewind) {
127+
$this->ignoreFirstRewind = false;
139128

140-
if ($infos['seekable']) {
141-
return $this->rewindable = true;
142-
}
129+
return;
143130
}
144131

145-
return $this->rewindable = false;
132+
parent::rewind();
146133
}
147134
}

src/Symfony/Component/Finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,19 @@
1515

1616
class RecursiveDirectoryIteratorTest extends IteratorTestCase
1717
{
18+
protected function setUp(): void
19+
{
20+
if (!\in_array('ftp', stream_get_wrappers(), true) || !\ini_get('allow_url_fopen')) {
21+
$this->markTestSkipped('Unsupported stream "ftp".');
22+
}
23+
}
24+
1825
/**
1926
* @group network
2027
*/
2128
public function testRewindOnFtp()
2229
{
23-
try {
24-
$i = new RecursiveDirectoryIterator('ftp://speedtest:[email protected]/', \RecursiveDirectoryIterator::SKIP_DOTS);
25-
} catch (\UnexpectedValueException $e) {
26-
$this->markTestSkipped('Unsupported stream "ftp".');
27-
}
30+
$i = new RecursiveDirectoryIterator('ftp://speedtest:[email protected]/', \RecursiveDirectoryIterator::SKIP_DOTS);
2831

2932
$i->rewind();
3033

@@ -36,11 +39,7 @@ public function testRewindOnFtp()
3639
*/
3740
public function testSeekOnFtp()
3841
{
39-
try {
40-
$i = new RecursiveDirectoryIterator('ftp://speedtest:[email protected]/', \RecursiveDirectoryIterator::SKIP_DOTS);
41-
} catch (\UnexpectedValueException $e) {
42-
$this->markTestSkipped('Unsupported stream "ftp".');
43-
}
42+
$i = new RecursiveDirectoryIterator('ftp://speedtest:[email protected]/', \RecursiveDirectoryIterator::SKIP_DOTS);
4443

4544
$contains = [
4645
'ftp://speedtest:[email protected]'.\DIRECTORY_SEPARATOR.'test100Mb.db',

src/Symfony/Component/HttpKernel/Tests/EventListener/DumpListenerTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ public function cloneVar($var): Data
7474

7575
class MockDumper implements DataDumperInterface
7676
{
77-
public function dump(Data $data)
77+
public function dump(Data $data): ?string
7878
{
7979
echo '+'.$data->getValue();
80+
81+
return null;
8082
}
8183
}

src/Symfony/Component/Security/Http/Tests/EventListener/PasswordMigratingListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public function eraseCredentials()
174174
{
175175
}
176176

177-
public function getUsername()
177+
public function getUsername(): string
178178
{
179179
}
180180

0 commit comments

Comments
 (0)