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