Skip to content

Commit 2c59f07

Browse files
committed
Allow code completion for CliMenuBuilder#end
1 parent 72d2b82 commit 2c59f07

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/Builder/CliMenuBuilder.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
class CliMenuBuilder implements Builder
2323
{
2424
use BuilderUtils;
25+
26+
/**
27+
* @var null|Builder
28+
*/
29+
private $parent;
2530

2631
/**
2732
* @var bool
@@ -464,4 +469,18 @@ public function build() : CliMenu
464469

465470
return $menu;
466471
}
472+
473+
/**
474+
* Return to parent builder
475+
*
476+
* @return CliMenuBuilder|SplitItemBuilder
477+
*/
478+
public function end() : ?Builder
479+
{
480+
if (null === $this->parent) {
481+
throw new RuntimeException('No parent builder to return to');
482+
}
483+
484+
return $this->parent;
485+
}
467486
}

0 commit comments

Comments
 (0)