cakephp-phpstan icon indicating copy to clipboard operation
cakephp-phpstan copied to clipboard

Mailer $this->getMailer()

Open dereuromark opened this issue 3 years ago • 5 comments

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 avatar Nov 15 '21 14:11 dereuromark

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

factory: CakeDC\PHPStan\Type\TableLocatorDynamicReturnTypeExtension(Cake\Mailer\Mailer, fetchTable)

dereuromark avatar Feb 28 '24 19:02 dereuromark

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

rochamarcelo avatar Mar 01 '24 11:03 rochamarcelo

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

dereuromark avatar Mar 01 '24 11:03 dereuromark

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

rochamarcelo avatar Mar 01 '24 12:03 rochamarcelo

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

dereuromark avatar Mar 01 '24 12:03 dereuromark