Skip to content

Commit

Permalink
Set extra property with ReflectionClass
Browse files Browse the repository at this point in the history
  • Loading branch information
gabor-udvari committed Sep 5, 2015
1 parent a24f59b commit 2218f64
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Util/AssetPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Composer\Composer;
use Composer\IO\IOInterface;
use Composer\Repository\RepositoryManager;
use Composer\Package\Package;
use Composer\Package\PackageInterface;
use Fxp\Composer\AssetPlugin\Assets;
use Fxp\Composer\AssetPlugin\Installer\AssetInstaller;
use Fxp\Composer\AssetPlugin\Installer\BowerInstaller;
Expand Down Expand Up @@ -106,10 +106,10 @@ public static function setVcsTypeRepositories(RepositoryManager $rm)
* Adds the main file definitions from the root package.
*
* @param Composer $composer
* @param Package $package
* @param PackageInterface $package
* @param string $section
*/
public static function addMainFiles(Composer $composer, Package $package, $section = 'asset-main-files')
public static function addMainFiles(Composer $composer, PackageInterface $package, $section = 'asset-main-files')
{
$packageExtra = $package->getExtra();

Expand All @@ -122,7 +122,12 @@ public static function addMainFiles(Composer $composer, Package $package, $secti
}
}
}
$package->setExtra($packageExtra);
// copied from Repository\AbstractAssetVcsRepository->injectExtraConfig
$ref = new \ReflectionClass($package);
$met = $ref->getProperty('extra');
$met->setAccessible(true);
$met->setValue($package, $packageExtra);

return $package;
}
}

0 comments on commit 2218f64

Please sign in to comment.