Skip to content

Commit 560898e

Browse files
committed
Fix undefined offset error
1 parent 85167a0 commit 560898e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/BashCompletionPlugin.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use Composer\Plugin\PluginInterface;
88
use Symfony\Component\Console\Application;
99
use Symfony\Component\Console\Input\ArgvInput;
10-
use Symfony\Component\Console\Input\ArrayInput;
1110

1211
class BashCompletionPlugin implements PluginInterface
1312
{
@@ -23,6 +22,10 @@ public function activate(Composer $composer, IOInterface $io)
2322
global $application;
2423
global $__bashCompletionInjected;
2524

25+
if (count($argv) < 2) {
26+
return;
27+
}
28+
2629
// Inject completion command when the command line is `composer depends _completion`
2730
if ($argv[1] == 'depends' && $argv[2] == '_completion' && !$__bashCompletionInjected) {
2831
$__bashCompletionInjected = true;

0 commit comments

Comments
 (0)