Skip to content

Commit f51c4a6

Browse files
committed
add missing @throws tags in PHPDoc #11
1 parent 0e94e8a commit f51c4a6

21 files changed

+217
-57
lines changed

src/AbstractFunction.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
use phpsap\exceptions\UnknownFunctionException;
1212
use phpsap\interfaces\Config\IConfiguration;
1313
use phpsap\interfaces\Api\IApi;
14+
use phpsap\interfaces\exceptions\IConnectionFailedException;
15+
use phpsap\interfaces\exceptions\IIncompleteConfigException;
16+
use phpsap\interfaces\exceptions\IInvalidArgumentException;
17+
use phpsap\interfaces\exceptions\IUnknownFunctionException;
1418
use phpsap\interfaces\IFunction;
1519
use phpsap\interfaces\Util\IJsonSerializable;
1620

@@ -45,6 +49,7 @@ abstract class AbstractFunction extends JsonSerializable implements IFunction
4549
* @return array
4650
* @throws ConnectionFailedException
4751
* @throws IncompleteConfigException
52+
* @throws InvalidArgumentException
4853
* @throws UnknownFunctionException
4954
*/
5055
protected function getAllowedKeys(): array
@@ -68,11 +73,15 @@ protected function getAllowedKeys(): array
6873
* defined. In case no SAP remote function call API has been defined, it will be
6974
* queried on the fly by connecting to the SAP remote system. In order to
7075
* connect to the SAP remote system, you need a connection configuration.
71-
* @param string $name SAP remote function name.
72-
* @param array|null $params SAP remote function call parameters. Default: null
76+
* @param string $name SAP remote function name.
77+
* @param array|null $params SAP remote function call parameters. Default: null
7378
* @param IConfiguration|null $config Connection configuration. Default: null
74-
* @param IApi|null $api SAP remote function call API. Default: null
79+
* @param IApi|null $api SAP remote function call API. Default: null
7580
* @throws InvalidArgumentException
81+
* @throws IConnectionFailedException
82+
* @throws IIncompleteConfigException
83+
* @throws IInvalidArgumentException
84+
* @throws IUnknownFunctionException
7685
*/
7786
public function __construct($name, array $params = null, IConfiguration $config = null, IApi $api = null)
7887
{
@@ -267,6 +276,10 @@ public function jsonSerialize(): array
267276
* Decode a formerly JSON encoded SAP remote function object.
268277
* @param string $json
269278
* @return AbstractFunction
279+
* @throws IConnectionFailedException
280+
* @throws IIncompleteConfigException
281+
* @throws IInvalidArgumentException
282+
* @throws IUnknownFunctionException
270283
* @throws InvalidArgumentException
271284
*/
272285
public static function jsonDecode($json): IJsonSerializable

src/Api/Element.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public function __construct($type, $name)
6060
/**
6161
* The PHP type of the element.
6262
* @return string
63+
* @throws InvalidArgumentException
6364
*/
6465
public function getType(): string
6566
{
@@ -72,6 +73,7 @@ public function getType(): string
7273
/**
7374
* The name of the element.
7475
* @return string
76+
* @throws InvalidArgumentException
7577
*/
7678
public function getName(): string
7779
{
@@ -121,6 +123,7 @@ protected function setName($name)
121123
* Cast a given output value to the type defined in this class.
122124
* @param mixed $value
123125
* @return bool|int|float|string|SapDateTime|SapDateInterval
126+
* @throws InvalidArgumentException
124127
*/
125128
public function cast($value)
126129
{

src/Api/RemoteApi.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public function add(IValue $value): IApi
3737
/**
3838
* Get all input values of the remote function.
3939
* @return Value[]
40+
* @throws InvalidArgumentException
4041
*/
4142
public function getInputValues(): array
4243
{
@@ -46,6 +47,7 @@ public function getInputValues(): array
4647
/**
4748
* Get all output values of the remote function.
4849
* @return Value[]
50+
* @throws InvalidArgumentException
4951
*/
5052
public function getOutputValues(): array
5153
{
@@ -55,6 +57,7 @@ public function getOutputValues(): array
5557
/**
5658
* Get all tables of the remote function.
5759
* @return Table[]
60+
* @throws InvalidArgumentException
5861
*/
5962
public function getTables(): array
6063
{
@@ -65,6 +68,7 @@ public function getTables(): array
6568
* Get the API values according to their direction: input, output, table.
6669
* @param string $direction
6770
* @return array
71+
* @throws InvalidArgumentException
6872
*/
6973
protected function getValues($direction): array
7074
{

src/Api/Struct.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public function __construct($name, $direction, $isOptional, $members)
6565
* @param array $value The output array to typecast.
6666
* @return array
6767
* @throws ArrayElementMissingException
68+
* @throws InvalidArgumentException
6869
*/
6970
public function cast($value): array
7071
{
@@ -88,6 +89,7 @@ public function cast($value): array
8889
/**
8990
* Return an array of member elements.
9091
* @return array
92+
* @throws InvalidArgumentException
9193
*/
9294
public function getMembers(): array
9395
{

src/Api/Table.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public function __construct($name, $direction, $isOptional, $members)
6464
* @param array $value
6565
* @return array
6666
* @throws ArrayElementMissingException
67+
* @throws InvalidArgumentException
6768
*/
6869
public function cast($value): array
6970
{
@@ -90,6 +91,7 @@ public function cast($value): array
9091
/**
9192
* Return an array of member elements.
9293
* @return array
94+
* @throws InvalidArgumentException
9395
*/
9496
public function getMembers(): array
9597
{

src/Api/Value.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public function __construct($type, $name, $direction, $isOptional)
5353
/**
5454
* Get the direction of the API value.
5555
* @return string
56+
* @throws InvalidArgumentException
5657
*/
5758
public function getDirection(): string
5859
{
@@ -65,6 +66,7 @@ public function getDirection(): string
6566
/**
6667
* Is the value optional?
6768
* @return bool
69+
* @throws InvalidArgumentException
6870
*/
6971
public function isOptional(): bool
7072
{

src/Config/ConfigCommon.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ abstract class ConfigCommon extends AbstractConfiguration implements IConfigComm
3535
* Get the username to use for authentication.
3636
* @return string
3737
* @throws IncompleteConfigException
38+
* @throws InvalidArgumentException
3839
*/
3940
public function getUser(): string
4041
{
@@ -66,6 +67,7 @@ public function setUser($user): IConfigCommon
6667
* Get the password to use for authentication.
6768
* @return string
6869
* @throws IncompleteConfigException
70+
* @throws InvalidArgumentException
6971
*/
7072
public function getPasswd(): string
7173
{
@@ -97,6 +99,7 @@ public function setPasswd($passwd): IConfigCommon
9799
* Get the client.
98100
* @return string
99101
* @throws IncompleteConfigException
102+
* @throws InvalidArgumentException
100103
*/
101104
public function getClient(): string
102105
{
@@ -129,6 +132,7 @@ public function setClient($client): IConfigCommon
129132
* the parameters are in the following format:
130133
* /H/hostname/S/portnumber/H/
131134
* @return string|null The saprouter or NULL in case the saprouter hasn't been set.
135+
* @throws InvalidArgumentException
132136
*/
133137
public function getSaprouter(): ?string
134138
{
@@ -165,6 +169,7 @@ public function setSaprouter($saprouter): IConfigCommon
165169
/**
166170
* Get the trace level (0-3). See constants TRACE_*.
167171
* @return int|null The trace level or NULL in case the trace level hasn't been set.
172+
* @throws InvalidArgumentException
168173
*/
169174
public function getTrace(): ?int
170175
{
@@ -200,6 +205,7 @@ public function setTrace($trace): IConfigCommon
200205
* codepage for the initial handshake, thus preserving the characters in
201206
* username/password.
202207
* @return int|null The codepage or NULL in case the codepage hasn't been set.
208+
* @throws InvalidArgumentException
203209
*/
204210
public function getCodepage(): ?int
205211
{
@@ -227,6 +233,7 @@ public function setCodepage($codepage): IConfigCommon
227233
/**
228234
* Get the logon Language.
229235
* @return string|null The logon language or NULL in case the logon language hasn't been set.
236+
* @throws InvalidArgumentException
230237
*/
231238
public function getLang(): ?string
232239
{
@@ -259,6 +266,7 @@ public function setLang($lang): IConfigCommon
259266
/**
260267
* Get the destination in RfcOpenConnection.
261268
* @return string|null The destination or NULL in case the destination hasn't been set.
269+
* @throws InvalidArgumentException
262270
*/
263271
public function getDest(): ?string
264272
{

src/Config/ConfigTypeA.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class ConfigTypeA extends ConfigCommon implements IConfigTypeA
4040
* Get the host name of a specific SAP application server.
4141
* @return string The hostname of a specific SAP application server.
4242
* @throws IncompleteConfigException
43+
* @throws InvalidArgumentException
4344
*/
4445
public function getAshost(): string
4546
{
@@ -71,6 +72,7 @@ public function setAshost($ashost): IConfigTypeA
7172
* Get the SAP system number.
7273
* @return string The SAP system number.
7374
* @throws IncompleteConfigException
75+
* @throws InvalidArgumentException
7476
*/
7577
public function getSysnr(): string
7678
{
@@ -101,6 +103,7 @@ public function setSysnr($sysnr): IConfigTypeA
101103
/**
102104
* Get the gateway host on the application server.
103105
* @return string|null The gateway host or NULL in case no gateway host has been defined.
106+
* @throws InvalidArgumentException
104107
*/
105108
public function getGwhost(): ?string
106109
{
@@ -125,6 +128,7 @@ public function setGwhost($gwhost): IConfigTypeA
125128
/**
126129
* Get the gateway service on the application server.
127130
* @return string|null The gateway service or NULL in case no gateway service has been defined.
131+
* @throws InvalidArgumentException
128132
*/
129133
public function getGwserv(): ?string
130134
{

src/Config/ConfigTypeB.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class ConfigTypeB extends ConfigCommon implements IConfigTypeB
3939
* Get the host name of the message server.
4040
* @return string
4141
* @throws IncompleteConfigException
42+
* @throws InvalidArgumentException
4243
*/
4344
public function getMshost(): string
4445
{
@@ -69,6 +70,7 @@ public function setMshost($mshost): IConfigTypeB
6970
/**
7071
* Get the name of SAP system, optional; default: destination
7172
* @return string|null The name of the SAP system or NULL in case no name has been defined.
73+
* @throws InvalidArgumentException
7274
*/
7375
public function getR3name(): ?string
7476
{
@@ -93,6 +95,7 @@ public function setR3name($r3name): IConfigTypeB
9395
/**
9496
* Get the group name of the application servers, optional; default: PUBLIC.
9597
* @return string group name of the application servers
98+
* @throws InvalidArgumentException
9699
*/
97100
public function getGroup(): ?string
98101
{

0 commit comments

Comments
 (0)