Skip to content

Commit f09249c

Browse files
Merge branch '6.4' into 7.0
* 6.4: Fix CI Bump ext-redis in CI on PHP >= 8.4 Adjust pretty name of closures on PHP 8.4 implement NodeVisitorInterface instead of extending AbstractNodeVisitor sync .github/expected-missing-return-types.diff skip test assertions that are no longer valid with PHP >= 8.2.18/8.3.5
2 parents 5fd79f6 + 8477f02 commit f09249c

File tree

28 files changed

+52
-38
lines changed

28 files changed

+52
-38
lines changed

.github/workflows/unit-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
coverage: "none"
5151
ini-values: date.timezone=UTC,memory_limit=-1,default_socket_timeout=10,session.gc_probability=0,apc.enable_cli=1,zend.assertions=1
5252
php-version: "${{ matrix.php }}"
53-
extensions: "${{ env.extensions }}"
53+
extensions: "${{ matrix.extensions || env.extensions }}"
5454
tools: flex
5555

5656
- name: Configure environment

src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
use Twig\Node\ModuleNode;
2424
use Twig\Node\Node;
2525
use Twig\Node\SetNode;
26-
use Twig\NodeVisitor\AbstractNodeVisitor;
26+
use Twig\NodeVisitor\NodeVisitorInterface;
2727

2828
/**
2929
* @author Fabien Potencier <fabien@symfony.com>
3030
*/
31-
final class TranslationDefaultDomainNodeVisitor extends AbstractNodeVisitor
31+
final class TranslationDefaultDomainNodeVisitor implements NodeVisitorInterface
3232
{
3333
private Scope $scope;
3434

@@ -37,7 +37,7 @@ public function __construct()
3737
$this->scope = new Scope();
3838
}
3939

