10000 Merge branch '6.1' into 6.2 · symfony/symfony@e9cc81a · GitHub
[go: up one dir, main page]

Skip to content

Commit e9cc81a

Browse files
committed
Merge branch '6.1' into 6.2
* 6.1: [Translation][Lokalize] Configure `replace_breaks` to prevent issues with multilines translations Improve message when shell is not detected ensure docblock compatibility with PhpStan's docblock parser Fix signal handlers called after event listeners and skip exit
2 parents e08063a + 4d3a4bf commit e9cc81a

File tree

6 files changed

+33
-7
lines changed

6 files changed

+33
-7
lines changed

src/Symfony/Component/Console/Application.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -992,10 +992,6 @@ protected function doRunCommand(Command $command, InputInterface $input, OutputI
992992
});
993993
}
994994
}
995-
996-
foreach ($commandSignals as $signal) {
997-
$this->signalRegistry->register($signal, [$command, 'handleSignal']);
998-
}
999995
}
1000996

1001997
if (null !== $this->dispatcher) {
@@ -1014,6 +1010,10 @@ protected function doRunCommand(Command $command, InputInterface $input, OutputI
10141010
});
10151011
}
10161012
}
1013+
1014+
foreach ($commandSignals as $signal) {
1015+
$this->signalRegistry->register($signal, [$command, 'handleSignal']);
1016+
}
10171017
}
10181018

10191019
if (null === $this->dispatcher) {

src/Symfony/Component/Console/Command/DumpCompletionCommand.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int
102102
if (!file_exists($completionFile)) {
103103
$supportedShells = $this->getSupportedShells();
104104

105-
($output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output)
106-
->writeln(sprintf('<error>Detected shell "%s", which is not supported by Symfony shell completion (supported shells: "%s").</>', $shell, implode('", "', $supportedShells)));
105+
if ($output instanceof ConsoleOutputInterface) {
106+
$output = $output->getErrorOutput();
107+
}
108+
if ($shell) {
109+
$output->writeln(sprintf('<error>Detected shell "%s", which is not supported by Symfony shell completion (supported shells: "%s").</>', $shell, implode('", "', $supportedShells)));
110+
} else {
111+
$output->writeln(sprintf('<error>Shell not detected, Symfony shell completion only supports "%s").</>', implode('", "', $supportedShells)));
112+
}
107113

108114
return self::INVALID;
109115
}

src/Symfony/Component/Console/Tests/ApplicationTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1991,6 +1991,21 @@ public function testSignalableCommandInterfaceWithoutSignals()
19911991
$this->assertSame(0, $application->run(new ArrayInput(['signal'])));
19921992
}
19931993

1994+
public function testSignalableCommandHandlerCalledAfterEventListener()
1995+
{
1996+
$command = new SignableCommand();
1997+
1998+
$subscriber = new SignalEventSubscriber();
1999+
2000+
$dispatcher = new EventDispatcher();
2001+
$dispatcher->addSubscriber($subscriber);
2002+
2003+
$application = $this->createSignalableApplication($command, $dispatcher);
2004+
$application->setSignalsToDispatchEvent(\SIGUSR1);
2005+
$this->assertSame(1, $application->run(new ArrayInput(['signal'])));
2006+
$this->assertSame([SignalEventSubscriber::class, SignableCommand::class], $command->signalHandlers);
2007+
}
2008+
19942009
/**
19952010
* @group tty
19962011
*/
@@ -2090,6 +2105,7 @@ public function isEnabled(): bool
20902105
class BaseSignableCommand extends Command
20912106
{
20922107
public $signaled = false;
2108+
public $signalHandlers = [];
20932109
public $loop = 1000;
20942110
private $emitsSignal;
20952111

@@ -2127,6 +2143,7 @@ public function getSubscribedSignals(): array
21272143
public function handleSignal(int $signal): void
21282144
{
21292145
$this->signaled = true;
2146+
$this->signalHandlers[] = __CLASS__;
21302147
}
21312148
}
21322149

@@ -2138,6 +2155,7 @@ public function onSignal(ConsoleSignalEvent $event): void
21382155
{
21392156
$this->signaled = true;
21402157
$event->getCommand()->signaled = true;
2158+
$event->getCommand()->signalHandlers[] = __CLASS__;
21412159
}
21422160

21432161
public static function getSubscribedEvents(): array

src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class Dummy extends ParentDummy
8484
public $h;
8585

8686
/**
87-
* @var ?string|int
87+
* @var string|int|null
8888
*/
8989
public $i;
9090

src/Symfony/Component/Translation/Bridge/Lokalise/LokaliseProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ private function exportFiles(array $locales, array $domains): array
149149
'filter_langs' => array_values($locales),
150150
'filter_filenames' => array_map($this->getLokaliseFilenameFromDomain(...), $domains),
151151
'export_empty_as' => 'skip',
152+
'replace_breaks' => false,
152153
],
153154
]);
154155

src/Symfony/Component/Translation/Bridge/Lokalise/Tests/LokaliseProviderTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,7 @@ public function testReadForOneLocaleAndOneDomain(string $locale, string $domain,
562562
'filter_langs' => [$locale],
563563
'filter_filenames' => [$domain.'.xliff'],
564564
'export_empty_as' => 'skip',
565+
'replace_breaks' => false,
565566
]);
566567

567568
$this->assertSame('POST', $method);

0 commit comments

Comments
 (0)
0