commit
e12e0335a4
|
@ -199,7 +199,7 @@ EOF;
|
||||||
$targetDirLoader = null;
|
$targetDirLoader = null;
|
||||||
$mainAutoload = $mainPackage->getAutoload();
|
$mainAutoload = $mainPackage->getAutoload();
|
||||||
if ($mainPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
|
if ($mainPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
|
||||||
$levels = count(explode('/', $filesystem->normalizePath($mainPackage->getTargetDir())));
|
$levels = substr_count($filesystem->normalizePath($mainPackage->getTargetDir()), '/') + 1;
|
||||||
$prefixes = implode(', ', array_map(function ($prefix) {
|
$prefixes = implode(', ', array_map(function ($prefix) {
|
||||||
return var_export($prefix, true);
|
return var_export($prefix, true);
|
||||||
}, array_keys($mainAutoload['psr-0'])));
|
}, array_keys($mainAutoload['psr-0'])));
|
||||||
|
@ -601,7 +601,7 @@ HEADER;
|
||||||
if ($useIncludePath) {
|
if ($useIncludePath) {
|
||||||
$file .= <<<'INCLUDE_PATH'
|
$file .= <<<'INCLUDE_PATH'
|
||||||
$includePaths = require __DIR__ . '/include_paths.php';
|
$includePaths = require __DIR__ . '/include_paths.php';
|
||||||
array_push($includePaths, get_include_path());
|
$includePaths[] = get_include_path();
|
||||||
set_include_path(implode(PATH_SEPARATOR, $includePaths));
|
set_include_path(implode(PATH_SEPARATOR, $includePaths));
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ EOT
|
||||||
|
|
||||||
$args = $input->getArgument('args');
|
$args = $input->getArgument('args');
|
||||||
|
|
||||||
if (!is_null($timeout = $input->getOption('timeout'))) {
|
if (null !== $timeout = $input->getOption('timeout')) {
|
||||||
if (!ctype_digit($timeout)) {
|
if (!ctype_digit($timeout)) {
|
||||||
throw new \RuntimeException('Timeout value must be numeric and positive if defined, or 0 for forever');
|
throw new \RuntimeException('Timeout value must be numeric and positive if defined, or 0 for forever');
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ EOT
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
foreach ($package['suggest'] as $suggestion => $reason) {
|
foreach ($package['suggest'] as $suggestion => $reason) {
|
||||||
if (false === strpos('/', $suggestion) && !is_null($platform->findPackage($suggestion, '*'))) {
|
if (false === strpos('/', $suggestion) && null !== $platform->findPackage($suggestion, '*')) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!isset($installed[$suggestion])) {
|
if (!isset($installed[$suggestion])) {
|
||||||
|
|
|
@ -171,7 +171,8 @@ EOT
|
||||||
);
|
);
|
||||||
$autocompleterValues = array();
|
$autocompleterValues = array();
|
||||||
foreach ($requires as $require) {
|
foreach ($requires as $require) {
|
||||||
$autocompleterValues[strtolower($require->getTarget())] = $require->getTarget();
|
$target = $require->getTarget();
|
||||||
|
$autocompleterValues[strtolower($target)] = $target;
|
||||||
}
|
}
|
||||||
|
|
||||||
$installedPackages = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
|
$installedPackages = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
|
||||||
|
|
|
@ -283,7 +283,7 @@ class RuleSetGenerator
|
||||||
switch ($job['cmd']) {
|
switch ($job['cmd']) {
|
||||||
case 'install':
|
case 'install':
|
||||||
if (!$job['fixed'] && $ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
|
if (!$job['fixed'] && $ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
|
$packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
|
||||||
|
|
|
@ -51,7 +51,7 @@ class RuleSetIterator implements \Iterator
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->currentOffset >= sizeof($this->rules[$this->currentType])) {
|
if ($this->currentOffset >= count($this->rules[$this->currentType])) {
|
||||||
$this->currentOffset = 0;
|
$this->currentOffset = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
@ -63,7 +63,7 @@ class RuleSetIterator implements \Iterator
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->currentType = $this->types[$this->currentTypeOffset];
|
$this->currentType = $this->types[$this->currentTypeOffset];
|
||||||
} while (isset($this->types[$this->currentTypeOffset]) && !sizeof($this->rules[$this->currentType]));
|
} while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ class RuleSetIterator implements \Iterator
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->currentType = $this->types[$this->currentTypeOffset];
|
$this->currentType = $this->types[$this->currentTypeOffset];
|
||||||
} while (isset($this->types[$this->currentTypeOffset]) && !sizeof($this->rules[$this->currentType]));
|
} while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function valid()
|
public function valid()
|
||||||
|
|
|
@ -111,16 +111,16 @@ class Transaction
|
||||||
$packageId = $package->id;
|
$packageId = $package->id;
|
||||||
|
|
||||||
if (!isset($visited[$packageId])) {
|
if (!isset($visited[$packageId])) {
|
||||||
array_push($queue, $package);
|
$queue[] = $package;
|
||||||
|
|
||||||
if ($package instanceof AliasPackage) {
|
if ($package instanceof AliasPackage) {
|
||||||
array_push($queue, $package->getAliasOf());
|
$queue[] = $package->getAliasOf();
|
||||||
} else {
|
} else {
|
||||||
foreach ($package->getRequires() as $link) {
|
foreach ($package->getRequires() as $link) {
|
||||||
$possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
|
$possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
|
||||||
|
|
||||||
foreach ($possibleRequires as $require) {
|
foreach ($possibleRequires as $require) {
|
||||||
array_push($queue, $require);
|
$queue[] = $require;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,9 +96,7 @@ class PerforceDownloader extends VcsDownloader
|
||||||
*/
|
*/
|
||||||
protected function getCommitLogs($fromReference, $toReference, $path)
|
protected function getCommitLogs($fromReference, $toReference, $path)
|
||||||
{
|
{
|
||||||
$commitLogs = $this->perforce->getCommitLogs($fromReference, $toReference);
|
return $this->perforce->getCommitLogs($fromReference, $toReference);
|
||||||
|
|
||||||
return $commitLogs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setPerforce($perforce)
|
public function setPerforce($perforce)
|
||||||
|
|
|
@ -204,7 +204,7 @@ class Factory
|
||||||
if ($composerAuthEnv = getenv('COMPOSER_AUTH')) {
|
if ($composerAuthEnv = getenv('COMPOSER_AUTH')) {
|
||||||
$authData = json_decode($composerAuthEnv, true);
|
$authData = json_decode($composerAuthEnv, true);
|
||||||
|
|
||||||
if (is_null($authData)) {
|
if (null === $authData) {
|
||||||
throw new \UnexpectedValueException('COMPOSER_AUTH environment variable is malformed, should be a valid JSON object');
|
throw new \UnexpectedValueException('COMPOSER_AUTH environment variable is malformed, should be a valid JSON object');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,7 +437,7 @@ class Factory
|
||||||
{
|
{
|
||||||
$composer = null;
|
$composer = null;
|
||||||
try {
|
try {
|
||||||
$composer = self::createComposer($io, $config->get('home') . '/composer.json', $disablePlugins, $config->get('home'), $fullLoad);
|
$composer = $this->createComposer($io, $config->get('home') . '/composer.json', $disablePlugins, $config->get('home'), $fullLoad);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$io->writeError('Failed to initialize global composer: '.$e->getMessage(), true, IOInterface::DEBUG);
|
$io->writeError('Failed to initialize global composer: '.$e->getMessage(), true, IOInterface::DEBUG);
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,9 +223,7 @@ class JsonFile
|
||||||
return $json;
|
return $json;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = JsonFormatter::format($json, $unescapeUnicode, $unescapeSlashes);
|
return JsonFormatter::format($json, $unescapeUnicode, $unescapeSlashes);
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -78,7 +78,7 @@ abstract class BaseRepository implements RepositoryInterface
|
||||||
foreach ($links as $link) {
|
foreach ($links as $link) {
|
||||||
foreach ($needles as $needle) {
|
foreach ($needles as $needle) {
|
||||||
if ($link->getTarget() === $needle) {
|
if ($link->getTarget() === $needle) {
|
||||||
if (is_null($constraint) || (($link->getConstraint()->matches($constraint) === !$invert))) {
|
if ($constraint === null || ($link->getConstraint()->matches($constraint) === !$invert)) {
|
||||||
// already displayed this node's dependencies, cutting short
|
// already displayed this node's dependencies, cutting short
|
||||||
if (in_array($link->getSource(), $packagesInTree)) {
|
if (in_array($link->getSource(), $packagesInTree)) {
|
||||||
$results[$link->getSource()] = array($package, $link, false);
|
$results[$link->getSource()] = array($package, $link, false);
|
||||||
|
|
|
@ -158,8 +158,7 @@ class ChannelRest10Reader extends BaseChannelReader
|
||||||
$depthPath = '/r/' . strtolower($packageName) . '/deps.' . $version . '.txt';
|
$depthPath = '/r/' . strtolower($packageName) . '/deps.' . $version . '.txt';
|
||||||
$content = $this->requestContent($baseUrl, $depthPath);
|
$content = $this->requestContent($baseUrl, $depthPath);
|
||||||
$dependencyArray = unserialize($content);
|
$dependencyArray = unserialize($content);
|
||||||
$result = $dependencyReader->buildDependencyInfo($dependencyArray);
|
|
||||||
|
|
||||||
return $result;
|
return $dependencyReader->buildDependencyInfo($dependencyArray);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,10 +216,6 @@ class GitDriver extends VcsDriver
|
||||||
}
|
}
|
||||||
|
|
||||||
$process = new ProcessExecutor($io);
|
$process = new ProcessExecutor($io);
|
||||||
if ($process->execute('git ls-remote --heads ' . ProcessExecutor::escape($url), $output) === 0) {
|
return $process->execute('git ls-remote --heads ' . ProcessExecutor::escape($url), $output) === 0;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,9 +87,7 @@ class PerforceDriver extends VcsDriver
|
||||||
*/
|
*/
|
||||||
public function getBranches()
|
public function getBranches()
|
||||||
{
|
{
|
||||||
$branches = $this->perforce->getBranches();
|
return $this->perforce->getBranches();
|
||||||
|
|
||||||
return $branches;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -97,9 +95,7 @@ class PerforceDriver extends VcsDriver
|
||||||
*/
|
*/
|
||||||
public function getTags()
|
public function getTags()
|
||||||
{
|
{
|
||||||
$tags = $this->perforce->getTags();
|
return $this->perforce->getTags();
|
||||||
|
|
||||||
return $tags;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -116,16 +116,14 @@ class Perforce
|
||||||
|
|
||||||
protected function executeCommand($command)
|
protected function executeCommand($command)
|
||||||
{
|
{
|
||||||
$this->commandResult = "";
|
$this->commandResult = '';
|
||||||
$exit_code = $this->process->execute($command, $this->commandResult);
|
return $this->process->execute($command, $this->commandResult);
|
||||||
|
|
||||||
return $exit_code;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getClient()
|
public function getClient()
|
||||||
{
|
{
|
||||||
if (!isset($this->p4Client)) {
|
if (!isset($this->p4Client)) {
|
||||||
$cleanStreamName = str_replace('@', '', str_replace('/', '_', str_replace('//', '', $this->getStream())));
|
$cleanStreamName = str_replace(array('//', '/', '@'), array('', '_', ''), $this->getStream());
|
||||||
$this->p4Client = 'composer_perforce_' . $this->uniquePerforceClientName . '_' . $cleanStreamName;
|
$this->p4Client = 'composer_perforce_' . $this->uniquePerforceClientName . '_' . $cleanStreamName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,9 +187,7 @@ class Perforce
|
||||||
|
|
||||||
public function getP4ClientSpec()
|
public function getP4ClientSpec()
|
||||||
{
|
{
|
||||||
$p4clientSpec = $this->path . '/' . $this->getClient() . '.p4.spec';
|
return $this->path . '/' . $this->getClient() . '.p4.spec';
|
||||||
|
|
||||||
return $p4clientSpec;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUser()
|
public function getUser()
|
||||||
|
@ -276,8 +272,7 @@ class Perforce
|
||||||
if ($useClient) {
|
if ($useClient) {
|
||||||
$p4Command = $p4Command . '-c ' . $this->getClient() . ' ';
|
$p4Command = $p4Command . '-c ' . $this->getClient() . ' ';
|
||||||
}
|
}
|
||||||
$p4Command = $p4Command . '-p ' . $this->getPort() . ' ';
|
$p4Command = $p4Command . '-p ' . $this->getPort() . ' ' . $command;
|
||||||
$p4Command = $p4Command . $command;
|
|
||||||
|
|
||||||
return $p4Command;
|
return $p4Command;
|
||||||
}
|
}
|
||||||
|
@ -538,9 +533,8 @@ class Perforce
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$fields = explode(' ', $changes);
|
$fields = explode(' ', $changes);
|
||||||
$changeList = $fields[1];
|
|
||||||
|
|
||||||
return $changeList;
|
return $fields[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -562,9 +556,8 @@ class Perforce
|
||||||
$main = substr($fromReference, 0, $index) . '/...';
|
$main = substr($fromReference, 0, $index) . '/...';
|
||||||
$command = $this->generateP4Command('filelog ' . $main . '@' . $fromChangeList. ',' . $toChangeList);
|
$command = $this->generateP4Command('filelog ' . $main . '@' . $fromChangeList. ',' . $toChangeList);
|
||||||
$this->executeCommand($command);
|
$this->executeCommand($command);
|
||||||
$result = $this->commandResult;
|
|
||||||
|
|
||||||
return $result;
|
return $this->commandResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFilesystem()
|
public function getFilesystem()
|
||||||
|
|
|
@ -1031,10 +1031,6 @@ class RemoteFilesystem
|
||||||
// Path for a public download follows this pattern /{user}/{repo}/downloads/{whatever}
|
// Path for a public download follows this pattern /{user}/{repo}/downloads/{whatever}
|
||||||
// {@link https://blog.bitbucket.org/2009/04/12/new-feature-downloads/}
|
// {@link https://blog.bitbucket.org/2009/04/12/new-feature-downloads/}
|
||||||
$pathParts = explode('/', $path);
|
$pathParts = explode('/', $path);
|
||||||
if (count($pathParts) >= 4 && $pathParts[3] == 'downloads') {
|
return count($pathParts) >= 4 && $pathParts[3] == 'downloads';
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ class Silencer
|
||||||
$mask = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT;
|
$mask = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT;
|
||||||
}
|
}
|
||||||
$old = error_reporting();
|
$old = error_reporting();
|
||||||
array_push(self::$stack, $old);
|
self::$stack[] = $old;
|
||||||
error_reporting($old & ~$mask);
|
error_reporting($old & ~$mask);
|
||||||
|
|
||||||
return $old;
|
return $old;
|
||||||
|
|
|
@ -139,7 +139,7 @@ final class StreamContextFactory
|
||||||
$phpVersion = 'PHP ' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
|
$phpVersion = 'PHP ' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($options['http']['header']) || false === strpos(strtolower(implode('', $options['http']['header'])), 'user-agent')) {
|
if (!isset($options['http']['header']) || false === stripos(implode('', $options['http']['header']), 'user-agent')) {
|
||||||
$options['http']['header'][] = sprintf(
|
$options['http']['header'][] = sprintf(
|
||||||
'User-Agent: Composer/%s (%s; %s; %s%s)',
|
'User-Agent: Composer/%s (%s; %s; %s%s)',
|
||||||
Composer::VERSION === '@package_version@' ? 'source' : Composer::VERSION,
|
Composer::VERSION === '@package_version@' ? 'source' : Composer::VERSION,
|
||||||
|
|
|
@ -24,7 +24,7 @@ class ComposerAutoloaderInitFilesAutoload
|
||||||
spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader'));
|
spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader'));
|
||||||
|
|
||||||
$includePaths = require __DIR__ . '/include_paths.php';
|
$includePaths = require __DIR__ . '/include_paths.php';
|
||||||
array_push($includePaths, get_include_path());
|
$includePaths[] = get_include_path();
|
||||||
set_include_path(implode(PATH_SEPARATOR, $includePaths));
|
set_include_path(implode(PATH_SEPARATOR, $includePaths));
|
||||||
|
|
||||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||||
|
|
|
@ -92,9 +92,7 @@ class ArchiveManagerTest extends ArchiverTest
|
||||||
$packageName = $fileName;
|
$packageName = $fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
$target = $this->targetDir.'/'.$packageName.'.'.$format;
|
return $this->targetDir.'/'.$packageName.'.'.$format;
|
||||||
|
|
||||||
return $target;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -126,10 +126,7 @@ class ArrayLoaderTest extends \PHPUnit_Framework_TestCase
|
||||||
'abandoned' => 'foo/bar',
|
'abandoned' => 'foo/bar',
|
||||||
);
|
);
|
||||||
|
|
||||||
$validTestArguments = array($validConfig);
|
return array(array($validConfig));
|
||||||
$argumentsToProvide = array($validTestArguments);
|
|
||||||
|
|
||||||
return $argumentsToProvide;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function fixConfigWhenLoadConfigIsFalse($config)
|
protected function fixConfigWhenLoadConfigIsFalse($config)
|
||||||
|
|
|
@ -54,7 +54,7 @@ class GitHubTest extends \PHPUnit_Framework_TestCase
|
||||||
$this->isFalse(),
|
$this->isFalse(),
|
||||||
$this->anything()
|
$this->anything()
|
||||||
)
|
)
|
||||||
->willReturn(sprintf('{}', $this->token))
|
->willReturn('{}')
|
||||||
;
|
;
|
||||||
|
|
||||||
$config = $this->getConfigMock();
|
$config = $this->getConfigMock();
|
||||||
|
@ -116,9 +116,7 @@ class GitHubTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
private function getConfigMock()
|
private function getConfigMock()
|
||||||
{
|
{
|
||||||
$config = $this->getMock('Composer\Config');
|
return $this->getMock('Composer\Config');
|
||||||
|
|
||||||
return $config;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getRemoteFilesystemMock()
|
private function getRemoteFilesystemMock()
|
||||||
|
|
|
@ -125,9 +125,7 @@ class GitLabTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
private function getConfigMock()
|
private function getConfigMock()
|
||||||
{
|
{
|
||||||
$config = $this->getMock('Composer\Config');
|
return $this->getMock('Composer\Config');
|
||||||
|
|
||||||
return $config;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getRemoteFilesystemMock()
|
private function getRemoteFilesystemMock()
|
||||||
|
|
Loading…
Reference in New Issue