@@ -205,7 +205,7 @@ private function createHelpParser(): OutputInterface
205
205
/** @var array<string,string> */
206
206
private $ descriptions = [];
207
207
208
- /** @var array<string,array{description:string, short?: bool, paramName?: string|null}> */
208
+ /** @var array<string,array{description:string, short?: bool, paramName?: string|null, keyValue?: bool }> */
209
209
private $ options = [];
210
210
211
211
/** @var array<string,string> */
@@ -279,7 +279,8 @@ private function describe(ConsoleApplicationBuilderInterface $application): void
279
279
$ definition ->withShortcutOnly ();
280
280
}
281
281
282
- if ($ config ['paramName ' ] ?? null ) {
282
+ if (($ config ['paramName ' ] ?? null ) !== null ) {
283
+ /** @psalm-suppress PossiblyUndefinedArrayOffset */
283
284
$ definition ->withRequiredValue ($ config ['paramName ' ]);
284
285
}
285
286
@@ -352,7 +353,6 @@ private function parseShortOptionDescriptions(string $help): void
352
353
}
353
354
354
355
if (null !== $ currentName ) {
355
- assert (is_string ($ currentName ));
356
356
$ this ->options [$ currentName ]['short ' ] = true ;
357
357
$ this ->options [$ currentName ]['description ' ] = $ currentDescription ;
358
358
}
@@ -362,7 +362,6 @@ private function parseShortOptionDescriptions(string $help): void
362
362
}
363
363
364
364
if ($ currentName !== null ) {
365
- assert (is_string ($ currentName ));
366
365
$ this ->options [$ currentName ]['short ' ] = true ;
367
366
$ this ->options [$ currentName ]['description ' ] = $ currentDescription ;
368
367
}
@@ -376,8 +375,11 @@ private function parseOptionDescriptions(string $help): void
376
375
377
376
foreach ($ lines as $ line ) {
378
377
preg_match ('#^\s+(--[a-z-]*)?\s+(.*)$# ' , $ line , $ matches );
378
+ if ($ matches === []) {
379
+ continue ;
380
+ }
379
381
380
- if ($ matches [1 ] === '' || $ matches [ 1 ] === null ) {
382
+ if ($ matches [1 ] === '' ) {
381
383
$ currentDescription .= ' ' . trim ($ matches [2 ]);
382
384
continue ;
383
385
}
0 commit comments