@@ -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 | } |
@@ -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 | |
@@ -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 | |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace TheCodingMachine\Discovery; |
| 5 | 5 | |
@@ -18,9 +18,9 @@ |
||
| 18 | 18 | protected function configure() |
| 19 | 19 | { |
| 20 | 20 | $this->setName('discovery:list') |
| 21 | - ->setDescription('List the values of the asset type passed in parameter (or list all asset types if no parameter is passed)') |
|
| 22 | - ->addArgument('asset-type', InputArgument::OPTIONAL, 'The asset type to list') |
|
| 23 | - ->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt or json)', 'txt'); |
|
| 21 | + ->setDescription('List the values of the asset type passed in parameter (or list all asset types if no parameter is passed)') |
|
| 22 | + ->addArgument('asset-type', InputArgument::OPTIONAL, 'The asset type to list') |
|
| 23 | + ->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt or json)', 'txt'); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | protected function execute(InputInterface $input, OutputInterface $output) |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | $output->writeln(sprintf('<error>Could not find the "%s" asset type.</error>', $assetTypeName)); |
| 34 | 34 | return; |
| 35 | 35 | } |
| 36 | - $assetTypes = [ $assetTypes[$assetTypeName] ]; |
|
| 36 | + $assetTypes = [$assetTypes[$assetTypeName]]; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | switch ($input->getOption('format')) { |
@@ -5,15 +5,12 @@ |
||
| 5 | 5 | |
| 6 | 6 | |
| 7 | 7 | use Composer\Command\BaseCommand; |
| 8 | -use Composer\Factory; |
|
| 9 | 8 | use Symfony\Component\Console\Input\InputArgument; |
| 10 | 9 | use Symfony\Component\Console\Input\InputInterface; |
| 11 | 10 | use Symfony\Component\Console\Input\InputOption; |
| 12 | 11 | use Symfony\Component\Console\Output\OutputInterface; |
| 13 | 12 | use TheCodingMachine\Discovery\Asset; |
| 14 | 13 | use TheCodingMachine\Discovery\AssetOperation; |
| 15 | -use TheCodingMachine\Discovery\AssetsBuilder; |
|
| 16 | -use TheCodingMachine\Discovery\AssetType; |
|
| 17 | 14 | use TheCodingMachine\Discovery\DiscoveryFileLoader; |
| 18 | 15 | use TheCodingMachine\Discovery\Dumper; |
| 19 | 16 | |
@@ -22,10 +22,10 @@ |
||
| 22 | 22 | protected function configure() |
| 23 | 23 | { |
| 24 | 24 | $this->setName('discovery:add') |
| 25 | - ->setDescription('Add an asset') |
|
| 26 | - ->addArgument('asset-type', InputArgument::REQUIRED, 'The asset type') |
|
| 27 | - ->addArgument('value', InputArgument::REQUIRED, 'The asset to add') |
|
| 28 | - ->addOption('priority', 'p', InputOption::VALUE_REQUIRED, 'The priority', 0.0); |
|
| 25 | + ->setDescription('Add an asset') |
|
| 26 | + ->addArgument('asset-type', InputArgument::REQUIRED, 'The asset type') |
|
| 27 | + ->addArgument('value', InputArgument::REQUIRED, 'The asset to add') |
|
| 28 | + ->addOption('priority', 'p', InputOption::VALUE_REQUIRED, 'The priority', 0.0); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | protected function execute(InputInterface $input, OutputInterface $output) |
@@ -5,13 +5,8 @@ |
||
| 5 | 5 | |
| 6 | 6 | |
| 7 | 7 | use Composer\Command\BaseCommand; |
| 8 | -use Composer\Factory; |
|
| 9 | -use Symfony\Component\Console\Input\InputArgument; |
|
| 10 | 8 | use Symfony\Component\Console\Input\InputInterface; |
| 11 | -use Symfony\Component\Console\Input\InputOption; |
|
| 12 | 9 | use Symfony\Component\Console\Output\OutputInterface; |
| 13 | -use TheCodingMachine\Discovery\AssetsBuilder; |
|
| 14 | -use TheCodingMachine\Discovery\AssetType; |
|
| 15 | 10 | use TheCodingMachine\Discovery\Dumper; |
| 16 | 11 | |
| 17 | 12 | class DumpCommand extends BaseCommand |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | protected function configure() |
| 20 | 20 | { |
| 21 | 21 | $this->setName('discovery:dump') |
| 22 | - ->setDescription('Regenerates the Discovery class (in the .discovery folder). This is automatically triggered on install and update.'); |
|
| 22 | + ->setDescription('Regenerates the Discovery class (in the .discovery folder). This is automatically triggered on install and update.'); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | protected function execute(InputInterface $input, OutputInterface $output) |