Skip to content

Commit 621d917

Browse files
committed
Document exceptions
1 parent dae58b1 commit 621d917

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

src/Version10/Definition/Builder/ConsoleApplicationBuilderInterface.php

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,15 @@
44

55
namespace Phpcq\PluginApi\Version10\Definition\Builder;
66

7+
use Phpcq\PluginApi\Version10\Exception\RuntimeException;
8+
79
/**
810
* Interface describes a console application provided by a plugin.
11+
*
12+
* An application may contain either commands or arguments.
913
*/
1014
interface ConsoleApplicationBuilderInterface
1115
{
12-
/**
13-
* Adds a description to the console application.
14-
*
15-
* @param string $description The description of the console application
16-
*
17-
* @return self
18-
*/
19-
public function withDescription(string $description): self;
20-
2116
/**
2217
* Describe which value separator is used.
2318
*
@@ -36,14 +31,27 @@ public function withOptionValueSeparator(string $separator): self;
3631
* @param string $description The command description.
3732
*
3833
* @return ConsoleCommandBuilderInterface
34+
*
35+
* @throws RuntimeException When a command with the name is already described or any argument is described.
3936
*/
4037
public function describeCommand(string $name, string $description): ConsoleCommandBuilderInterface;
4138

39+
/**
40+
* Adds a new argument to the command with a name and a description.
41+
*
42+
* The order of the arguments descriptions defines the order of the expected arguments.
43+
*
44+
* @throws RuntimeException When an argument with the name is already described or any command is described.
45+
*/
46+
public function describeArgument(string $name, string $description): ConsoleArgumentBuilderInterface;
47+
4248
/**
4349
* Adds a new option to the exec task which will be available independent of the concrete command.
4450
*
4551
* @param string $name The option name.
4652
* @param string $description The option description.
53+
*
54+
* @throws RuntimeException When an option with the name is already described.
4755
*/
4856
public function describeOption(string $name, string $description): ConsoleOptionBuilderInterface;
4957
}

src/Version10/Definition/Builder/ConsoleCommandBuilderInterface.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Phpcq\PluginApi\Version10\Definition\Builder;
66

7+
use Phpcq\PluginApi\Version10\Exception\RuntimeException;
8+
79
/**
810
* This interface describes a console command with it's supported arguments and options.
911
*/
@@ -13,11 +15,15 @@ interface ConsoleCommandBuilderInterface
1315
* Adds a new argument to the command with a name and a description.
1416
*
1517
* The order of the arguments descriptions defines the order of the exepected arguments.
18+
*
19+
* @throws RuntimeException When an argument with the name is already described.
1620
*/
1721
public function describeArgument(string $name, string $description): ConsoleArgumentBuilderInterface;
1822

1923
/**
2024
* Adds a new option to the command with a name and a description.
25+
*
26+
* @throws RuntimeException When an option with the name is already described.
2127
*/
2228
public function describeOption(string $name, string $description): ConsoleOptionBuilderInterface;
2329
}

0 commit comments

Comments
 (0)