PluginProbe
Code Snippets / trunk
Code Snippets vtrunk
4.0.0-beta.3 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 All 66 releases
← All changes | vendor/composer/installers/src/Composer/Installers/AsgardInstaller.php +15 -6 3.0.0 → trunk View file →
@@ -1,9 +1,11 @@
1 1 <?php
2 +
2 3 namespace Composer\Installers;
3 4
4 5 class AsgardInstaller extends BaseInstaller
5 6 {
7 + /** @var array<string, string> */
6 8 protected $locations = array(
7 9 'module' => 'Modules/{$name}/',
8 10 'theme' => 'Themes/{$name}/'
9 11 );
@@ -13,11 +15,10 @@
13 15 *
14 16 * For package type asgard-module, cut off a trailing '-plugin' if present.
15 17 *
16 18 * For package type asgard-theme, cut off a trailing '-theme' if present.
17 - *
18 19 */
19 - public function inflectPackageVars($vars)
20 + public function inflectPackageVars(array $vars): array
20 21 {
21 22 if ($vars['type'] === 'asgard-module') {
22 23 return $this->inflectPluginVars($vars);
23 24 }
@@ -28,11 +29,15 @@
28 29
29 30 return $vars;
30 31 }
31 32
32 - protected function inflectPluginVars($vars)
33 + /**
34 + * @param array<string, string> $vars
35 + * @return array<string, string>
36 + */
37 + protected function inflectPluginVars(array $vars): array
33 38 {
34 - $vars['name'] = preg_replace('/-module$/', '', $vars['name']);
39 + $vars['name'] = $this->pregReplace('/-module$/', '', $vars['name']);
35 40 $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
36 41 $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
37 42
38 43 return $vars;
@@ -37,11 +42,15 @@
37 42
38 43 return $vars;
39 44 }
40 45
41 - protected function inflectThemeVars($vars)
46 + /**
47 + * @param array<string, string> $vars
48 + * @return array<string, string>
49 + */
50 + protected function inflectThemeVars(array $vars): array
42 51 {
43 - $vars['name'] = preg_replace('/-theme$/', '', $vars['name']);
52 + $vars['name'] = $this->pregReplace('/-theme$/', '', $vars['name']);
44 53 $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
45 54 $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
46 55
47 56 return $vars;