Skip to content

Commit eb7205f

Browse files
committed
switch constructor and create signatures to be more compatible to IJsonSerializable #10
1 parent 1fc7677 commit eb7205f

File tree

4 files changed

+34
-34
lines changed

4 files changed

+34
-34
lines changed

src/Api/IMember.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,20 @@ interface IMember extends IJsonSerializable
7777
public const JSON_NAME = 'name';
7878

7979
/**
80-
* API member constructor.
81-
* @param string $type Either bool or in or float or ...
82-
* @param string $name API struct or table member name.
80+
* Initialize this class from an array.
81+
* @param array<string, string> $array Array containing the properties of this class.
8382
* @throws IInvalidArgumentException
8483
*/
85-
public function __construct(string $type, string $name);
84+
public function __construct(array $array);
8685

8786
/**
88-
* Create an instance of this class from an array.
89-
* @param array<string, string> $array Array containing the properties of this class.
87+
* Create an instance of this class.
88+
* @param string $type Member type. Use TYPE_* constants.
89+
* @param string $name API struct or table member name.
9090
* @return IMember
9191
* @throws IInvalidArgumentException
9292
*/
93-
public static function create(array $array): IMember;
93+
public static function create(string $type, string $name): IMember;
9494

9595
/**
9696
* The PHP type of the element.

src/Api/IStruct.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,22 @@ interface IStruct extends IJsonSerializable
6060
public const JSON_MEMBERS = 'members';
6161

6262
/**
63-
* Table constructor.
64-
* @param string $name API struct name.
65-
* @param string $direction Either input or output
66-
* @param bool $isOptional Is the API struct optional?
67-
* @param IMember[] $members Array of members of the struct.
63+
* Initialize this class from an array.
64+
* @param array<string, string|bool|array<string, string>> $array Array containing the properties of this class.
6865
* @throws IInvalidArgumentException
6966
*/
70-
public function __construct(string $name, string $direction, bool $isOptional, array $members);
67+
public function __construct(array $array);
7168

7269
/**
73-
* Create an instance of this class from an array.
74-
* @param array<string, string|bool|array<string, string>> $array Array containing the properties of this class.
70+
* Create an instance of this class.
71+
* @param string $name API struct name.
72+
* @param string $direction Either input or output
73+
* @param bool $isOptional Is the API struct optional?
74+
* @param IMember[] $members Array of members of the struct.
7575
* @return IStruct
7676
* @throws IInvalidArgumentException
7777
*/
78-
public static function create(array $array): IStruct;
78+
public static function create(string $name, string $direction, bool $isOptional, array $members): IStruct;
7979

8080
/**
8181
* The PHP type of the element.

src/Api/ITable.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,22 @@ interface ITable extends IJsonSerializable
6565
public const JSON_MEMBERS = 'members';
6666

6767
/**
68-
* Table constructor.
69-
* @param string $name API table name.
70-
* @param string $direction Either input or output or table
71-
* @param bool $isOptional Is the API table optional?
72-
* @param IMember[] $members Array of members as columns of the table.
68+
* Initialize this class from an array.
69+
* @param array<string, string|bool|array<string, string>> $array Array containing the properties of this class.
7370
* @throws IInvalidArgumentException
7471
*/
75-
public function __construct(string $name, string $direction, bool $isOptional, array $members);
72+
public function __construct(array $array);
7673

7774
/**
78-
* Create an instance of this class from an array.
79-
* @param array<string, string|bool|array<string, string>> $array Array containing the properties of this class.
75+
* Create an instance of this class.
76+
* @param string $name API table name.
77+
* @param string $direction Either input or output or table
78+
* @param bool $isOptional Is the API table optional?
79+
* @param IMember[] $members Array of members as columns of the table.
8080
* @return ITable
8181
* @throws IInvalidArgumentException
8282
*/
83-
public static function create(array $array): ITable;
83+
public static function create(string $name, string $direction, bool $isOptional, array $members): ITable;
8484

8585
/**
8686
* The PHP type of the element.

src/Api/IValue.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,22 +97,22 @@ interface IValue extends IJsonSerializable
9797
public const JSON_OPTIONAL = 'optional';
9898

9999
/**
100-
* API value constructor.
101-
* @param string $type Either bool or in or float or ...
102-
* @param string $name API value name.
103-
* @param string $direction Either input or output.
104-
* @param bool $isOptional Is the API value optional?
100+
* Initialize this class from an array.
101+
* @param array<string, string|bool> $array Array containing the properties of this class.
105102
* @throws IInvalidArgumentException
106103
*/
107-
public function __construct(string $type, string $name, string $direction, bool $isOptional);
104+
public function __construct(array $array);
108105

109106
/**
110-
* Create an instance of this class from an array.
111-
* @param array<string, string|bool> $array Array containing the properties of this class.
107+
* Create an instance of this class.
108+
* @param string $type Either bool or in or float or ...
109+
* @param string $name API value name.
110+
* @param string $direction Either input or output.
111+
* @param bool $isOptional Is the API value optional?
112112
* @return IValue
113113
* @throws IInvalidArgumentException
114114
*/
115-
public static function create(array $array): IValue;
115+
public static function create(string $type, string $name, string $direction, bool $isOptional): IValue;
116116

117117
/**
118118
* The PHP type of the element.

0 commit comments

Comments
 (0)