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

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

Open
SendiMyrkr opened this issue Nov 26, 2021 · 4 comments
Open
Labels
bug EAP This is being considered for the next EAP version

Comments

@SendiMyrkr
Copy link

  • 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)

@mesour
Copy link
Collaborator

mesour commented Dec 4, 2021

@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 mesour closed this as completed Dec 4, 2021
@SendiMyrkr
Copy link
Author

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

@mesour mesour reopened this Dec 4, 2021
@mesour
Copy link
Collaborator

mesour commented Dec 4, 2021

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

@mesour mesour added the bug label Dec 4, 2021
@mesour
Copy link
Collaborator

mesour commented Sep 24, 2023

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 mesour added the EAP This is being considered for the next EAP version label Sep 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug EAP This is being considered for the next EAP version
Projects
None yet
Development

No branches or pull requests

2 participants