Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 845396d

Browse filesBrowse files
Merge branch '8.0' into 8.1
* 8.0: [WebProfilerBundle] Fix failing test on PHP 8.6 PHP CS Fixer: backports changes toward 6.4 branch Disable php_unit_attributes CS rule on 6.4 [DependencyInjection] Fix autowiring nullable intersection types Fix tests Fix phpunit script fix(scheduler): support command aliases
2 parents 5b8e0c9 + 1fbf2b4 commit 845396d
Copy full SHA for 845396d

9 files changed

+41-8Lines changed: 41 additions & 8 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/WebProfilerBundle/Tests/Controller/ProfilerControllerTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ public function testPhpinfoAction()
371371

372372
$client->request('GET', '/_profiler/phpinfo');
373373

374-
$this->assertStringContainsString('PHP License', $client->getResponse()->getContent());
374+
$this->assertStringContainsString('PHP Credits', $client->getResponse()->getContent());
375375
}
376376

377377
public function testFontActionWithProfilerDisabled()
Collapse file

‎src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php‎

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ private function getCombinedAlias(string $type, ?string $name = null, ?string $t
722722
}
723723

724724
if (str_contains($type, '&')) {
725-
$types = explode('&', $type);
725+
$types = explode('&', trim($type, '()'));
726726
} elseif (str_contains($type, '|')) {
727727
$types = explode('|', $type);
728728
} else {
Collapse file

‎src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php‎

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php
+18-1Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ public function testParameterWithNullUnionIsSkipped()
453453
$this->assertNull($definition->getArgument(0));
454454
}
455455

456-
public function testParameterWithNullableIntersectionIsSkipped()
456+
public function testParameterWithNullableIntersectionIsSkippedWhenAliasDoesNotExist()
457457
{
458458
$container = new ContainerBuilder();
459459

@@ -466,6 +466,23 @@ public function testParameterWithNullableIntersectionIsSkipped()
466466
$this->assertNull($definition->getArgument(0));
467467
}
468468

469+
public function testParameterWithNullableIntersectionIsAutowiredWhenAliasExists()
470+
{
471+
$container = new ContainerBuilder();
472+
473+
$container->register('b', \stdClass::class);
474+
$container->setAlias(CollisionInterface::class, 'b');
475+
$container->setAlias(AnotherInterface::class, 'b');
476+
477+
$optDefinition = $container->register('opt', NullableIntersection::class);
478+
$optDefinition->setAutowired(true);
479+
480+
(new AutowirePass())->process($container);
481+
482+
$definition = $container->getDefinition('opt');
483+
$this->assertSame('b', (string) $definition->getArgument(0));
484+
}
485+
469486
public function testParameterWithNullUnionIsAutowired()
470487
{
471488
$container = new ContainerBuilder();
Collapse file

‎src/Symfony/Component/Emoji/Resources/bin/build.php‎

Copy file name to clipboardExpand all lines: src/Symfony/Component/Emoji/Resources/bin/build.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,3 +260,5 @@ public static function createRules(array $maps, bool $reverse = false): array
260260
return [$emojiText, $textEmoji];
261261
}
262262
}
263+
264+
// @php-cs-fixer-ignore psr_autoloading
Collapse file

‎src/Symfony/Component/Mailer/Transport/RoundRobinTransport.php‎

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mailer/Transport/RoundRobinTransport.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,5 @@ private function moveCursor(int $cursor): int
125125
return ++$cursor >= \count($this->transports) ? 0 : $cursor;
126126
}
127127
}
128+
129+
// @php-cs-fixer-ignore random_api_migration
Collapse file

