8000 Merge branch '6.0' into 6.1 · symfony/symfony@4d3a4bf · GitHub
[go: up one dir, main page]

Skip to content

Commit 4d3a4bf

Browse files
committed
Merge branch '6.0' into 6.1
* 6.0: [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 636ad0d + 6646c06 commit 4d3a4bf

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
@@ -986,10 +986,6 @@ protected function doRunCommand(Command $command, InputInterface $input, OutputI
986986
});
987987
}
988988
}
989-
990-
foreach ($commandSignals as $signal) {
991-
$this->signalRegistry->register($signal, [$command, 'handleSignal']);
992-
}
993989
}
994990

995991
if (null !== $this->dispatcher) {
@@ -1008,6 +1004,10 @@ protected function doRunCommand(Command $command, InputInterface $input, OutputI
10081004
});
10091005
}
10101006
}
1007+
1008+
foreach ($commandSignals as $signal) {
1009+
$this->signalRegistry->register($signal, [$command, 'handleSignal']);
1010+
}
10111011
}
10121012

10131013
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
@@ -101,8 +101,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int
101101
if (!file_exists($completionFile)) {
102102
$supportedShells = $this->getSupportedShells();
103103

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

107113
return self::INVALID;
108114
}

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

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

1978+
public function testSignalableCommandHandlerCalledAfterEventListener()
1979+
{
1980+
$command = new SignableCommand();
1981+
1982+
$subscriber = new SignalEventSubscriber();
1983+
1984+
$dispatcher = new EventDispatcher();
1985+
$dispatcher->addSubscriber($subscriber);
1986+
1987+
$application = $this->createSignalableApplication($command, $dispatcher);
1988+
$application->setSignalsToDispatchEvent(\SIGUSR1);
1989+
$this->assertSame(1, $application->run(new ArrayInput(['signal'])));
1990+
$this->assertSame([SignalEventSubscriber::class, SignableCommand::class], $command->signalHandlers);
1991+
}
1992+
19781993
/**
19791994
* @group tty
19801995
*/
@@ -2074,6 +2089,7 @@ public function isEnabled(): bool
20742089
class BaseSignableCommand extends Command
20752090
{
20762091
public $signaled = false;
2092+
public $signalHandlers = [];
20772093
public $loop = 1000;
20782094
private $emitsSignal;
20792095

@@ -2111,6 +2127,7 @@ public function getSubscribedSignals(): array
21112127
public function handleSignal(int $signal): void
21122128
{
21132129
$this->signaled = true;
2130+
$this->signalHandlers[] = __CLASS__;
21142131
}
21152132
}
21162133

@@ -2122,6 +2139,7 @@ public function onSignal(ConsoleSignalEvent $event): void
21222139
{
21232140
$this->signaled = true;
21242141
$event->getCommand()->signaled = true;
2142+
$event->getCommand()->signalHandlers[] = __CLASS__;
21252143
}
21262144

21272145
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
@@ -151,6 +151,7 @@ private function exportFiles(array $locales, array $domains): array
151151
'filter_langs' => array_values($locales),
152152
'filter_filenames' => array_map($this->getLokaliseFilenameFromDomain(...), $domains),
153153
'export_empty_as' => 'skip',
154+
'replace_breaks' => false,
154155
],
155156
]);
156157

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)
2A47
0