5

I have loaded Magento 2 files and XML validation into PHPStorm which is very convenient. Is it also possible to do this (automatically) with factory classes and maybee other generated files? Since they are autogenerated in /var/generation PHPStorm does not recognize it by default and highligts them as "undefined".

1

The easy answer is "not", out of the box magento2 just have some defined factories like CatalogPriceFactory (which have sense since are auto-generated) however you can add var/generation as source folder.

Personally I don't like to use it that way because you'll find some class definitions twice.

Anyway you shouldn't get any 'undefined' warning in PhpStorm for that looking, in my code I have that class that isn't showing any warn:

Use Block:

enter image description here

__construct Block

enter image description here

I'm not sure if I did some change in configuration to remove errors, i guess not, but I'm using the Magento2 Plugin, that maybe is helping behind the scenes.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.