As of PHP 8.1, it's possible to use new syntax as default value to functions params (rfc). However this doesn't seem to be supported in nette/di yet.
For example with lcobucci/jwt configuration.
Method annotation
ref
public static function forSymmetricSigner(
Signer $signer,
Key $key,
Encoder $encoder = new JoseEncoder(), // optional argument
Decoder $decoder = new JoseEncoder(), // optional argument
): self {
// ...
}
DI config
- Configuration::forSymmetricSigner(
signer: [instance of Signer]
key: [instance of Key]
# no $encoder or $decoder param passed
)
Output
Service of type Encoder required by $encoder in Configuration::forSymmetricSigner not found
When I pass JoseEncoder explicitly, it works.
Note: I removed FQNs for better readability.
As of PHP 8.1, it's possible to use
newsyntax as default value to functions params (rfc). However this doesn't seem to be supported innette/diyet.For example with
lcobucci/jwtconfiguration.Method annotation
ref
DI config
Output
Service of type Encoder required by $encoder in Configuration::forSymmetricSigner not foundWhen I pass
JoseEncoderexplicitly, it works.Note: I removed FQNs for better readability.