5 * Contains \Robo\composer\ScriptHandler.
8 namespace Robo\composer;
10 use Composer\Script\Event;
11 use Symfony\Component\Filesystem\Filesystem;
17 * Run prior to `composer installl` when a composer.lock is present.
20 public static function checkDependencies(Event $event)
22 if (version_compare(PHP_VERSION, '5.6.0') < 0) {
23 static::checkDependenciesFor55();
28 * Check to see if the dependencies in composer.lock are compatible
31 protected static function checkDependenciesFor55()
33 $fs = new Filesystem();
34 if (!$fs->exists('composer.lock')) {
38 $composerLockContents = file_get_contents('composer.lock');
39 if (preg_match('#"php":.*(5\.6)#', $composerLockContents)) {
40 static::fixDependenciesFor55();
44 protected static function fixDependenciesFor55()
46 $fs = new Filesystem();
49 $fs->remove('composer.lock');
51 // Composer has already read our composer.json file, so we will
52 // need to run in a new process to fix things up.
53 passthru('composer install --ansi', $status);
55 // Don't continue with the initial 'composer install' command