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

Can't use class constants in the messages.php file #4

Open
wijourdil opened this issue Jun 11, 2018 · 3 comments
Open

Can't use class constants in the messages.php file #4

wijourdil opened this issue Jun 11, 2018 · 3 comments

Comments

@wijourdil
Copy link

Hi !
The plugin works like a charm ! But I can't use class constants in the translations files, for example :

'status' => [
    MyClass::STATUS_WAITING => 'Lorem Ipsum',
    MyClass::STATUS_DONE => 'Dolor sit amet',
    ...,
]

I get the following error :

Module build failed: Error: Unexpected PHP key: "staticlookup
@rmariuzzo
Copy link
Owner

That's an interesting case. Not sure how easy will be to solve this case using JS.

@ichiriac
Copy link

Hi @rmariuzzo,

In order to address this kind of issue you have to scan and index class constants from every php into the repository, and also resolve the use statement in order to have a fully qualified class name (by resolving for example aliases).

I've tried something here : https://github.com/glayzzle/php-reflection but the library is not finished. You can maybe reuse some parts of code.

Best Regards,
Ioan

@rmariuzzo
Copy link
Owner

@ichiriac that sound interesting, will take a look. I appreciate the details to avoid common pitfalls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants