efabrica-team / phpstan-latte

PHPStan extension to check compiled latte templates
MIT License
42 stars 3 forks source link

Documentation: add phpstan/phpstan-nette requirements #231

Closed spaze closed 1 year ago

spaze commented 1 year ago

These actions have no templates, so maybe these shouldn't be reported?

  1. "26 Cannot resolve latte template for action default" link uses redirect() https://github.com/spaze/michalspacek.cz/blob/71fd6075535830d05fe927ea9465e95acccb7133/site/app/Admin/Presenters/SignPresenter.php#L26-L29 "71 Cannot resolve latte template for action out" link https://github.com/spaze/michalspacek.cz/blob/71fd6075535830d05fe927ea9465e95acccb7133/site/app/Admin/Presenters/SignPresenter.php#L71-L77 both actions just redirect, but no error reported here https://github.com/spaze/michalspacek.cz/blob/71fd6075535830d05fe927ea9465e95acccb7133/site/app/Admin/Presenters/SignPresenter.php#L32-L39 (also redirects)

  2. " 23 Cannot resolve latte template for action default" link The method uses sendJson(): https://github.com/spaze/michalspacek.cz/blob/71fd6075535830d05fe927ea9465e95acccb7133/site/app/Api/Presenters/ErrorPresenter.php#L23

  3. "19 Cannot resolve latte template for action default" link Uses sendResponse(): https://github.com/spaze/michalspacek.cz/blob/71fd6075535830d05fe927ea9465e95acccb7133/site/app/Pulse/Presenters/ErrorPresenter.php#L21

  4. "22 Cannot resolve latte template for action storagesQuestions" link + "33 Cannot resolve latte template for action storagesRating" link Both actions use redirectPermanent() https://github.com/spaze/michalspacek.cz/blob/71fd6075535830d05fe927ea9465e95acccb7133/site/app/Pulse/Presenters/PasswordsPresenter.php#L24

lulco commented 1 year ago

Do you have phpstan-nette extension? I think this is config which is used to supress those errors: https://github.com/efabrica-team/phpstan-latte/blob/main/tests/config.neon#L9

spaze commented 1 year ago

Oh, nice, thanks. I had phpstan-nette loaded in the other phpstan.neon but not in the one that does phpstan-latte checks. Do you think the requirement should be documented in the Installation section? And maybe even have phpstan/phpstan-nette in require in composer.json?

lulco commented 1 year ago

I was thinking about it too. It definitelly should be in docs. I am not sure about composer, because you have to add it to your phpstan config anyways, right?

lulco commented 1 year ago

Hm, it seems method redirectPermanent is missing in phpstan extension.

https://github.com/phpstan/phpstan-nette/blob/1.1.x/extension.neon#L31

spaze commented 1 year ago

I am not sure about composer, because you have to add it to your phpstan config anyways, right?

Sure, but adding it to composer.json too would allow the docs to have one manual step less :-) Unless there's a situation where you may not need phpstan-nette.

spaze commented 1 year ago

Hm, it seems method redirectPermanent is missing in phpstan extension.

https://github.com/phpstan/phpstan-nette/blob/1.1.x/extension.neon#L31

And I thought I've already hit the issue and added it :| PR'd it now https://github.com/phpstan/phpstan-nette/pull/113

spaze commented 1 year ago

Oh, I thought... and I actually did, that's why it rang a bell. But the fix was in Nette, still pending release https://github.com/phpstan/phpstan-nette/pull/79#issuecomment-1152794607 + https://github.com/nette/application/pull/304

lulco commented 1 year ago

I think never return typehint shouldn’t be precondition to add method to earlyterminatingmethodcalls. Still, you can add it in your app until it will be in phpstan-nette

spaze commented 1 year ago

I think it's more of the fix than a precondition for adding but yeah, I have it in my config for like half a year, since at least creating the PR, with a note to remove it.

spaze commented 1 year ago

And the return never tag has now been released in nette/application 3.1.10 (but the extension doesn't seem to care much, see #261)