Skip to content

Commit 7c1817d

Browse files
Merge branch '6.2' into 6.3
* 6.2: Fix test class name trim(): Argument #1 () must be of type string, bool given Check if trace.curlCommand is defined in profiler [Dumper] Trim leading newlines when checking if value begins with a space [FrameworkBundle] Make service edges unique Fix the list of supported shells for completions in a phar Fix the usage of the zsh completion through the fpath discovery
2 parents 4d0fa1f + b243eb4 commit 7c1817d

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

Command/DumpCompletionCommand.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected function configure(): void
4848
$shell = $this->guessShell();
4949
[$rcFile, $completionFile] = match ($shell) {
5050
'fish' => ['~/.config/fish/config.fish', "/etc/fish/completions/$commandName.fish"],
51-
'zsh' => ['~/.zshrc', '$fpath[1]/'.$commandName],
51+
'zsh' => ['~/.zshrc', '$fpath[1]/_'.$commandName],
5252
default => ['~/.bashrc', "/etc/bash_completion.d/$commandName"],
5353
};
5454

@@ -143,6 +143,18 @@ private function tailDebugLog(string $commandName, OutputInterface $output): voi
143143
*/
144144
private function getSupportedShells(): array
145145
{
146-
return $this->supportedShells ??= array_map(fn ($f) => pathinfo($f, \PATHINFO_EXTENSION), glob(__DIR__.'/../Resources/completion.*'));
146+
if (null !== $this->supportedShells) {
147+
return $this->supportedShells;
148+
}
149+
150+
$shells = [];
151+
152+
foreach (new \DirectoryIterator(__DIR__.'/../Resources/') as $file) {
153+
if (str_starts_with($file->getBasename(), 'completion.') && $file->isFile()) {
154+
$shells[] = $file->getExtension();
155+
}
156+
}
157+
158+
return $this->supportedShells = $shells;
147159
}
148160
}

Resources/completion.zsh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#compdef {{ COMMAND_NAME }}
2+
13
# This file is part of the Symfony package.
24
#
35
# (c) Fabien Potencier <[email protected]>

Terminal.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ public static function hasSttyAvailable(): bool
136136
private static function initDimensions(): void
137137
{
138138
if ('\\' === \DIRECTORY_SEPARATOR) {
139-
if (preg_match('/^(\d+)x(\d+)(?: \((\d+)x(\d+)\))?$/', trim(getenv('ANSICON')), $matches)) {
139+
$ansicon = getenv('ANSICON');
140+
if (false !== $ansicon && preg_match('/^(\d+)x(\d+)(?: \((\d+)x(\d+)\))?$/', trim($ansicon), $matches)) {
140141
// extract [w, H] from "wxh (WxH)"
141142
// or [w, h] from "wxh"
142143
self::$width = (int) $matches[1];

0 commit comments

Comments
 (0)