PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / trunk
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF vtrunk
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.9 2.2.8 trunk 1.10 1.3.3 1.3.4 1.3.5 1.3.5.1 1.3.5.2 1.3.6 1.3.6.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 All 103 releases
← All changes | vendor/composer/installers/src/Composer/Installers/MajimaInstaller.php +15 -6 1.10 → trunk View file →
@@ -1,5 +1,6 @@
1 1 <?php
2 +
2 3 namespace Composer\Installers;
3 4
4 5 /**
5 6 * Plugin/theme installer for majima
@@ -6,8 +7,9 @@
6 7 * @author David Neustadt
7 8 */
8 9 class MajimaInstaller extends BaseInstaller
9 10 {
11 + /** @var array<string, string> */
10 12 protected $locations = array(
11 13 'plugin' => 'plugins/{$name}/',
12 14 );
13 15
@@ -12,12 +14,13 @@
12 14 );
13 15
14 16 /**
15 17 * Transforms the names
16 - * @param array $vars
17 - * @return array
18 + *
19 + * @param array<string, string> $vars
20 + * @return array<string, string>
18 21 */
19 - public function inflectPackageVars($vars)
22 + public function inflectPackageVars(array $vars): array
20 23 {
21 24 return $this->correctPluginName($vars);
22 25 }
23 26
@@ -22,16 +25,22 @@
22 25 }
23 26
24 27 /**
25 28 * Change hyphenated names to camelcase
26 - * @param array $vars
27 - * @return array
29 + *
30 + * @param array<string, string> $vars
31 + * @return array<string, string>
28 32 */
29 - private function correctPluginName($vars)
33 + private function correctPluginName(array $vars): array
30 34 {
31 35 $camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) {
32 36 return strtoupper($matches[0][1]);
33 37 }, $vars['name']);
38 +
39 + if (null === $camelCasedName) {
40 + throw new \RuntimeException('Failed to run preg_replace_callback: '.preg_last_error());
41 + }
42 +
34 43 $vars['name'] = ucfirst($camelCasedName);
35 44 return $vars;
36 45 }
37 46 }