'Unused local variable' for variable in blade foreach loops

In every foreach loop of my blade templates i get an 'unused local variable warning' (check the image) also if i use the variable in the body of the foreach. Any idea on why it happens?

0
4 comments

Hi there,

No clue -- never seen it in Blade files.

  • Try "File | Invalidate Caches.." and restart IDE just in case
  • Does it do the same in other files / places?
  • Maybe it's your plugins?
  • Anything special about this file? Can you share it (the whole actual file; not just copy-pasted text)?
0

umh...strange, i thought it was a known bug, as i'have this problem since 2017.1

Invalidating and restarting doesn't work,

It does the same on every blade file, even if the file is empty and has only the foreach. On the other end if i use the php tags it works correctly:

Can it be the blade plugin ? Maybe i can try to uninstall it, or maybe it could be another plugin ?

0

ok, found the cause: i had this inspection enabled: php -> ununsed local variable -> enable inspection in global space.

Anyway it's strange that with <?php tags it doesn't give the warning while with @foreach yes...

0

Please sign in to leave a comment.