1
0
Fork 0

Fixing array accessing

pull/4945/head
Sash 2016-02-22 21:47:33 +00:00
parent f6899e5c38
commit 582e361a88
2 changed files with 8 additions and 7 deletions

View File

@ -129,7 +129,8 @@ class PathRepository extends ArrayRepository implements ConfigurableRepositoryIn
);
if (!isset($package['version'])) {
$package['version'] = $this->versionGuesser->guessVersion($package, $path)['version'] ?: 'dev-master';
$versionData = $this->versionGuesser->guessVersion($package, $path);
$package['version'] = $versionData['version'] ?: 'dev-master';
}
$output = '';

View File

@ -100,9 +100,9 @@ class VersionGuesserTest extends \PHPUnit_Framework_TestCase
$config = new Config;
$config->merge(array('repositories' => array('packagist' => false)));
$guesser = new VersionGuesser($config, $executor, new VersionParser());
$version = $guesser->guessVersion(array(), 'dummy/path')['version'];
$versionData = $guesser->guessVersion(array(), 'dummy/path');
$this->assertEquals("dev-$commitHash", $version);
$this->assertEquals("dev-$commitHash", $versionData['version']);
}
public function testTagBecomesVersion()
@ -130,9 +130,9 @@ class VersionGuesserTest extends \PHPUnit_Framework_TestCase
$config = new Config;
$config->merge(array('repositories' => array('packagist' => false)));
$guesser = new VersionGuesser($config, $executor, new VersionParser());
$version = $guesser->guessVersion(array(), 'dummy/path')['version'];
$versionData = $guesser->guessVersion(array(), 'dummy/path');
$this->assertEquals("2.0.5.0-alpha2", $version);
$this->assertEquals("2.0.5.0-alpha2", $versionData['version']);
}
public function testInvalidTagBecomesVersion()
@ -171,8 +171,8 @@ class VersionGuesserTest extends \PHPUnit_Framework_TestCase
$config = new Config;
$config->merge(array('repositories' => array('packagist' => false)));
$guesser = new VersionGuesser($config, $executor, new VersionParser());
$version = $guesser->guessVersion(array(), 'dummy/path')['version'];
$versionData = $guesser->guessVersion(array(), 'dummy/path');
$this->assertEquals("dev-foo", $version);
$this->assertEquals("dev-foo", $versionData['version']);
}
}