intellij-latte icon indicating copy to clipboard operation
intellij-latte copied to clipboard

Method x not found for type mixed when call method in array index

Open SendiMyrkr opened this issue 4 years ago • 4 comments

  • PhpStorm 2021.2.3
  • Plugin 1.1.4-RC1
class WeekSchedule {
    public function getMorning(): string
    {
        return 'somevalue';
    }
}
{varType WeekSchedule $weekSchedule}
{var $labels = ['somevalue' => 'other']}

<td>{$labels[$weekSchedule->getMorning()] ?? $monday->getMorning()|noescape}</td>

latte-error-2

first call of getMorning is marked with error "Method getMorning not found for type mixed", second one is [ok](url)

SendiMyrkr avatar Nov 26 '21 12:11 SendiMyrkr

@SendiMyrkr Hello, classes without namespace must be prefixed with \. Otherwise, the plugin has no way to detect that it is a class name.

Try:

{varType \WeekSchedule $weekSchedule}

mesour avatar Dec 04 '21 11:12 mesour

That's not problem. That problem is only when you call method as index of array. On different situation is everything ok.

SendiMyrkr avatar Dec 04 '21 13:12 SendiMyrkr

@SendiMyrkr yes, now I'm seeing it. It is a bug, thank you for reporting.

mesour avatar Dec 04 '21 21:12 mesour

Code completion for methods will be removed in next version

Use Pro plugin: https://plugins.jetbrains.com/plugin/19661-latte-pro here is migration guide from free plugin: https://mesour-intellij-plugins.github.io/latte.html#migration

mesour avatar Sep 24 '23 00:09 mesour