← All changes
|
vendor/composer/installers/src/Composer/Installers/WinterInstaller.php
+22
-9
3.0.0
→
trunk
View file →
| @@ -1,9 +1,11 @@ | ||
| 1 | 1 | <?php |
| 2 | + | |
| 2 | 3 | namespace Composer\Installers; |
| 3 | 4 | |
| 4 | 5 | class WinterInstaller extends BaseInstaller |
| 5 | 6 | { |
| 7 | + /** @var array<string, string> */ | |
| 6 | 8 | protected $locations = array( |
| 7 | 9 | 'module' => 'modules/{$name}/', |
| 8 | 10 | 'plugin' => 'plugins/{$vendor}/{$name}/', |
| 9 | 11 | 'theme' => 'themes/{$name}/' |
| @@ -14,11 +16,10 @@ | ||
| 14 | 16 | * |
| 15 | 17 | * For package type winter-plugin, cut off a trailing '-plugin' if present. |
| 16 | 18 | * |
| 17 | 19 | * For package type winter-theme, cut off a trailing '-theme' if present. |
| 18 | - * | |
| 19 | 20 | */ |
| 20 | - public function inflectPackageVars($vars) | |
| 21 | + public function inflectPackageVars(array $vars): array | |
| 21 | 22 | { |
| 22 | 23 | if ($vars['type'] === 'winter-module') { |
| 23 | 24 | return $this->inflectModuleVars($vars); |
| 24 | 25 | } |
| @@ -33,26 +34,38 @@ | ||
| 33 | 34 | |
| 34 | 35 | return $vars; |
| 35 | 36 | } |
| 36 | 37 | |
| 37 | - protected function inflectModuleVars($vars) | |
| 38 | + /** | |
| 39 | + * @param array<string, string> $vars | |
| 40 | + * @return array<string, string> | |
| 41 | + */ | |
| 42 | + protected function inflectModuleVars(array $vars): array | |
| 38 | 43 | { |
| 39 | - $vars['name'] = preg_replace('/^wn-|-module$/', '', $vars['name']); | |
| 44 | + $vars['name'] = $this->pregReplace('/^wn-|-module$/', '', $vars['name']); | |
| 40 | 45 | |
| 41 | 46 | return $vars; |
| 42 | 47 | } |
| 43 | 48 | |
| 44 | - protected function inflectPluginVars($vars) | |
| 49 | + /** | |
| 50 | + * @param array<string, string> $vars | |
| 51 | + * @return array<string, string> | |
| 52 | + */ | |
| 53 | + protected function inflectPluginVars(array $vars): array | |
| 45 | 54 | { |
| 46 | - $vars['name'] = preg_replace('/^wn-|-plugin$/', '', $vars['name']); | |
| 47 | - $vars['vendor'] = preg_replace('/[^a-z0-9_]/i', '', $vars['vendor']); | |
| 55 | + $vars['name'] = $this->pregReplace('/^wn-|-plugin$/', '', $vars['name']); | |
| 56 | + $vars['vendor'] = $this->pregReplace('/[^a-z0-9_]/i', '', $vars['vendor']); | |
| 48 | 57 | |
| 49 | 58 | return $vars; |
| 50 | 59 | } |
| 51 | 60 | |
| 52 | - protected function inflectThemeVars($vars) | |
| 61 | + /** | |
| 62 | + * @param array<string, string> $vars | |
| 63 | + * @return array<string, string> | |
| 64 | + */ | |
| 65 | + protected function inflectThemeVars(array $vars): array | |
| 53 | 66 | { |
| 54 | - $vars['name'] = preg_replace('/^wn-|-theme$/', '', $vars['name']); | |
| 67 | + $vars['name'] = $this->pregReplace('/^wn-|-theme$/', '', $vars['name']); | |
| 55 | 68 | |
| 56 | 69 | return $vars; |
| 57 | 70 | } |
| 58 | 71 | } |