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
-
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
MyWebhookCall
Model contains:Instead of the package
WebhookCall
Model which reads:This results in static analysis errors in the
ProcessWebhookJob::handle()
method because the SpatieProcessWebhookJob
class hard-codes the type of the Model in the constructor:For example, the errors I get from PHPStan for my particular implementation of the
WebhookCall
Model and theProcessWebhookJob
class look like these:One possible solution might be declare an
interface
as the type hint for the constructor to the baseProcessWebhookJob
class, and have the Model implement it. There may be other, better solutions.Beta Was this translation helpful? Give feedback.
All reactions