Skip to content

Commit 5b23879

Browse files
ENGCOM-5404: Optimized dev:urn-catalog:generate for PHPStorm #23291
- Merge Pull Request #23291 from JeroenBoersma/magento2:2.3-develop - Merged commits: 1. 0db89b2 2. 767af1f 3. 211fe95 4. c50595e 5. 79a1087 6. d269ddd 7. 693a625
2 parents 5588999 + 693a625 commit 5b23879

File tree

1 file changed

+14
-1
lines changed
  • app/code/Magento/Developer/Model/XmlCatalog/Format

1 file changed

+14
-1
lines changed

app/code/Magento/Developer/Model/XmlCatalog/Format/PhpStorm.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
*/
1919
class PhpStorm implements FormatInterface
2020
{
21+
private const PROJECT_PATH_IDENTIFIER = '$PROJECT_DIR$';
22+
2123
/**
2224
* @var ReadInterface
2325
*/
@@ -95,7 +97,7 @@ public function generateCatalog(array $dictionary, $configFilePath)
9597
foreach ($dictionary as $urn => $xsdPath) {
9698
$node = $dom->createElement('resource');
9799
$node->setAttribute('url', $urn);
98-
$node->setAttribute('location', $xsdPath);
100+
$node->setAttribute('location', $this->getFileLocationInProject($xsdPath));
99101
$componentNode->appendChild($node);
100102
}
101103
$dom->formatOutput = true;
@@ -129,4 +131,15 @@ private function initEmptyFile(\DOMDocument $dom)
129131
$projectNode->appendChild($rootComponentNode);
130132
return $projectNode;
131133
}
134+
135+
/**
136+
* Resolve xsdpath to xml project path
137+
*
138+
* @param string $xsdPath
139+
* @return string
140+
*/
141+
private function getFileLocationInProject(string $xsdPath): string
142+
{
143+
return self::PROJECT_PATH_IDENTIFIER . DIRECTORY_SEPARATOR . $this->currentDirRead->getRelativePath($xsdPath);
144+
}
132145
}

0 commit comments

Comments
 (0)