Skip to main content

New phpstan-magento release

This blog post might be outdated!
This blog post was published more than one year ago and might be outdated!
· One min read
Stephan Hochdörfer

Besides supporting PHPStan version 1.3, the latest phpstan-magento extension release 0.15.0 adds support for extension attributes for both Magento modules and Magento applications.

Extension Attributes allow developers to “extend” existing API Data interfaces by defining additional attributes in an XML-based configuration. The phpstan-magento extension parses these XML definitions and generates the respective interfaces so that PHPStan can analyze these interfaces.

Out-of-the-box phpstan-magento will parse all "extension_attributes.xml" files recursively found in the current working directory (the directory that contains the phpstan.neon configuration file). You can change this behavior by defining a "magentoRoot" parameter in your phpstan.neon file that points to the directory that should be scanned instead:

magentoRoot: /tmp/my/other/dir

Disabled Magento modules are not yet taken into account. phpstan-magento will parse all extension_attributes.xml files found in all "etc" directories, regardless if the module is enabled or not.