CakeDC / cakephp-phpstan

CakePHP extension for PHPStan
Other
30 stars 5 forks source link

Mailer $this->getMailer() #6

Open dereuromark opened 2 years ago

dereuromark commented 2 years ago

Should also be understood:

    $this->getMailer('Notification')

as right now it fails as

  179    Parameter #2 $mailer of class App\Release\Releaser constructor expects App\Mailer\NotificationMailer, 
         Cake\Mailer\Mailer given.  

when passed to another method.

But since this is based on a trait method, similar issues as with other trait methods apply here. Until PHPStan doesnt resolve this, we might have to keep this open - refs https://github.com/phpstan/phpstan/issues/5761

dereuromark commented 6 months ago

Has this been tackled yet? I only see mailer in relation to

factory: CakeDC\PHPStan\Type\TableLocatorDynamicReturnTypeExtension(Cake\Mailer\Mailer, fetchTable)
rochamarcelo commented 6 months ago

@dereuromark No, unfortunately we can't handle return types of trait. The line you mentioned is to handle calls to fetchTable inside Mailer class.

dereuromark commented 6 months ago

Can escalate this further to PHPStan to get "fixed up" I wonder?

rochamarcelo commented 6 months ago

I remeber to have a ticket about trait on PHPStan github but It does not seems to have any progress

dereuromark commented 6 months ago

https://github.com/phpstan/phpstan/issues/5761 still open, jep