Skip to content

Commit a3e0d14

Browse files
committed
Fix #6 -> add arg info type
1 parent 5460b58 commit a3e0d14

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,10 @@ try {
318318
## Functions
319319

320320
```php
321-
//encode
322-
string jwt_encode(array $claims, string $key [, string $algorithm = 'HS256'])
321+
// encode
322+
string jwt_encode(array $payload, string $key [, string $algorithm = 'HS256'])
323323

324-
//decode
324+
// decode
325325
array jwt_decode(string $token, string $key [, array $options = ['algorithm' => 'HS256']])
326326
```
327327

jwt.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,18 @@ PHP_JWT_API zend_class_entry *jwt_invalid_sub_cex;
5050

5151
ZEND_DECLARE_MODULE_GLOBALS(jwt)
5252

53+
ZEND_BEGIN_ARG_INFO_EX(arginfo_jwt_encode, 0, 0, 2)
54+
ZEND_ARG_ARRAY_INFO(0, payload, 1)
55+
ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 1)
56+
ZEND_ARG_TYPE_INFO(0, alg, IS_STRING, 1)
57+
ZEND_END_ARG_INFO()
58+
59+
ZEND_BEGIN_ARG_INFO_EX(arginfo_jwt_decode, 0, 0, 2)
60+
ZEND_ARG_TYPE_INFO(0, token, IS_STRING, 1)
61+
ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 1)
62+
ZEND_ARG_INFO(0, options)
63+
ZEND_END_ARG_INFO()
64+
5365
/* string to algorithm */
5466
jwt_alg_t jwt_str_alg(const char *alg)
5567
{
@@ -618,8 +630,8 @@ PHP_FUNCTION(jwt_decode)
618630
}
619631

620632
const zend_function_entry jwt_functions[] = {
621-
PHP_FE(jwt_encode, NULL)
622-
PHP_FE(jwt_decode, NULL)
633+
PHP_FE(jwt_encode, arginfo_jwt_encode)
634+
PHP_FE(jwt_decode, arginfo_jwt_decode)
623635
PHP_FE_END
624636
};
625637

0 commit comments

Comments
 (0)