| @@ 494-521 (lines=28) @@ | ||
| 491 | namespace PHPSTORM_META { |
|
| 492 | PHP; |
|
| 493 | $baseMap .= "\n"; |
|
| 494 | foreach ($this->methodFactories as $group => $methods) { |
|
| 495 | $map = $baseMap; |
|
| 496 | foreach ($methods as $method) { |
|
| 497 | $map .= " override( " . $method . "(0),\n"; |
|
| 498 | $map .= " map( [\n"; |
|
| 499 | asort($classMaps[$group]); |
|
| 500 | foreach ($classMaps[$group] as $classPrefix => $class) { |
|
| 501 | if (preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $class)) { |
|
| 502 | $map .= " '$classPrefix' => \\$class::class,\n"; |
|
| 503 | } else { |
|
| 504 | $output->writeln('<warning>Invalid class name <comment>' . $class . '</comment> ignored</warning>'); |
|
| 505 | } |
|
| 506 | } |
|
| 507 | $map .= " ])\n"; |
|
| 508 | $map .= " );\n"; |
|
| 509 | } |
|
| 510 | $map .= <<<PHP |
|
| 511 | } |
|
| 512 | PHP; |
|
| 513 | if ($input->getOption('stdout')) { |
|
| 514 | $output->writeln($map); |
|
| 515 | } else { |
|
| 516 | $group = str_replace(array(' ', '/'), '_', $group); |
|
| 517 | if (\file_put_contents($this->_magentoRootFolder . '/.phpstorm.meta.php/magento_' . $group . '_methods.meta.php', $map)) { |
|
| 518 | $output->writeln('<info>File <comment>.phpstorm.meta.php/magento_' . $group . '_methods.meta.php</comment> generated</info>'); |
|
| 519 | } |
|
| 520 | } |
|
| 521 | } |
|
| 522 | } |
|
| 523 | ||
| 524 | protected function writeToOutputV2019(InputInterface $input, OutputInterface $output, $classMaps) |
|
| @@ 576-603 (lines=28) @@ | ||
| 573 | namespace PHPSTORM_META { |
|
| 574 | PHP; |
|
| 575 | $baseMap .= "\n"; |
|
| 576 | foreach ($this->methodFactories as $group => $methods) { |
|
| 577 | $map = $baseMap; |
|
| 578 | foreach ($methods as $method) { |
|
| 579 | $map .= " override( " . $method . "(0),\n"; |
|
| 580 | $map .= " map( [\n"; |
|
| 581 | asort($classMaps[$group]); |
|
| 582 | foreach ($classMaps[$group] as $classPrefix => $class) { |
|
| 583 | if (preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $class)) { |
|
| 584 | $map .= " '$classPrefix' => \\$class::class,\n"; |
|
| 585 | } else { |
|
| 586 | $output->writeln('<warning>Invalid class name <comment>' . $class . '</comment> ignored</warning>'); |
|
| 587 | } |
|
| 588 | } |
|
| 589 | $map .= " ])\n"; |
|
| 590 | $map .= " );\n"; |
|
| 591 | } |
|
| 592 | $map .= <<<PHP |
|
| 593 | } |
|
| 594 | PHP; |
|
| 595 | if ($input->getOption('stdout')) { |
|
| 596 | $output->writeln($map); |
|
| 597 | } else { |
|
| 598 | $group = str_replace(array(' ', '/'), '_', $group); |
|
| 599 | if (\file_put_contents($this->_magentoRootFolder . '/.phpstorm.meta.php/magento_' . $group . '_methods.meta.php', $map)) { |
|
| 600 | $output->writeln('<info>File <comment>.phpstorm.meta.php/magento_' . $group . '_methods.meta.php</comment> generated</info>'); |
|
| 601 | } |
|
| 602 | } |
|
| 603 | } |
|
| 604 | } |
|
| 605 | ||
| 606 | /** |
|