diff --git a/src/Installer.php b/src/Installer.php index 4d7f3486..e3267e47 100644 --- a/src/Installer.php +++ b/src/Installer.php @@ -27,11 +27,21 @@ public function getInstallPath(PackageInterface $package) { $this->initializeVendorDir(); - $rootPackageExtra = $this->composer->getPackage()->getExtra(); - $packageExtra = $package->getExtra(); + $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getPackages(); + $packages[] = $this->composer->getPackage(); + + $mapping = []; + foreach($packages as $localPackage) { + $extra = $localPackage->getExtra(); + if (isset($extra['phpcodesniffer-mapping']) === true) { + $mapping = array_merge($mapping, $extra['phpcodesniffer-mapping']); + } + } + + $packageExtra = $package->getExtra(); - if (isset($rootPackageExtra['phpcodesniffer-mapping'][$package->getPrettyName()]) === true) { - $standardDir = $rootPackageExtra['phpcodesniffer-mapping'][$package->getPrettyName()]; + if (isset($mapping[$package->getPrettyName()]) === true) { + $standardDir = $mapping[$package->getPrettyName()]; } elseif (isset($packageExtra['phpcodesniffer-standard']) === true) { $standardDir = $packageExtra['phpcodesniffer-standard']; } else {