Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix the list of supported shells for completions in a phar
Using glob inside a phar does not work (it does not find anything).
Using a DirectoryIterator on the other hand works with phars. This
allows this command to compute the list of supported shells properly
when used inside a phar.
  • Loading branch information
stof committed Apr 21, 2023
commit aabdc2001112e61487dbe1dcc6c7bf8f3d738ca4
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,14 @@ private function tailDebugLog(string $commandName, OutputInterface $output): voi
*/
private function getSupportedShells(): array
{
return array_map(function ($f) {
return pathinfo($f, \PATHINFO_EXTENSION);
}, glob(__DIR__.'/../Resources/completion.*'));
$shells = [];

foreach (new \DirectoryIterator(__DIR__.'/../Resources/') as $file) {
if (str_starts_with($file->getBasename(), 'completion.') && $file->isFile()) {
$shells[] = $file->getExtension();
}
}

return $shells;
}
}