PluginProbe
Code Snippets / trunk
Code Snippets vtrunk
4.0.0-beta.2 3.10.2 3.10.1 3.10.0 3.10.0-beta.2 3.10.0-beta.1 4.0.0-beta.1 3.9.6 trunk 2.10.0 2.10.1 2.12.0 2.12.1 2.13.0 2.13.1 2.13.2 2.13.3 2.14.0 2.14.1 2.14.2 2.14.3 2.14.4 2.14.5 2.14.6 3.0.0 All 65 releases
← All changes | vendor/composer/installers/src/Composer/Installers/BitrixInstaller.php +10 -13 3.0.0 → trunk View file →
@@ -8,11 +8,11 @@
8 8 * Installer for Bitrix Framework. Supported types of extensions:
9 9 * - `bitrix-d7-module` — copy the module to directory `bitrix/modules/<vendor>.<name>`.
10 10 * - `bitrix-d7-component` — copy the component to directory `bitrix/components/<vendor>/<name>`.
11 11 * - `bitrix-d7-template` — copy the template to directory `bitrix/templates/<vendor>_<name>`.
12 - *
12 + *
13 13 * You can set custom path to directory with Bitrix kernel in `composer.json`:
14 - *
14 + *
15 15 * ```json
16 16 * {
17 17 * "extra": {
18 18 * "bitrix-dir": "s1/bitrix"
@@ -24,8 +24,9 @@
24 24 * @author Denis Kulichkin <[email protected]>
25 25 */
26 26 class BitrixInstaller extends BaseInstaller
27 27 {
28 + /** @var array<string, string> */
28 29 protected $locations = array(
29 30 'module' => '{$bitrix_dir}/modules/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken)
30 31 'component' => '{$bitrix_dir}/components/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken)
31 32 'theme' => '{$bitrix_dir}/templates/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken)
@@ -34,17 +35,15 @@
34 35 'd7-template' => '{$bitrix_dir}/templates/{$vendor}_{$name}/',
35 36 );
36 37
37 38 /**
38 - * @var array Storage for informations about duplicates at all the time of installation packages.
39 + * @var string[] Storage for informations about duplicates at all the time of installation packages.
39 40 */
40 41 private static $checkedDuplicates = array();
41 42
42 - /**
43 - * {@inheritdoc}
44 - */
45 - public function inflectPackageVars($vars)
43 + public function inflectPackageVars(array $vars): array
46 44 {
45 + /** @phpstan-ignore-next-line */
47 46 if ($this->composer->getPackage()) {
48 47 $extra = $this->composer->getPackage()->getExtra();
49 48
50 49 if (isset($extra['bitrix-dir'])) {
@@ -61,9 +60,9 @@
61 60
62 61 /**
63 62 * {@inheritdoc}
64 63 */
65 - protected function templatePath($path, array $vars = array())
64 + protected function templatePath(string $path, array $vars = array()): string
66 65 {
67 66 $templatePath = parent::templatePath($path, $vars);
68 67 $this->checkDuplicates($templatePath, $vars);
69 68
@@ -72,12 +71,11 @@
72 71
73 72 /**
74 73 * Duplicates search packages.
75 74 *
76 - * @param string $path
77 - * @param array $vars
75 + * @param array<string, string> $vars
78 76 */
79 - protected function checkDuplicates($path, array $vars = array())
77 + protected function checkDuplicates(string $path, array $vars = array()): void
80 78 {
81 79 $packageType = substr($vars['type'], strlen('bitrix') + 1);
82 80 $localDir = explode('/', $vars['bitrix_dir']);
83 81 array_pop($localDir);
@@ -93,10 +91,9 @@
93 91 if (in_array($oldPath, static::$checkedDuplicates)) {
94 92 return;
95 93 }
96 94
97 - if ($oldPath !== $path && file_exists($oldPath) && $this->io && $this->io->isInteractive()) {
98 -
95 + if ($oldPath !== $path && file_exists($oldPath) && $this->io->isInteractive()) {
99 96 $this->io->writeError(' <error>Duplication of packages:</error>');
100 97 $this->io->writeError(' <info>Package ' . $oldPath . ' will be called instead package ' . $path . '</info>');
101 98
102 99 while (true) {