Version
1.2.2
Description
Calling ServiceGetConfigRequest::start() throws a PayException with the message:
Could not parse response: Service with name "array|null" is not created because of
Unable to resolve service "array|null" to a factory
Root cause
Model\Method has a @var array|null annotation on $settings:
from Merge pull request #61 from paynl/feature/PLUG-5880
/**
* @var array|null
*/
protected ?array $settings;
Locally by changing line ~186 in Hydrator/Entity.php to:
$type = explode('|', $propertyInfo[$key] ?? 'string')[0];
This resolved the exception for me. However, I can't judge whether this is safe to merge ? I don't know the full scope of your API responses or whether silently dropping the null part of a union type could cause unintended behaviour elsewhere in the hydrator. Happy to leave that call to you.
Here's the stack trace section to add to the issue:
Stack trace:
PayNL\Sdk\Exception\PayException:
Could not initiate API call: Could not parse response: Service with name "array|null"
is not created because of Unable to resolve service "array|null" to a factory, Response:
at vendor/paynl/php-sdk/src/Request/RequestData.php:99
at PayNL\Sdk\Request\RequestData->start()
(vendor/paynl/php-sdk/src/Model/Request/ServiceGetConfigRequest.php:91)
at PayNL\Sdk\Model\Request\ServiceGetConfigRequest->startAPI()
(vendor/paynl/php-sdk/src/Model/Request/ServiceGetConfigRequest.php:72)
at PayNL\Sdk\Model\Request\ServiceGetConfigRequest->{closure:...:start():71}()
(vendor/paynl/php-sdk/src/Util/PayCache.php:62)
at PayNL\Sdk\Util\PayCache->get('service_getconfig_...', object(Closure), 5)
(vendor/paynl/php-sdk/src/Model/Request/ServiceGetConfigRequest.php:71)
at PayNL\Sdk\Model\Request\ServiceGetConfigRequest->start()
Reproduced with:
$serviceConfig = (new ServiceGetConfigRequest($serviceId))
->setConfig($config)
->start();
Sincerely,
Jula
CultureSuite Developer
Version
1.2.2
Description
Calling
ServiceGetConfigRequest::start()throws aPayExceptionwith the message:Root cause
Model\Methodhas a@var array|nullannotation on$settings:from Merge pull request #61 from paynl/feature/PLUG-5880