‎src/Symfony/Component/Messenger/Tests/Handler/HandlerDescriptorTest.php‎

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Tests/Handler/HandlerDescriptorTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public static function provideHandlers(): iterable
3737
];
3838
yield [\Closure::fromCallable(static function () {}), 'Closure'];
3939
yield [\Closure::fromCallable(new DummyCommandHandler()), DummyCommandHandler::class.'::__invoke'];
40-
yield [\Closure::bind(\Closure::fromCallable(function () { $this; }), new \stdClass()), 'Closure'];
40+
yield [\Closure::bind(\Closure::fromCallable(function () { \assert(null !== $this); }), new \stdClass()), 'Closure'];
4141
yield [new class {
4242
public function __invoke()
4343
{
Collapse file

‎src/Symfony/Component/Notifier/Transport/RoundRobinTransport.php‎

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Transport/RoundRobinTransport.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,5 @@ private function moveCursor(int $cursor): int
140140
return ++$cursor >= \count($this->transports) ? 0 : $cursor;
141141
}
142142
}
143+
144+
// @php-cs-fixer-ignore random_api_migration
Collapse file

‎src/Symfony/Component/Scheduler/DependencyInjection/AddScheduleMessengerPass.php‎

Copy file name to clipboardExpand all lines: src/Symfony/Component/Scheduler/DependencyInjection/AddScheduleMessengerPass.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function process(ContainerBuilder $container): void
6464
if ($serviceDefinition->hasTag('console.command')) {
6565
/** @var AsCommand|null $attribute */
6666
$attribute = ($container->getReflectionClass($serviceDefinition->getClass())->getAttributes(AsCommand::class)[0] ?? null)?->newInstance();
67-
$commandName = $attribute?->name;
67+
$commandName = explode('|', $attribute?->name ?? '')[0];
6868

6969
if (\is_array($arguments = $tagAttributes['arguments'] ?? '')) {
7070
$input = (string) new ArrayInput(['command' => $commandName, ...$arguments]);
Collapse file

‎src/Symfony/Component/Scheduler/Tests/DependencyInjection/AddScheduleMessengerPassTest.php‎

Copy file name to clipboardExpand all lines: src/Symfony/Component/Scheduler/Tests/DependencyInjection/AddScheduleMessengerPassTest.php
+13-3Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
class AddScheduleMessengerPassTest extends TestCase
2222
{
2323
#[DataProvider('processSchedulerTaskCommandProvider')]
24-
public function testProcessSchedulerTaskCommand(array $arguments, string $expectedCommand)
24+
public function testProcessSchedulerTaskCommand(array $arguments, string $expectedCommand, string $commandClass = SchedulableCommand::class)
2525
{
2626
$container = new ContainerBuilder();
2727

28-
$definition = new Definition(SchedulableCommand::class);
28+
$definition = new Definition($commandClass);
2929
$definition->addTag('console.command');
3030
$definition->addTag('scheduler.task', $arguments);
31-
$container->setDefinition(SchedulableCommand::class, $definition);
31+
$container->setDefinition($commandClass, $definition);
3232

3333
(new AddScheduleMessengerPass())->process($container);
3434

@@ -56,6 +56,8 @@ public static function processSchedulerTaskCommandProvider(): iterable
5656
yield 'empty array arguments' => [['trigger' => 'every', 'frequency' => '1 hour', 'arguments' => []], 'schedulable'];
5757
yield 'array options' => [['trigger' => 'every', 'frequency' => '1 hour', 'arguments' => ['--option1' => 'first', '--option2' => true, '--option3' => false]], 'schedulable --option1=first --option2=1 --option3'];
5858
yield 'array arguments and options' => [['trigger' => 'every', 'frequency' => '1 hour', 'arguments' => ['arg1' => 'first_one', 'arg2' => 'second_one', '--option1' => 'first', '--option2' => true, '--option3' => false]], 'schedulable first_one second_one --option1=first --option2=1 --option3'];
59+
yield 'alias, no arguments' => [['trigger' => 'every', 'frequency' => '1 hour'], 'schedulable-with-alias', SchedulableCommandWithAlias::class];
60+
yield 'alias, with argument' => [['trigger' => 'every', 'frequency' => '1 hour', 'arguments' => 'test'], 'schedulable-with-alias test', SchedulableCommandWithAlias::class];
5961
}
6062
}
6163

@@ -66,3 +68,11 @@ public function __invoke(): void
6668
{
6769
}
6870
}
71+
72+
#[AsCommand(name: 'schedulable-with-alias', aliases: ['schedulable-alias'])]
73+
class SchedulableCommandWithAlias
74+
{
75+
public function __invoke(): void
76+
{
77+
}
78+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.