40-
protected function doEnterNode(Node $node, Environment $env): Node
40+
public function enterNode(Node $node, Environment $env): Node
4141
{
4242
if ($node instanceof BlockNode || $node instanceof ModuleNode) {
4343
$this->scope = $this->scope->enter();
@@ -83,7 +83,7 @@ protected function doEnterNode(Node $node, Environment $env): Node
8383
return $node;
8484
}
8585

86-
protected function doLeaveNode(Node $node, Environment $env): ?Node
86+
public function leaveNode(Node $node, Environment $env): ?Node
8787
{
8888
if ($node instanceof TransDefaultDomainNode) {
8989
return null;

src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
use Twig\Node\Expression\FilterExpression;
1919
use Twig\Node\Expression\FunctionExpression;
2020
use Twig\Node\Node;
21-
use Twig\NodeVisitor\AbstractNodeVisitor;
21+
use Twig\NodeVisitor\NodeVisitorInterface;
2222

2323
/**
2424
* TranslationNodeVisitor extracts translation messages.
2525
*
2626
* @author Fabien Potencier <fabien@symfony.com>
2727
*/
28-
final class TranslationNodeVisitor extends AbstractNodeVisitor
28+
final class TranslationNodeVisitor implements NodeVisitorInterface
2929
{
3030
public const UNDEFINED_DOMAIN = '_undefined';
3131

@@ -49,7 +49,7 @@ public function getMessages(): array
4949
return $this->messages;
5050
}
5151

52-
protected function doEnterNode(Node $node, Environment $env): Node
52+
public function enterNode(Node $node, Environment $env): Node
5353
{
5454
if (!$this->enabled) {
5555
return $node;
@@ -98,7 +98,7 @@ protected function doEnterNode(Node $node, Environment $env): Node
9898
return $node;
9999
}
100100

101-
protected function doLeaveNode(Node $node, Environment $env): ?Node
101+
public function leaveNode(Node $node, Environment $env): ?Node
102102
{
103103
return $node;
104104
}

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ private function getCallableData(mixed $callable): array
393393
$data['type'] = 'closure';
394394

395395
$r = new \ReflectionFunction($callable);
396-
if (str_contains($r->name, '{closure}')) {
396+
if (str_contains($r->name, '{closure')) {
397397
return $data;
398398
}
399399
$data['name'] = $r->name;

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ protected function describeCallable(mixed $callable, array $options = []): void
403403
$string .= "\n- Type: `closure`";
404404

405405
$r = new \ReflectionFunction($callable);
406-
if (str_contains($r->name, '{closure}')) {
406+
if (str_contains($r->name, '{closure')) {
407407
$this->write($string."\n");
408408

409409
return;

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ private function formatCallable(mixed $callable): string
649649

650650
if ($callable instanceof \Closure) {
651651
$r = new \ReflectionFunction($callable);
652-
if (str_contains($r->name, '{closure}')) {
652+
if (str_contains($r->name, '{closure')) {
653653
return 'Closure()';
654654
}
655655
if ($class = $r->getClosureCalledClass()) {

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ private function getCallableDocument(mixed $callable): \DOMDocument
581581
$callableXML->setAttribute('type', 'closure');
582582

583583
$r = new \ReflectionFunction($callable);
584-
if (str_contains($r->name, '{closure}')) {
584+
if (str_contains($r->name, '{closure')) {
585585
return $dom;
586586
}
587587
$callableXML->setAttribute('name', $r->name);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public function loadRoutes(LoaderInterface $loader): RouteCollection
214214

215215
if (\is_array($controller) && [0, 1] === array_keys($controller) && $this === $controller[0]) {
216216
$route->setDefault('_controller', ['kernel', $controller[1]]);
217-
} elseif ($controller instanceof \Closure && $this === ($r = new \ReflectionFunction($controller))->getClosureThis() && !str_contains($r->name, '{closure}')) {
217+
} elseif ($controller instanceof \Closure && $this === ($r = new \ReflectionFunction($controller))->getClosureThis() && !str_contains($r->name, '{closure')) {
218218
$route->setDefault('_controller', ['kernel', $r->name]);
219219
}
220220
}

src/Symfony/Bundle/SecurityBundle/Command/DebugFirewallCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ private function formatCallable(mixed $callable): string
238238

239239
if ($callable instanceof \Closure) {
240240
$r = new \ReflectionFunction($callable);
241-
if (str_contains($r->name, '{closure}')) {
241+
if (str_contains($r->name, '{closure')) {
242242
return 'Closure()';
243243
}
244244
if ($class = $r->getClosureCalledClass()) {

src/Symfony/Component/Cache/Tests/Traits/RedisTraitTest.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ public function testCreateConnection(string $dsn, string $expectedClass)
3131
self::markTestSkipped('REDIS_CLUSTER_HOSTS env var is not defined.');
3232
}
3333

34-
$mock = self::getObjectForTrait(RedisTrait::class);
34+
$mock = new class () {
35+
use RedisTrait;
36+
};
3537
$connection = $mock::createConnection($dsn);
3638

3739
self::assertInstanceOf($expectedClass, $connection);
@@ -43,7 +45,9 @@ public function testUrlDecodeParameters()
4345
self::markTestSkipped('REDIS_AUTHENTICATED_HOST env var is not defined.');
4446
}
4547

46-
$mock = self::getObjectForTrait(RedisTrait::class);
48+
$mock = new class () {
49+
use RedisTrait;
50+
};
4751
$connection = $mock::createConnection('redis://:p%40ssword@'.getenv('REDIS_AUTHENTICATED_HOST'));
4852

4953
self::assertInstanceOf(\Redis::class, $connection);
@@ -100,7 +104,9 @@ public function testPconnectSelectsCorrectDatabase()
100104
}
101105

102106
try {
103-
$mock = self::getObjectForTrait(RedisTrait::class);
107+
$mock = new class () {
108+
use RedisTrait;
109+
};
104110

105111
$dsn = 'redis://'.getenv('REDIS_HOST');
106112

0 commit comments

Comments
 (0)