1 | <?php |
||
17 | class AssetsBuilder |
||
18 | { |
||
19 | |||
20 | |||
21 | /** |
||
22 | * @var InstallationManager |
||
23 | */ |
||
24 | private $installationManager; |
||
25 | /** |
||
26 | * @var IOInterface |
||
27 | */ |
||
28 | private $io; |
||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | private $rootDir; |
||
33 | |||
34 | public function __construct(InstallationManager $installationManager, IOInterface $io, string $rootDir) |
||
35 | { |
||
36 | $this->installationManager = $installationManager; |
||
37 | $this->io = $io; |
||
38 | $this->rootDir = $rootDir; |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * Find discovery.json files in the passed repository and builds an asset type. |
||
43 | * |
||
44 | * @param RepositoryInterface $repository |
||
45 | * @param RootPackageInterface $rootPackage |
||
|
|||
46 | * @return array|AssetType[] |
||
47 | */ |
||
48 | public function findAssetTypes(RepositoryInterface $repository) : array |
||
49 | { |
||
50 | $unorderedPackagesList = $repository->getPackages(); |
||
51 | |||
52 | $orderedPackageList = PackagesOrderer::reorderPackages($unorderedPackagesList); |
||
53 | |||
54 | $packages = array_filter($orderedPackageList, function (PackageInterface $package) { |
||
55 | $packageInstallPath = $this->getInstallPath($package); |
||
56 | |||
57 | return file_exists($packageInstallPath.'/discovery.json'); |
||
58 | }); |
||
59 | |||
60 | return $this->buildAssetTypes($packages); |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * Builds the AssetTypes that will be exported in the generated TheCodingMachine\Discovery class. |
||
65 | * |
||
66 | * @param PackageInterface[] $discoveryPackages |
||
67 | * |
||
68 | * @return AssetType[] An array of AssetType, indexed by asset type name. |
||
69 | */ |
||
70 | public function buildAssetTypes(array $discoveryPackages) : array |
||
94 | |||
95 | /** |
||
96 | * Returns the parsed JSON of the discovery.json file of a package. |
||
97 | * |
||
98 | * @param PackageInterface $package |
||
99 | * |
||
100 | * @return AssetOperation[][] |
||
101 | * |
||
102 | * @throws \TheCodingMachine\Discovery\Utils\JsonException |
||
103 | */ |
||
104 | private function getDiscoveryJson(PackageInterface $package) : array |
||
118 | |||
119 | private function getInstallPath(PackageInterface $package) : string |
||
120 | { |
||
127 | } |
||
128 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.