← All changes
|
vendor/composer/installers/src/Composer/Installers/SyDESInstaller.php
+15
-7
3.0.0
→
trunk
View file →
| @@ -1,9 +1,11 @@ | ||
| 1 | 1 | <?php |
| 2 | + | |
| 2 | 3 | namespace Composer\Installers; |
| 3 | 4 | |
| 4 | 5 | class SyDESInstaller extends BaseInstaller |
| 5 | 6 | { |
| 7 | + /** @var array<string, string> */ | |
| 6 | 8 | protected $locations = array( |
| 7 | 9 | 'module' => 'app/modules/{$name}/', |
| 8 | 10 | 'theme' => 'themes/{$name}/', |
| 9 | 11 | ); |
| @@ -11,12 +13,10 @@ | ||
| 11 | 13 | /** |
| 12 | 14 | * Format module name. |
| 13 | 15 | * |
| 14 | 16 | * Strip `sydes-` prefix and a trailing '-theme' or '-module' from package name if present. |
| 15 | - * | |
| 16 | - * {@inerhitDoc} | |
| 17 | 17 | */ |
| 18 | - public function inflectPackageVars($vars) | |
| 18 | + public function inflectPackageVars(array $vars): array | |
| 19 | 19 | { |
| 20 | 20 | if ($vars['type'] == 'sydes-module') { |
| 21 | 21 | return $this->inflectModuleVars($vars); |
| 22 | 22 | } |
| @@ -27,11 +27,15 @@ | ||
| 27 | 27 | |
| 28 | 28 | return $vars; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public function inflectModuleVars($vars) | |
| 31 | + /** | |
| 32 | + * @param array<string, string> $vars | |
| 33 | + * @return array<string, string> | |
| 34 | + */ | |
| 35 | + public function inflectModuleVars(array $vars): array | |
| 32 | 36 | { |
| 33 | - $vars['name'] = preg_replace('/(^sydes-|-module$)/i', '', $vars['name']); | |
| 37 | + $vars['name'] = $this->pregReplace('/(^sydes-|-module$)/i', '', $vars['name']); | |
| 34 | 38 | $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']); |
| 35 | 39 | $vars['name'] = str_replace(' ', '', ucwords($vars['name'])); |
| 36 | 40 | |
| 37 | 41 | return $vars; |
| @@ -36,11 +40,15 @@ | ||
| 36 | 40 | |
| 37 | 41 | return $vars; |
| 38 | 42 | } |
| 39 | 43 | |
| 40 | - protected function inflectThemeVars($vars) | |
| 44 | + /** | |
| 45 | + * @param array<string, string> $vars | |
| 46 | + * @return array<string, string> | |
| 47 | + */ | |
| 48 | + protected function inflectThemeVars(array $vars): array | |
| 41 | 49 | { |
| 42 | - $vars['name'] = preg_replace('/(^sydes-|-theme$)/', '', $vars['name']); | |
| 50 | + $vars['name'] = $this->pregReplace('/(^sydes-|-theme$)/', '', $vars['name']); | |
| 43 | 51 | $vars['name'] = strtolower($vars['name']); |
| 44 | 52 | |
| 45 | 53 | return $vars; |
| 46 | 54 | } |