On Magento 2 XML, we declare the path of the XSD schema with this line :

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

But PHP Storm doesn’t know the “urn” part and show the pathfile with red. So, PHP Storm doesn’t check the XML structure with it’s schema.

You can add this functionnality by type these commandes :

cp ./.idea/misc.xml ./.idea/misc.xml.bak
./bin/magento dev:urn-catalog:generate .idea/misc.xml

First, we make a backup of our file, if you have a problem, restore it.
After, we execute a script which resolve the PHP Storm schema location.

The pathfile will be green, and the schema validation is effective.

Xml Schema resolution in PHP Storm with Magento2 Urns

One thought on “Xml Schema resolution in PHP Storm with Magento2 Urns

Leave a Reply to Dmytro Kvashnin Cancel reply

Your email address will not be published. Required fields are marked *

We use cookies to ensure that we give you the best experience on our website.
Ok