@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace TheCodingMachine\Discovery\Utils; |
5 | 5 |
@@ -65,7 +65,7 @@ |
||
65 | 65 | * Similar to a usort except that if 2 priorities are equal, order is preserved. |
66 | 66 | * Shamelessly copied from http://php.net/manual/fr/function.usort.php#38827 |
67 | 67 | * |
68 | - * @param $array |
|
68 | + * @param Asset[] $array |
|
69 | 69 | * @param string $cmp_function |
70 | 70 | */ |
71 | 71 | private function stableSort(&$array, $cmp_function = 'strcmp') |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $this->assets[] = $operation->getAsset(); |
37 | 37 | } else { |
38 | 38 | // This is a remove! |
39 | - $this->assets = array_values(array_filter($this->assets, function (Asset $asset) use ($operation) { |
|
39 | + $this->assets = array_values(array_filter($this->assets, function(Asset $asset) use ($operation) { |
|
40 | 40 | return $asset->getValue() !== $operation->getAsset()->getValue(); |
41 | 41 | })); |
42 | 42 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | // Let's order assets by priority. |
57 | - $this->stableSort($this->assets, function (Asset $asset1, Asset $asset2) { |
|
57 | + $this->stableSort($this->assets, function(Asset $asset1, Asset $asset2) { |
|
58 | 58 | return $asset2->getPriority() <=> $asset1->getPriority(); |
59 | 59 | }); |
60 | 60 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function getValues() : array |
131 | 131 | { |
132 | - return array_map(function (Asset $asset) { |
|
132 | + return array_map(function(Asset $asset) { |
|
133 | 133 | return $asset->getValue(); |
134 | 134 | }, $this->getAssets()); |
135 | 135 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | public function jsonSerialize() |
145 | 145 | { |
146 | - return array_map(function (Asset $asset) { |
|
146 | + return array_map(function(Asset $asset) { |
|
147 | 147 | return $asset->jsonSerialize(); |
148 | 148 | }, $this->getAssets()); |
149 | 149 | } |
@@ -12,10 +12,7 @@ |
||
12 | 12 | use Composer\Plugin\PluginInterface; |
13 | 13 | use Composer\Script\Event; |
14 | 14 | use Composer\Script\ScriptEvents; |
15 | -use Seld\JsonLint\JsonParser; |
|
16 | -use Seld\JsonLint\ParsingException; |
|
17 | 15 | use Symfony\Component\Filesystem\Filesystem; |
18 | -use TheCodingMachine\Discovery\Utils\JsonException; |
|
19 | 16 | |
20 | 17 | class DiscoveryPlugin implements PluginInterface, EventSubscriberInterface |
21 | 18 | { |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace TheCodingMachine\Discovery; |
6 | 6 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $assetTypes = $this->getAssetsBuilder()->buildAssetTypes($discoveryPackages); |
68 | 68 | |
69 | 69 | // Let's get an array of values, indexed by asset type (to store in the discovery_values.php file) |
70 | - $values = array_map(function (AssetType $assetType) { |
|
70 | + $values = array_map(function(AssetType $assetType) { |
|
71 | 71 | return $assetType->getValues(); |
72 | 72 | }, $assetTypes); |
73 | 73 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | return '.var_export($values, true).";\n"); |
76 | 76 | |
77 | 77 | // Let's get an array of assetTypes, indexed by asset type (to store in the discovery_asset_types.php file) |
78 | - $assetTypes = array_map(function (AssetType $assetType) { |
|
78 | + $assetTypes = array_map(function(AssetType $assetType) { |
|
79 | 79 | return $assetType->jsonSerialize(); |
80 | 80 | }, $assetTypes); |
81 | 81 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | $orderedPackageList = PackagesOrderer::reorderPackages($unorderedPackagesList); |
104 | 104 | |
105 | - return array_filter($orderedPackageList, function (PackageInterface $package) { |
|
105 | + return array_filter($orderedPackageList, function(PackageInterface $package) { |
|
106 | 106 | $installationManager = $this->composer->getInstallationManager(); |
107 | 107 | |
108 | 108 | $packageInstallPath = $installationManager->getInstallPath($package); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace TheCodingMachine\Discovery; |
6 | 6 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | { |
28 | 28 | // The very first step is to reorder the packages alphabetically. |
29 | 29 | // This is to ensure the same order every time, even between packages that are unrelated. |
30 | - usort($unorderedPackagesList, function (PackageInterface $packageA, PackageInterface $packageB) { |
|
30 | + usort($unorderedPackagesList, function(PackageInterface $packageA, PackageInterface $packageB) { |
|
31 | 31 | return strcmp($packageA->getName(), $packageB->getName()); |
32 | 32 | }); |
33 | 33 |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace TheCodingMachine\Discovery\Utils; |
5 | 5 |
@@ -47,7 +47,7 @@ |
||
47 | 47 | */ |
48 | 48 | public static function fromArray(string $name, array $assetsArray) : ImmutableAssetType |
49 | 49 | { |
50 | - $assets = array_map(function (array $assetArray) { |
|
50 | + $assets = array_map(function(array $assetArray) { |
|
51 | 51 | return Asset::fromArray($assetArray); |
52 | 52 | }, $assetsArray); |
53 | 53 | return new self($name, $assets); |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace TheCodingMachine\Discovery\Utils; |
5 | 5 |