Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Cannot resolve latte template for action" when setView is used with bleeding edge enabled #402

Closed
spaze opened this issue Jul 22, 2023 · 5 comments · Fixed by #405
Closed

Comments

@spaze
Copy link
Contributor

spaze commented Jul 22, 2023

I have simple actions using setView that looks like this (one is actually exactly like that and there's another one very similar):

	public function actionAdd(): void
	{
		$this->template->pageTitle = '...';
		$this->setView('edit');
	}

When analyzing it on level 9 with bleedingEdge.neon config included, I get "Cannot resolve latte template for action add":

 ------ ---------- ----------------------------------------------
  Line   Compiled   Admin/Presenters/BlogPresenter.php
         line
 ------ ---------- ----------------------------------------------
  44                Cannot resolve latte template for action add
 ------ ---------- ----------------------------------------------

To repeat, this only happens when bleeding edge config is used.

@lulco
Copy link
Contributor

lulco commented Jul 22, 2023

Interesting... what about phpstan-latte before commit 050697c? e.g. version 0.13.1? In mentioned commit I've added support for bleeding edge for internal implementations (but I don't know if it is somehow connected with your problem). I know there will be some other issues, I'm interesting only to this template resolving now. Can you check it?

@spaze
Copy link
Contributor Author

spaze commented Jul 22, 2023

Tried 0.13.1 and unfortunately the result is the same (see the first and last errors, ignore the others):

Errors
------

 ------ ---------- ----------------------------------------------
  Line   Compiled   Admin/Presenters/BlogPresenter.php
         line
 ------ ---------- ----------------------------------------------
  44                Cannot resolve latte template for action add
 ------ ---------- ----------------------------------------------

 ------ ---------- ------------------------------------------------------------------------------------------------------------------------------------
  Line   Compiled   Admin/Presenters/templates/Emails/default.latte rendered from MichalSpacekCz\Admin\Presenters\EmailsPresenter::default
         line       See compiled template: /tmp/phpstan-latte/app/Admin/Presenters/templates/Emails/default.latte.433241204b40334383a0c7ca8f529332.php
 ------ ---------- ------------------------------------------------------------------------------------------------------------------------------------
  34     254        Offset 0 on array{title: string|null} in isset() does not exist.
  34     254        Result of && is always false.
 ------ ---------- ------------------------------------------------------------------------------------------------------------------------------------

 ------ ---------- --------------------------------------------------------------------------------------------------------------------------------------
  Line   Compiled   Admin/Presenters/templates/Homepage/default.latte rendered from MichalSpacekCz\Admin\Presenters\HomepagePresenter::default
         line       See compiled template: /tmp/phpstan-latte/app/Admin/Presenters/templates/Homepage/default.latte.ceddd5bd930ee5a911a5d10f873f87a7.php
 ------ ---------- --------------------------------------------------------------------------------------------------------------------------------------
  63     421        Unreachable statement - code above always terminates.
 ------ ---------- --------------------------------------------------------------------------------------------------------------------------------------

 ------ ---------- ------------------------------------------------
  Line   Compiled   EasterEgg/Presenters/NettePresenter.php
         line
 ------ ---------- ------------------------------------------------
  23                Cannot resolve latte template for action micro
 ------ ---------- ------------------------------------------------

[...]

@lulco
Copy link
Contributor

lulco commented Jul 22, 2023

OK, it is good news :) I didn't screw it in that commit :D

We have to go deeper.

@lulco
Copy link
Contributor

lulco commented Jul 23, 2023

OK I think I found the issue :) https://phpstan.org/blog/preprocessing-ast-for-custom-rules
We use parent attributes from node to find parent nodes, but it is removed in bleeding edge :)

Have to rewrite it.

@lulco
Copy link
Contributor

lulco commented Jul 25, 2023

Solved by #405

@lulco lulco closed this as completed Jul 25, 2023
spaze added a commit to spaze/michalspacek.cz that referenced this issue Jul 26, 2023
spaze added a commit to spaze/michalspacek.cz that referenced this issue Jul 26, 2023
 - efabrica/phpstan-latte updated from 0.13.2 to 0.14.0 minor
   See changes: efabrica-team/phpstan-latte@0.13.2...0.14.0
   Release notes: https://github.com/efabrica-team/phpstan-latte/releases/tag/0.14.0

+ Unignore errors because efabrica-team/phpstan-latte#402 was fixed and released
+ Ignore new ones because of efabrica-team/phpstan-latte#415
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants