1 | <?php |
||
10 | class NamshiAdapter extends JWTProvider implements JWTInterface |
||
11 | { |
||
12 | /** |
||
13 | * @var \Namshi\JOSE\JWS |
||
14 | */ |
||
15 | protected $jws; |
||
16 | |||
17 | /** |
||
18 | * @param string $secret |
||
19 | * @param string $algo |
||
20 | * @param null $driver |
||
21 | */ |
||
22 | 9 | public function __construct($secret, $algo, $driver = null) |
|
28 | |||
29 | /** |
||
30 | * Create a JSON Web Token |
||
31 | * |
||
32 | * @return string |
||
33 | * @throws \Tymon\JWTAuth\Exceptions\JWTException |
||
34 | */ |
||
35 | 6 | public function encode(array $payload) |
|
36 | { |
||
37 | try { |
||
38 | 6 | $this->jws->setPayload($payload)->sign($this->secret); |
|
|
|||
39 | |||
40 | 3 | return $this->jws->getTokenString(); |
|
41 | 3 | } catch (Exception $e) { |
|
42 | 3 | throw new JWTException('Could not create token: ' . $e->getMessage()); |
|
43 | } |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * Decode a JSON Web Token |
||
48 | * |
||
49 | * @param string $token |
||
50 | * @return array |
||
51 | * @throws \Tymon\JWTAuth\Exceptions\JWTException |
||
52 | */ |
||
53 | 3 | public function decode($token) |
|
67 | } |
||
68 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: