Replies: 1 comment
-
|
I've worked around this for now with this kludge: /** @var object $payload */
$payload = $this->webhookCall->payload; |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Execution works fine, but static analysis tools such as PHPStan complain about the variable type when a custom Model is used to decode the JSON payload into an object instead of an array.
The custom
MyWebhookCallModel contains:Instead of the package
WebhookCallModel which reads:This results in static analysis errors in the
ProcessWebhookJob::handle()method because the SpatieProcessWebhookJobclass hard-codes the type of the Model in the constructor:For example, the errors I get from PHPStan for my particular implementation of the
WebhookCallModel and theProcessWebhookJobclass look like these:One possible solution might be declare an
interfaceas the type hint for the constructor to the baseProcessWebhookJobclass, and have the Model implement it. There may be other, better solutions.Beta Was this translation helpful? Give feedback.
All reactions