Skip to content

Commit 948278b

Browse files
committed
[0.6.x] Check if argv argument count meets expectations in bunny consumer
1 parent aee8444 commit 948278b

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

test/scripts/bunny-consumer.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
use Bunny\Client;
1212
use Bunny\Message;
1313
use React\EventLoop\Loop;
14+
use RuntimeException;
1415
use function Bunny\Test\Library\parseAmqpUri;
1516
use function array_shift;
17+
use function count;
1618
use function pcntl_signal;
1719
use const SIGINT;
1820

@@ -44,6 +46,14 @@ function app(array $args): void
4446
});
4547
}
4648

49+
if (!isset($argv)) {
50+
throw new RuntimeException('No argv found');
51+
}
52+
53+
if (count($argv) < 4) {
54+
throw new RuntimeException('Expecting at least 3 arguments, got ' . (count($argv) - 1));
55+
}
56+
4757
$argvCopy = $argv;
4858

4959
array_shift($argvCopy);

0 commit comments

Comments
 (0)