Skip to content

Commit e59b73b

Browse files
Merge branch '7.3' into 7.4
* 7.3: [DoctrineBridge] Prevent idle connection listener from running on subrequests [Routing] Add test to validate that default value is allowed to not match requirement fix handling required options Fix @var phpdoc [Lock] [MongoDB] Enforce readPreference=primary and writeConcern=majority [FrameworkBundle] fix phpdoc in `MicroKernelTrait` Fixed validator translations for Albanian
2 parents d3bf55d + f5e9a85 commit e59b73b

File tree

46 files changed

+326
-102
lines changed

Some content is hidden

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

46 files changed

+326
-102
lines changed

.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
'@PHPUnit75Migration:risky' => true,
3636
'@Symfony' => true,
3737
'@Symfony:risky' => true,
38+
'phpdoc_var_annotation_correct_order' => true,
3839
'protected_to_private' => false,
3940
'header_comment' => [
4041
'header' => implode('', $fileHeaderParts),

src/Symfony/Bridge/Doctrine/Middleware/IdleConnection/Listener.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\DependencyInjection\ContainerInterface;
1515
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
1616
use Symfony\Component\HttpKernel\Event\RequestEvent;
17+
use Symfony\Component\HttpKernel\HttpKernelInterface;
1718
use Symfony\Component\HttpKernel\KernelEvents;
1819

1920
final class Listener implements EventSubscriberInterface
@@ -29,6 +30,9 @@ public function __construct(
2930

3031
public function onKernelRequest(RequestEvent $event): void
3132
{
33+
if (HttpKernelInterface::MAIN_REQUEST !== $event->getRequestType()) {
34+
return;
35+
}
3236
$timestamp = time();
3337

3438
foreach ($this->connectionExpiries as $name => $expiry) {

src/Symfony/Bridge/Doctrine/Tests/Middleware/IdleConnection/ListenerTest.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Middleware\IdleConnection;
12+
namespace Symfony\Bridge\Doctrine\Tests\Middleware\IdleConnection;
1313

1414
use Doctrine\DBAL\Connection as ConnectionInterface;
1515
use PHPUnit\Framework\TestCase;
1616
use Symfony\Bridge\Doctrine\Middleware\IdleConnection\Listener;
1717
use Symfony\Component\DependencyInjection\ContainerInterface;
1818
use Symfony\Component\HttpKernel\Event\RequestEvent;
19+
use Symfony\Component\HttpKernel\HttpKernelInterface;
1920

2021
class ListenerTest extends TestCase
2122
{
@@ -34,10 +35,24 @@ public function testOnKernelRequest()
3435
->willReturn($connectionOneMock);
3536

3637
$listener = new Listener($connectionExpiries, $containerMock);
38+
$event = $this->createMock(RequestEvent::class);
39+
$event->method('getRequestType')->willReturn(HttpKernelInterface::MAIN_REQUEST);
3740

38-
$listener->onKernelRequest($this->createMock(RequestEvent::class));
41+
$listener->onKernelRequest($event);
3942

4043
$this->assertArrayNotHasKey('connectionone', (array) $connectionExpiries);
4144
$this->assertArrayHasKey('connectiontwo', (array) $connectionExpiries);
4245
}
46+
47+
public function testOnKernelRequestShouldSkipSubrequests()
48+
{
49+
self::expectNotToPerformAssertions();
50+
$arrayObj = $this->createMock(\ArrayObject::class);
51+
$arrayObj->method('getIterator')->willThrowException(new \Exception('Invalid behavior'));
52+
$listener = new Listener($arrayObj, $this->createMock(ContainerInterface::class));
53+
54+
$event = $this->createMock(RequestEvent::class);
55+
$event->method('getRequestType')->willReturn(HttpKernelInterface::SUB_REQUEST);
56+
$listener->onKernelRequest($event);
57+
}
4358
}

src/Symfony/Bridge/Twig/Extension/FormExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ private function createFieldChoicesList(iterable $choices, string|false|null $tr
161161
continue;
162162
}
163163

164-
/* @var ChoiceView $choice */
164+
/** @var ChoiceView $choice */
165165
$translatableLabel = $this->createFieldTranslation($choice->label, $choice->labelTranslationParameters, $translationDomain);
166166
yield $translatableLabel => $choice->value;
167167
}

src/Symfony/Bundle/FrameworkBundle/Kernel/MicroKernelTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
182182
}
183183

184184
$file = (new \ReflectionObject($this))->getFileName();
185-
/* @var ContainerPhpFileLoader $kernelLoader */
185+
/** @var ContainerPhpFileLoader $kernelLoader */
186186
$kernelLoader = $loader->getResolver()->resolve($file);
187187
$kernelLoader->setCurrentDir(\dirname($file));
188188
$instanceof = &\Closure::bind(fn &() => $this->instanceof, $kernelLoader, $kernelLoader)();
@@ -208,7 +208,7 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
208208
public function loadRoutes(LoaderInterface $loader): RouteCollection
209209
{
210210
$file = (new \ReflectionObject($this))->getFileName();
211-
/* @var RoutingPhpFileLoader $kernelLoader */
211+
/** @var RoutingPhpFileLoader $kernelLoader */
212212
$kernelLoader = $loader->getResolver()->resolve($file, 'php');
213213
$kernelLoader->setCurrentDir(\dirname($file));
214214
$collection = new RouteCollection();

src/Symfony/Bundle/FrameworkBundle/Tests/Controller/AbstractControllerTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ public function testFile()
236236
$controller = $this->createController();
237237
$controller->setContainer($container);
238238

239-
/* @var BinaryFileResponse $response */
239+
/** @var BinaryFileResponse $response */
240240
$response = $controller->file(new File(__FILE__));
241241
$this->assertInstanceOf(BinaryFileResponse::class, $response);
242242
$this->assertSame(200, $response->getStatusCode());
@@ -251,7 +251,7 @@ public function testFileAsInline()
251251
{
252252
$controller = $this->createController();
253253

254-
/* @var BinaryFileResponse $response */
254+
/** @var BinaryFileResponse $response */
255255
$response = $controller->file(new File(__FILE__), null, ResponseHeaderBag::DISPOSITION_INLINE);
256256

257257
$this->assertInstanceOf(BinaryFileResponse::class, $response);
@@ -267,7 +267,7 @@ public function testFileWithOwnFileName()
267267
{
268268
$controller = $this->createController();
269269

270-
/* @var BinaryFileResponse $response */
270+
/** @var BinaryFileResponse $response */
271271
$fileName = 'test.php';
272272
$response = $controller->file(new File(__FILE__), $fileName);
273273

@@ -284,7 +284,7 @@ public function testFileWithOwnFileNameAsInline()
284284
{
285285
$controller = $this->createController();
286286

287-
/* @var BinaryFileResponse $response */
287+
/** @var BinaryFileResponse $response */
288288
$fileName = 'test.php';
289289
$response = $controller->file(new File(__FILE__), $fileName, ResponseHeaderBag::DISPOSITION_INLINE);
290290

@@ -301,7 +301,7 @@ public function testFileFromPath()
301301
{
302302
$controller = $this->createController();
303303

304-
/* @var BinaryFileResponse $response */
304+
/** @var BinaryFileResponse $response */
305305
$response = $controller->file(__FILE__);
306306

307307
$this->assertInstanceOf(BinaryFileResponse::class, $response);
@@ -317,7 +317,7 @@ public function testFileFromPathWithCustomizedFileName()
317317
{
318318
$controller = $this->createController();
319319

320-
/* @var BinaryFileResponse $response */
320+
/** @var BinaryFileResponse $response */
321321
$response = $controller->file(__FILE__, 'test.php');
322322

323323
$this->assertInstanceOf(BinaryFileResponse::class, $response);

src/Symfony/Component/AssetMapper/ImportMap/Resolver/JsDelivrEsmResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public function downloadPackages(array $importMapEntries, ?callable $progressCal
196196

197197
$dependencies = [];
198198
$extraFiles = [];
199-
/* @var ImportMapEntry $entry */
199+
/** @var ImportMapEntry $entry */
200200
$contents[$package] = [
201201
'content' => $this->makeImportsBare($response->getContent(), $dependencies, $extraFiles, $entry->type, $entry->getPackagePathString()),
202202
'dependencies' => $dependencies,

src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapManagerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public function testUpdateAll()
248248
->method('resolvePackages')
249249
->with($this->callback(function ($packages) {
250250
$this->assertInstanceOf(PackageRequireOptions::class, $packages[0]);
251-
/* @var PackageRequireOptions[] $packages */
251+
/** @var PackageRequireOptions[] $packages */
252252
$this->assertCount(2, $packages);
253253

254254
$this->assertSame('lodash', $packages[0]->packageModuleSpecifier);

src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public function testInlineStyleOptions(string $tag, ?string $expected = null, ?s
177177
$expected = $tag.$input.'</'.$styleString.'>';
178178
$this->assertSame($expected, $formatter->format($expected));
179179
} else {
180-
/* @var OutputFormatterStyle $result */
180+
/** @var OutputFormatterStyle $result */
181181
$this->assertInstanceOf(OutputFormatterStyle::class, $result);
182182
$this->assertSame($expected, $formatter->format($tag.$input.'</>'));
183183
$this->assertSame($expected, $formatter->format($tag.$input.'</'.$styleString.'>'));

src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,7 @@ public function testAddObjectResource()
12051205

12061206
$this->assertCount(1, $resources);
12071207

1208-
/* @var FileResource $resource */
1208+
/** @var FileResource $resource */
12091209
$resource = end($resources);
12101210

12111211
$this->assertInstanceOf(FileResource::class, $resource);

0 commit comments

Comments
 (0)