Skip to content

Parameter types are wrong for NestedTokenBuilder #662

Description

@stof

Version(s) affected

4.1.7

Description

* @param array{alg?: string, string?: mixed} $jweSharedProtectedHeader

This defines the type of $jweSharedProtectedHeader and $jweSharedHeader as accepting 2 optional keys (alg and string. The documented usage passes an enc key

How to reproduce

Take the code snippet from https://web-token.spomky-labs.com/advanced-topics/nested-tokens#nested-token-building and analyze it with phpstan with bleeding-edge enabled (sealed array shapes are not yet used in normal mode for BC reasons) or with psalm.

Possible Solution

Define the proper array shape for the parameter (I tried to figure the right type myself, but the NestedTokenBuilder passes the value to the JWE layer that does not define the array type)

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions