PHPDoc method prediction considerations
Currently I try to improve PHPDoc on this library (branch master) - due to the missing @throws TypeException parts.
In SendGrid.php some parameters don't have the proper PHPDoc types, which make it hard to calculate methods (using PhpStorm) in tests. Is there a reason the next changes aren't allowed?
use SendGrid\Client;
use SendGrid\Mail\Mail;
use SendGrid\Response;
and
/** @var string Namespace */
protected $namespace = 'SendGrid';
/** @var Client Client */
public $client;
/** @var string Version */
public $version = self::VERSION;
(next question)
According to this issue and absence of DynamicTemplateData class, I think type hints for DynamicTemplateData may be changed. Can these be replaced safely by Substitution?
That's it for now!
I've no issue with reviewing a PR to add the proper PHP docs.
Not sure I understand the second question. Dynamic template data is used for dynamic templates and substitutions are used for legacy templates. Could you clarify?
Second issue is about type hints of (legacy) class DynamicTemplateData which may be found by https://github.com/sendgrid/sendgrid-php/search?q=DynamicTemplateData&type=Code .
No big issue after all and will provide PR soon.
Ah, I see what you mean. Those docs are actually correct, although confusing.
If a dynamic template is used, all substitutions and dynamic template data will go in the dynamic_template_data of the personalizations.
If a dynamic template is not used (i.e., a legacy template), all substitutions and dynamic template data will go in the substitutions of the personalizations.
Some of the logic here: https://github.com/sendgrid/sendgrid-php/blob/master/lib/mail/Personalization.php#L287-L293