intellij-latte
intellij-latte copied to clipboard
Method x not found for type mixed when call method in array index
- 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>

first call of getMorning is marked with error "Method getMorning not found for type mixed", second one is [ok](url)
@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}
That's not problem. That problem is only when you call method as index of array. On different situation is everything ok.
@SendiMyrkr yes, now I'm seeing it. It is a bug, thank you for reporting.
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