forked from maknz/slack
-
-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Labels
Description
While cleaning up our codebase, we noticed a lot of warnings from PHPStan such as this:
Call to an undefined method Maknz\Slack\Message::send().
method.notFound
This appears to be a side effect of the magic wrapping of various methods through __call to getOrCreateMessage and then return $this. For example code like this causes warnings because it doesn't recognize the methods that are chained:
$this->client->to($slackChannel)->attach([
'title' => $slackTitle,
'text' => $slackMessage,
'color' => 'danger'
])->send($slackTitle);
Adding PHPDocs to the Client class for the more common methods to hint that these methods exist would help, such as this:
/**
* @method self to(string $channel)
* @method self attach(mixed $attachment)
*/