CS fixes
parent
7211eedc36
commit
122e422682
12
.php_cs
12
.php_cs
|
@ -29,18 +29,17 @@ return PhpCsFixer\Config::create()
|
|||
'cast_spaces' => true,
|
||||
'header_comment' => array('header' => $header),
|
||||
'include' => true,
|
||||
'long_array_syntax' => true,
|
||||
'array_syntax' => array('syntax' => 'long'),
|
||||
'method_separation' => true,
|
||||
'no_blank_lines_after_class_opening' => true,
|
||||
'no_blank_lines_after_phpdoc' => true,
|
||||
'no_blank_lines_between_uses' => true,
|
||||
'no_duplicate_semicolons' => true,
|
||||
'no_empty_statement' => true,
|
||||
'no_extra_consecutive_blank_lines' => true,
|
||||
'no_leading_import_slash' => true,
|
||||
'no_leading_namespace_whitespace' => true,
|
||||
'no_trailing_comma_in_singleline_array' => true,
|
||||
'no_unused_imports' => true,
|
||||
'no_whitespace_in_blank_lines' => true,
|
||||
'no_whitespace_in_blank_line' => true,
|
||||
'object_operator_without_whitespace' => true,
|
||||
'phpdoc_align' => true,
|
||||
'phpdoc_indent' => true,
|
||||
|
@ -49,12 +48,13 @@ return PhpCsFixer\Config::create()
|
|||
'phpdoc_order' => true,
|
||||
'phpdoc_scalar' => true,
|
||||
'phpdoc_trim' => true,
|
||||
'phpdoc_type_to_var' => true,
|
||||
'phpdoc_types' => true,
|
||||
'psr0' => true,
|
||||
'single_blank_line_before_namespace' => true,
|
||||
'short_scalar_cast' => true,
|
||||
'standardize_not_equals' => true,
|
||||
'ternary_operator_spaces' => true,
|
||||
'trailing_comma_in_multiline_array' => true,
|
||||
))
|
||||
->finder($finder)
|
||||
->setFinder($finder)
|
||||
;
|
||||
|
|
|
@ -66,7 +66,7 @@ class AutoloadGenerator
|
|||
|
||||
public function setDevMode($devMode = true)
|
||||
{
|
||||
$this->devMode = (boolean) $devMode;
|
||||
$this->devMode = (bool) $devMode;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,7 +77,7 @@ class AutoloadGenerator
|
|||
*/
|
||||
public function setClassMapAuthoritative($classMapAuthoritative)
|
||||
{
|
||||
$this->classMapAuthoritative = (boolean) $classMapAuthoritative;
|
||||
$this->classMapAuthoritative = (bool) $classMapAuthoritative;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -87,7 +87,7 @@ class AutoloadGenerator
|
|||
*/
|
||||
public function setApcu($apcu)
|
||||
{
|
||||
$this->apcu = (boolean) $apcu;
|
||||
$this->apcu = (bool) $apcu;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -97,7 +97,7 @@ class AutoloadGenerator
|
|||
*/
|
||||
public function setRunScripts($runScripts = true)
|
||||
{
|
||||
$this->runScripts = (boolean) $runScripts;
|
||||
$this->runScripts = (bool) $runScripts;
|
||||
}
|
||||
|
||||
public function dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '')
|
||||
|
@ -543,7 +543,7 @@ EOF;
|
|||
|
||||
protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix)
|
||||
{
|
||||
$lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode)-1];
|
||||
$lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode) - 1];
|
||||
if ("'" === $lastChar || '"' === $lastChar) {
|
||||
$vendorPathToTargetDirCode = substr($vendorPathToTargetDirCode, 0, -1).'/autoload_real.php'.$lastChar;
|
||||
} else {
|
||||
|
|
|
@ -46,6 +46,7 @@ class Cache
|
|||
|
||||
if (preg_match('{(^|[\\\\/])(\$null|NUL|/dev/null)([\\\\/]|$)}', $cacheDir)) {
|
||||
$this->enabled = false;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ class ArchiveCommand extends BaseCommand
|
|||
new InputOption('dir', null, InputOption::VALUE_REQUIRED, 'Write the archive to this directory'),
|
||||
new InputOption('file', null, InputOption::VALUE_REQUIRED, 'Write the archive with the given file name.'
|
||||
.' Note that the format will be appended.'),
|
||||
new InputOption('ignore-filters', false, InputOption::VALUE_NONE, 'Ignore filters when saving package')
|
||||
new InputOption('ignore-filters', false, InputOption::VALUE_NONE, 'Ignore filters when saving package'),
|
||||
))
|
||||
->setHelp(<<<EOT
|
||||
The <info>archive</info> command creates an archive of the specified format
|
||||
|
@ -139,7 +139,9 @@ EOT
|
|||
if (count($packages) > 1) {
|
||||
$package = reset($packages);
|
||||
$io->writeError('<info>Found multiple matches, selected '.$package->getPrettyString().'.</info>');
|
||||
$io->writeError('Alternatives were '.implode(', ', array_map(function ($p) { return $p->getPrettyString(); }, $packages)).'.');
|
||||
$io->writeError('Alternatives were '.implode(', ', array_map(function ($p) {
|
||||
return $p->getPrettyString();
|
||||
}, $packages)).'.');
|
||||
$io->writeError('<comment>Please use a more specific constraint to pick a different package.</comment>');
|
||||
} elseif ($packages) {
|
||||
$package = reset($packages);
|
||||
|
|
|
@ -286,19 +286,29 @@ EOT
|
|||
|
||||
$values = $input->getArgument('setting-value'); // what the user is trying to add/change
|
||||
|
||||
$booleanValidator = function ($val) { return in_array($val, array('true', 'false', '1', '0'), true); };
|
||||
$booleanNormalizer = function ($val) { return $val !== 'false' && (bool) $val; };
|
||||
$booleanValidator = function ($val) {
|
||||
return in_array($val, array('true', 'false', '1', '0'), true);
|
||||
};
|
||||
$booleanNormalizer = function ($val) {
|
||||
return $val !== 'false' && (bool) $val;
|
||||
};
|
||||
|
||||
// handle config values
|
||||
$uniqueConfigValues = array(
|
||||
'process-timeout' => array('is_numeric', 'intval'),
|
||||
'use-include-path' => array($booleanValidator, $booleanNormalizer),
|
||||
'preferred-install' => array(
|
||||
function ($val) { return in_array($val, array('auto', 'source', 'dist'), true); },
|
||||
function ($val) { return $val; },
|
||||
function ($val) {
|
||||
return in_array($val, array('auto', 'source', 'dist'), true);
|
||||
},
|
||||
function ($val) {
|
||||
return $val;
|
||||
},
|
||||
),
|
||||
'store-auths' => array(
|
||||
function ($val) { return in_array($val, array('true', 'false', 'prompt'), true); },
|
||||
function ($val) {
|
||||
return in_array($val, array('true', 'false', 'prompt'), true);
|
||||
},
|
||||
function ($val) {
|
||||
if ('prompt' === $val) {
|
||||
return 'prompt';
|
||||
|
@ -308,27 +318,55 @@ EOT
|
|||
},
|
||||
),
|
||||
'notify-on-install' => array($booleanValidator, $booleanNormalizer),
|
||||
'vendor-dir' => array('is_string', function ($val) { return $val; }),
|
||||
'bin-dir' => array('is_string', function ($val) { return $val; }),
|
||||
'archive-dir' => array('is_string', function ($val) { return $val; }),
|
||||
'archive-format' => array('is_string', function ($val) { return $val; }),
|
||||
'data-dir' => array('is_string', function ($val) { return $val; }),
|
||||
'cache-dir' => array('is_string', function ($val) { return $val; }),
|
||||
'cache-files-dir' => array('is_string', function ($val) { return $val; }),
|
||||
'cache-repo-dir' => array('is_string', function ($val) { return $val; }),
|
||||
'cache-vcs-dir' => array('is_string', function ($val) { return $val; }),
|
||||
'vendor-dir' => array('is_string', function ($val) {
|
||||
return $val;
|
||||
}),
|
||||
'bin-dir' => array('is_string', function ($val) {
|
||||
return $val;
|
||||
}),
|
||||
'archive-dir' => array('is_string', function ($val) {
|
||||
return $val;
|
||||
}),
|
||||
'archive-format' => array('is_string', function ($val) {
|
||||
return $val;
|
||||
}),
|
||||
'data-dir' => array('is_string', function ($val) {
|
||||
return $val;
|
||||
}),
|
||||
'cache-dir' => array('is_string', function ($val) {
|
||||
return $val;
|
||||
}),
|
||||
'cache-files-dir' => array('is_string', function ($val) {
|
||||
return $val;
|
||||
}),
|
||||
'cache-repo-dir' => array('is_string', function ($val) {
|
||||
return $val;
|
||||
}),
|
||||
'cache-vcs-dir' => array('is_string', function ($val) {
|
||||
return $val;
|
||||
}),
|
||||
'cache-ttl' => array('is_numeric', 'intval'),
|
||||
'cache-files-ttl' => array('is_numeric', 'intval'),
|
||||
'cache-files-maxsize' => array(
|
||||
function ($val) { return preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $val) > 0; },
|
||||
function ($val) { return $val; },
|
||||
function ($val) {
|
||||
return preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $val) > 0;
|
||||
},
|
||||
function ($val) {
|
||||
return $val;
|
||||
},
|
||||
),
|
||||
'bin-compat' => array(
|
||||
function ($val) { return in_array($val, array('auto', 'full')); },
|
||||
function ($val) { return $val; },
|
||||
function ($val) {
|
||||
return in_array($val, array('auto', 'full'));
|
||||
},
|
||||
function ($val) {
|
||||
return $val;
|
||||
},
|
||||
),
|
||||
'discard-changes' => array(
|
||||
function ($val) { return in_array($val, array('stash', 'true', 'false', '1', '0'), true); },
|
||||
function ($val) {
|
||||
return in_array($val, array('stash', 'true', 'false', '1', '0'), true);
|
||||
},
|
||||
function ($val) {
|
||||
if ('stash' === $val) {
|
||||
return 'stash';
|
||||
|
@ -337,7 +375,9 @@ EOT
|
|||
return $val !== 'false' && (bool) $val;
|
||||
},
|
||||
),
|
||||
'autoloader-suffix' => array('is_string', function ($val) { return $val === 'null' ? null : $val; }),
|
||||
'autoloader-suffix' => array('is_string', function ($val) {
|
||||
return $val === 'null' ? null : $val;
|
||||
}),
|
||||
'sort-packages' => array($booleanValidator, $booleanNormalizer),
|
||||
'optimize-autoloader' => array($booleanValidator, $booleanNormalizer),
|
||||
'classmap-authoritative' => array($booleanValidator, $booleanNormalizer),
|
||||
|
@ -346,12 +386,20 @@ EOT
|
|||
'disable-tls' => array($booleanValidator, $booleanNormalizer),
|
||||
'secure-http' => array($booleanValidator, $booleanNormalizer),
|
||||
'cafile' => array(
|
||||
function ($val) { return file_exists($val) && is_readable($val); },
|
||||
function ($val) { return $val === 'null' ? null : $val; },
|
||||
function ($val) {
|
||||
return file_exists($val) && is_readable($val);
|
||||
},
|
||||
function ($val) {
|
||||
return $val === 'null' ? null : $val;
|
||||
},
|
||||
),
|
||||
'capath' => array(
|
||||
function ($val) { return is_dir($val) && is_readable($val); },
|
||||
function ($val) { return $val === 'null' ? null : $val; },
|
||||
function ($val) {
|
||||
return is_dir($val) && is_readable($val);
|
||||
},
|
||||
function ($val) {
|
||||
return $val === 'null' ? null : $val;
|
||||
},
|
||||
),
|
||||
'github-expose-hostname' => array($booleanValidator, $booleanNormalizer),
|
||||
);
|
||||
|
@ -412,14 +460,28 @@ EOT
|
|||
|
||||
// handle properties
|
||||
$uniqueProps = array(
|
||||
'name' => array('is_string', function ($val) { return $val; }),
|
||||
'type' => array('is_string', function ($val) { return $val; }),
|
||||
'description' => array('is_string', function ($val) { return $val; }),
|
||||
'homepage' => array('is_string', function ($val) { return $val; }),
|
||||
'version' => array('is_string', function ($val) { return $val; }),
|
||||
'name' => array('is_string', function ($val) {
|
||||
return $val;
|
||||
}),
|
||||
'type' => array('is_string', function ($val) {
|
||||
return $val;
|
||||
}),
|
||||
'description' => array('is_string', function ($val) {
|
||||
return $val;
|
||||
}),
|
||||
'homepage' => array('is_string', function ($val) {
|
||||
return $val;
|
||||
}),
|
||||
'version' => array('is_string', function ($val) {
|
||||
return $val;
|
||||
}),
|
||||
'minimum-stability' => array(
|
||||
function ($val) { return isset(BasePackage::$stabilities[VersionParser::normalizeStability($val)]); },
|
||||
function ($val) { return VersionParser::normalizeStability($val); }
|
||||
function ($val) {
|
||||
return isset(BasePackage::$stabilities[VersionParser::normalizeStability($val)]);
|
||||
},
|
||||
function ($val) {
|
||||
return VersionParser::normalizeStability($val);
|
||||
},
|
||||
),
|
||||
'prefer-stable' => array($booleanValidator, $booleanNormalizer),
|
||||
);
|
||||
|
|
|
@ -390,6 +390,7 @@ EOT
|
|||
$io = $this->getIO();
|
||||
if (true === $result) {
|
||||
$io->write('<info>OK</info>');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,9 @@ class ExecCommand extends BaseCommand
|
|||
$binDir = $composer->getConfig()->get('bin-dir');
|
||||
if ($input->getOption('list') || !$input->getArgument('binary')) {
|
||||
$bins = glob($binDir . '/*');
|
||||
$bins = array_merge($bins, array_map(function($e) { return "$e (local)"; }, $composer->getPackage()->getBinaries()));
|
||||
$bins = array_merge($bins, array_map(function ($e) {
|
||||
return "$e (local)";
|
||||
}, $composer->getPackage()->getBinaries()));
|
||||
|
||||
if (!$bins) {
|
||||
throw new \RuntimeException("No binaries found in composer.json or in bin-dir ($binDir)");
|
||||
|
|
|
@ -185,6 +185,7 @@ EOT
|
|||
}
|
||||
|
||||
$io->writeError('Package ' . $packageFilter . ' not found in ' . $options['working-dir'] . '/composer.json');
|
||||
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
|
@ -314,7 +315,6 @@ EOT
|
|||
if ($showVersion) {
|
||||
$versionLength = max($versionLength, strlen($package->getFullPrettyVersion()));
|
||||
if ($showLatest) {
|
||||
|
||||
$latestPackage = $this->findLatestPackage($package, $composer, $phpVersion, $showMinorOnly);
|
||||
if ($latestPackage === false) {
|
||||
continue;
|
||||
|
@ -464,6 +464,7 @@ EOT
|
|||
protected function getRootRequires()
|
||||
{
|
||||
$rootPackage = $this->getComposer()->getPackage();
|
||||
|
||||
return array_map(
|
||||
'strtolower',
|
||||
array_keys(array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()))
|
||||
|
@ -775,7 +776,8 @@ EOT
|
|||
return str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('info', 'highlight', 'comment'), $updateStatus);
|
||||
}
|
||||
|
||||
private function getUpdateStatus(PackageInterface $latestPackage, PackageInterface $package) {
|
||||
private function getUpdateStatus(PackageInterface $latestPackage, PackageInterface $package)
|
||||
{
|
||||
if ($latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion()) {
|
||||
return 'up-to-date';
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ use Composer\Util\ProcessExecutor;
|
|||
*/
|
||||
class StatusCommand extends BaseCommand
|
||||
{
|
||||
|
||||
const EXIT_CODE_ERRORS = 1;
|
||||
const EXIT_CODE_UNPUSHED_CHANGES = 2;
|
||||
const EXIT_CODE_VERSION_CHANGES = 4;
|
||||
|
@ -113,7 +112,7 @@ EOT
|
|||
$vcsVersionChanges[$targetDir] = array(
|
||||
'previous' => array(
|
||||
'version' => $package->getPrettyVersion(),
|
||||
'ref' => $previousRef
|
||||
'ref' => $previousRef,
|
||||
),
|
||||
'current' => array(
|
||||
'version' => $currentVersion['pretty_version'],
|
||||
|
@ -134,6 +133,7 @@ EOT
|
|||
// output errors/warnings
|
||||
if (!$errors && !$unpushedChanges && !$vcsVersionChanges) {
|
||||
$io->writeError('<info>No local changes</info>');
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -416,7 +416,7 @@ class Config
|
|||
{
|
||||
if (isset($this->repositories[$name])) {
|
||||
unset($this->repositories[$name]);
|
||||
} else if ($name === 'packagist') { // BC support for default "packagist" named repo
|
||||
} elseif ($name === 'packagist') { // BC support for default "packagist" named repo
|
||||
unset($this->repositories['packagist.org']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,12 +123,12 @@ class JsonConfigSource implements ConfigSourceInterface
|
|||
if (substr($key, 0, 6) === 'extra.') {
|
||||
$bits = explode('.', $key);
|
||||
$last = array_pop($bits);
|
||||
$arr =& $config['extra'];
|
||||
$arr = &$config['extra'];
|
||||
foreach ($bits as $bit) {
|
||||
if (!isset($arr[$bit])) {
|
||||
$arr[$bit] = array();
|
||||
}
|
||||
$arr =& $arr[$bit];
|
||||
$arr = &$arr[$bit];
|
||||
}
|
||||
$arr[$last] = $val;
|
||||
} else {
|
||||
|
@ -147,12 +147,12 @@ class JsonConfigSource implements ConfigSourceInterface
|
|||
if (substr($key, 0, 6) === 'extra.') {
|
||||
$bits = explode('.', $key);
|
||||
$last = array_pop($bits);
|
||||
$arr =& $config['extra'];
|
||||
$arr = &$config['extra'];
|
||||
foreach ($bits as $bit) {
|
||||
if (!isset($arr[$bit])) {
|
||||
return;
|
||||
}
|
||||
$arr =& $arr[$bit];
|
||||
$arr = &$arr[$bit];
|
||||
}
|
||||
unset($arr[$last]);
|
||||
} else {
|
||||
|
|
|
@ -97,7 +97,8 @@ class Transaction
|
|||
|
||||
protected function transactionFromMaps($installMap, $updateMap, $uninstallMap)
|
||||
{
|
||||
$queue = array_map(function ($operation) {
|
||||
$queue = array_map(
|
||||
function ($operation) {
|
||||
return $operation['package'];
|
||||
},
|
||||
$this->findRootPackages($installMap, $updateMap)
|
||||
|
|
|
@ -97,8 +97,7 @@ class FossilDownloader extends VcsDownloader
|
|||
$match = '/\d\d:\d\d:\d\d\s+\[' . $toReference . '\]/';
|
||||
|
||||
foreach ($this->process->splitLines($output) as $line) {
|
||||
if (preg_match($match, $line))
|
||||
{
|
||||
if (preg_match($match, $line)) {
|
||||
break;
|
||||
}
|
||||
$log .= $line;
|
||||
|
|
|
@ -59,7 +59,8 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
|
|||
$cacheOptions = sprintf('--dissociate --reference %s ', ProcessExecutor::escape($cachePath));
|
||||
$msg = "Cloning ".$this->getShortHash($ref).' from cache';
|
||||
}
|
||||
} catch (\RuntimeException $e) {}
|
||||
} catch (\RuntimeException $e) {
|
||||
}
|
||||
}
|
||||
$command = 'git clone --no-checkout %s %s '.$cacheOptions.'&& cd '.$flag.'%2$s && git remote add composer %1$s && git fetch composer';
|
||||
$this->io->writeError($msg);
|
||||
|
|
|
@ -21,7 +21,6 @@ use Composer\Package\PackageInterface;
|
|||
*/
|
||||
interface VcsCapableDownloaderInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* Gets the VCS Reference for the package at path
|
||||
*
|
||||
|
|
|
@ -356,7 +356,7 @@ class EventDispatcher
|
|||
* Add a listener for a particular event
|
||||
*
|
||||
* @param string $eventName The event name - typically a constant
|
||||
* @param Callable $listener A callable expecting an event argument
|
||||
* @param callable $listener A callable expecting an event argument
|
||||
* @param int $priority A higher value represents a higher priority
|
||||
*/
|
||||
public function addListener($eventName, $listener, $priority = 0)
|
||||
|
|
|
@ -1194,7 +1194,6 @@ class Installer
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param PlatformRepository $platformRepo
|
||||
* @param array $aliases
|
||||
|
@ -1424,7 +1423,7 @@ class Installer
|
|||
*/
|
||||
public function setDryRun($dryRun = true)
|
||||
{
|
||||
$this->dryRun = (boolean) $dryRun;
|
||||
$this->dryRun = (bool) $dryRun;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -1447,7 +1446,7 @@ class Installer
|
|||
*/
|
||||
public function setPreferSource($preferSource = true)
|
||||
{
|
||||
$this->preferSource = (boolean) $preferSource;
|
||||
$this->preferSource = (bool) $preferSource;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -1460,7 +1459,7 @@ class Installer
|
|||
*/
|
||||
public function setPreferDist($preferDist = true)
|
||||
{
|
||||
$this->preferDist = (boolean) $preferDist;
|
||||
$this->preferDist = (bool) $preferDist;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -1473,7 +1472,7 @@ class Installer
|
|||
*/
|
||||
public function setOptimizeAutoloader($optimizeAutoloader = false)
|
||||
{
|
||||
$this->optimizeAutoloader = (boolean) $optimizeAutoloader;
|
||||
$this->optimizeAutoloader = (bool) $optimizeAutoloader;
|
||||
if (!$this->optimizeAutoloader) {
|
||||
// Force classMapAuthoritative off when not optimizing the
|
||||
// autoloader
|
||||
|
@ -1492,7 +1491,7 @@ class Installer
|
|||
*/
|
||||
public function setClassMapAuthoritative($classMapAuthoritative = false)
|
||||
{
|
||||
$this->classMapAuthoritative = (boolean) $classMapAuthoritative;
|
||||
$this->classMapAuthoritative = (bool) $classMapAuthoritative;
|
||||
if ($this->classMapAuthoritative) {
|
||||
// Force optimizeAutoloader when classmap is authoritative
|
||||
$this->setOptimizeAutoloader(true);
|
||||
|
@ -1509,7 +1508,7 @@ class Installer
|
|||
*/
|
||||
public function setApcuAutoloader($apcuAutoloader = false)
|
||||
{
|
||||
$this->apcuAutoloader = (boolean) $apcuAutoloader;
|
||||
$this->apcuAutoloader = (bool) $apcuAutoloader;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -1522,7 +1521,7 @@ class Installer
|
|||
*/
|
||||
public function setUpdate($update = true)
|
||||
{
|
||||
$this->update = (boolean) $update;
|
||||
$this->update = (bool) $update;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -1535,7 +1534,7 @@ class Installer
|
|||
*/
|
||||
public function setDevMode($devMode = true)
|
||||
{
|
||||
$this->devMode = (boolean) $devMode;
|
||||
$this->devMode = (bool) $devMode;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -1550,7 +1549,7 @@ class Installer
|
|||
*/
|
||||
public function setDumpAutoloader($dumpAutoloader = true)
|
||||
{
|
||||
$this->dumpAutoloader = (boolean) $dumpAutoloader;
|
||||
$this->dumpAutoloader = (bool) $dumpAutoloader;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -1565,7 +1564,7 @@ class Installer
|
|||
*/
|
||||
public function setRunScripts($runScripts = true)
|
||||
{
|
||||
$this->runScripts = (boolean) $runScripts;
|
||||
$this->runScripts = (bool) $runScripts;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -1591,7 +1590,7 @@ class Installer
|
|||
*/
|
||||
public function setVerbose($verbose = true)
|
||||
{
|
||||
$this->verbose = (boolean) $verbose;
|
||||
$this->verbose = (bool) $verbose;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -1614,7 +1613,7 @@ class Installer
|
|||
*/
|
||||
public function setIgnorePlatformRequirements($ignorePlatformReqs = false)
|
||||
{
|
||||
$this->ignorePlatformReqs = (boolean) $ignorePlatformReqs;
|
||||
$this->ignorePlatformReqs = (bool) $ignorePlatformReqs;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -1641,7 +1640,7 @@ class Installer
|
|||
*/
|
||||
public function setWhitelistDependencies($updateDependencies = true)
|
||||
{
|
||||
$this->whitelistDependencies = (boolean) $updateDependencies;
|
||||
$this->whitelistDependencies = (bool) $updateDependencies;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -1654,7 +1653,7 @@ class Installer
|
|||
*/
|
||||
public function setPreferStable($preferStable = true)
|
||||
{
|
||||
$this->preferStable = (boolean) $preferStable;
|
||||
$this->preferStable = (bool) $preferStable;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -1667,7 +1666,7 @@ class Installer
|
|||
*/
|
||||
public function setPreferLowest($preferLowest = true)
|
||||
{
|
||||
$this->preferLowest = (boolean) $preferLowest;
|
||||
$this->preferLowest = (bool) $preferLowest;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -1682,7 +1681,7 @@ class Installer
|
|||
*/
|
||||
public function setWriteLock($writeLock = true)
|
||||
{
|
||||
$this->writeLock = (boolean) $writeLock;
|
||||
$this->writeLock = (bool) $writeLock;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -1697,7 +1696,7 @@ class Installer
|
|||
*/
|
||||
public function setExecuteOperations($executeOperations = true)
|
||||
{
|
||||
$this->executeOperations = (boolean) $executeOperations;
|
||||
$this->executeOperations = (bool) $executeOperations;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -1710,7 +1709,7 @@ class Installer
|
|||
*/
|
||||
public function setSkipSuggest($skipSuggest = true)
|
||||
{
|
||||
$this->skipSuggest = (boolean) $skipSuggest;
|
||||
$this->skipSuggest = (bool) $skipSuggest;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ class ArchivableFilesFilter extends FilterIterator
|
|||
{
|
||||
$file = $this->getInnerIterator()->current();
|
||||
if ($file->isDir()) {
|
||||
$this->dirs[] = (string)$file;
|
||||
$this->dirs[] = (string) $file;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class ArchivableFilesFinder extends \FilterIterator
|
|||
*
|
||||
* @param string $sources Path to source files to be archived
|
||||
* @param array $excludes Composer's own exclude rules from composer.json
|
||||
* @param boolean $ignoreFilters Ignore filters when looking for files
|
||||
* @param bool $ignoreFilters Ignore filters when looking for files
|
||||
*/
|
||||
public function __construct($sources, array $excludes, $ignoreFilters = false)
|
||||
{
|
||||
|
|
|
@ -99,7 +99,7 @@ class ArchiveManager
|
|||
* @param string $targetDir The directory where to build the archive
|
||||
* @param string|null $fileName The relative file name to use for the archive, or null to generate
|
||||
* the package name. Note that the format will be appended to this name
|
||||
* @param boolean $ignoreFilters Ignore filters when looking for files in the package
|
||||
* @param bool $ignoreFilters Ignore filters when looking for files in the package
|
||||
* @throws \InvalidArgumentException
|
||||
* @throws \RuntimeException
|
||||
* @return string The path of the created archive
|
||||
|
|
|
@ -176,7 +176,7 @@ class CompletePackage extends Package implements CompletePackageInterface
|
|||
*/
|
||||
public function isAbandoned()
|
||||
{
|
||||
return (boolean) $this->abandoned;
|
||||
return (bool) $this->abandoned;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -56,7 +56,7 @@ abstract class BitbucketDriver extends VcsDriver
|
|||
$this->config->get('cache-repo-dir'),
|
||||
$this->originUrl,
|
||||
$this->owner,
|
||||
$this->repository
|
||||
$this->repository,
|
||||
))
|
||||
);
|
||||
}
|
||||
|
@ -104,6 +104,7 @@ abstract class BitbucketDriver extends VcsDriver
|
|||
$this->homeUrl = $repoData['links']['html']['href'];
|
||||
$this->website = $repoData['website'];
|
||||
$this->vcsType = $repoData['scm'];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -268,7 +269,7 @@ abstract class BitbucketDriver extends VcsDriver
|
|||
array(
|
||||
'pagelen' => 100,
|
||||
'fields' => 'values.name,values.target.hash,next',
|
||||
'sort' => '-target.date'
|
||||
'sort' => '-target.date',
|
||||
),
|
||||
null,
|
||||
'&'
|
||||
|
@ -312,7 +313,7 @@ abstract class BitbucketDriver extends VcsDriver
|
|||
array(
|
||||
'pagelen' => 100,
|
||||
'fields' => 'values.name,values.target.hash,next',
|
||||
'sort' => '-target.date'
|
||||
'sort' => '-target.date',
|
||||
),
|
||||
null,
|
||||
'&'
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
namespace Composer\Repository\Vcs;
|
||||
|
||||
use Composer\Config;
|
||||
use Composer\Json\JsonFile;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
use Composer\Util\Filesystem;
|
||||
use Composer\IO\IOInterface;
|
||||
|
@ -142,6 +141,7 @@ class FossilDriver extends VcsDriver
|
|||
public function getChangeDate($identifier)
|
||||
{
|
||||
$this->process->execute(sprintf('fossil finfo composer.json | head -n 2 | tail -n 1 | awk \'{print $1}\''), $output, $this->checkoutDir);
|
||||
|
||||
return new \DateTime(trim($output), new \DateTimeZone('UTC'));
|
||||
}
|
||||
|
||||
|
@ -194,8 +194,7 @@ class FossilDriver extends VcsDriver
|
|||
return true;
|
||||
}
|
||||
|
||||
if (preg_match('!/fossil/|\.fossil!', $url))
|
||||
{
|
||||
if (preg_match('!/fossil/|\.fossil!', $url)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
namespace Composer\Repository\Vcs;
|
||||
|
||||
use Composer\Json\JsonFile;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
use Composer\Util\Filesystem;
|
||||
use Composer\Util\Git as GitUtil;
|
||||
|
@ -143,6 +142,7 @@ class GitDriver extends VcsDriver
|
|||
'git log -1 --format=%%at %s',
|
||||
ProcessExecutor::escape($identifier)
|
||||
), $output, $this->repoDir);
|
||||
|
||||
return new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
|
||||
}
|
||||
|
||||
|
|
|
@ -186,7 +186,6 @@ class GitHubDriver extends VcsDriver
|
|||
$notFoundRetries = 2;
|
||||
while ($notFoundRetries) {
|
||||
try {
|
||||
|
||||
$resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/' . $file . '?ref='.urlencode($identifier);
|
||||
$resource = JsonFile::parseJson($this->getContents($resource));
|
||||
if (empty($resource['content']) || $resource['encoding'] !== 'base64' || !($content = base64_decode($resource['content']))) {
|
||||
|
@ -202,6 +201,7 @@ class GitHubDriver extends VcsDriver
|
|||
// TODO should be removed when possible
|
||||
// retry fetching if github returns a 404 since they happen randomly
|
||||
$notFoundRetries--;
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -220,6 +220,7 @@ class GitHubDriver extends VcsDriver
|
|||
|
||||
$resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier);
|
||||
$commit = JsonFile::parseJson($this->getContents($resource), $resource);
|
||||
|
||||
return new \DateTime($commit['commit']['committer']['date']);
|
||||
}
|
||||
|
||||
|
|
|
@ -127,6 +127,7 @@ class GitLabDriver extends VcsDriver
|
|||
if ($e->getCode() !== 404) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -149,7 +150,6 @@ class GitLabDriver extends VcsDriver
|
|||
return new \DateTime();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -260,6 +260,7 @@ class GitLabDriver extends VcsDriver
|
|||
}
|
||||
$encoded .= $character;
|
||||
}
|
||||
|
||||
return $encoded;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
namespace Composer\Repository\Vcs;
|
||||
|
||||
use Composer\Config;
|
||||
use Composer\Json\JsonFile;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
use Composer\Util\Filesystem;
|
||||
use Composer\IO\IOInterface;
|
||||
|
@ -142,6 +141,7 @@ class HgDriver extends VcsDriver
|
|||
$output,
|
||||
$this->repoDir
|
||||
);
|
||||
|
||||
return new \DateTime(trim($output), new \DateTimeZone('UTC'));
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ class PerforceDriver extends VcsDriver
|
|||
protected $branch;
|
||||
/** @var Perforce */
|
||||
protected $perforce;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -57,7 +58,6 @@ class PerforceDriver extends VcsDriver
|
|||
$this->perforce = Perforce::create($repoConfig, $this->getUrl(), $repoDir, $this->process, $this->io);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -132,7 +132,6 @@ class SvnDriver extends VcsDriver
|
|||
$this->infoCache[$identifier] = $composer;
|
||||
}
|
||||
|
||||
|
||||
return $this->infoCache[$identifier];
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ abstract class VcsDriver implements VcsDriverInterface
|
|||
* Returns whether or not the given $identifier should be cached or not.
|
||||
*
|
||||
* @param string $identifier
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
protected function shouldCache($identifier)
|
||||
{
|
||||
|
@ -102,7 +102,6 @@ abstract class VcsDriver implements VcsDriverInterface
|
|||
$this->infoCache[$identifier] = $composer;
|
||||
}
|
||||
|
||||
|
||||
return $this->infoCache[$identifier];
|
||||
}
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ class Bitbucket
|
|||
if (!isset($this->token['access_token'])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->token['access_token'];
|
||||
}
|
||||
|
||||
|
@ -213,7 +214,7 @@ class Bitbucket
|
|||
"consumer-key" => $consumerKey,
|
||||
"consumer-secret" => $consumerSecret,
|
||||
"access-token" => $this->token['access_token'],
|
||||
"access-token-expiration" => $time + $this->token['expires_in']
|
||||
"access-token-expiration" => $time + $this->token['expires_in'],
|
||||
);
|
||||
|
||||
$this->config->getAuthConfigSource()->addConfigSetting('bitbucket-oauth.'.$originUrl, $consumer);
|
||||
|
@ -236,7 +237,7 @@ class Bitbucket
|
|||
}
|
||||
|
||||
$this->token = array(
|
||||
'access_token' => $authConfig[$originUrl]['access-token']
|
||||
'access_token' => $authConfig[$originUrl]['access-token'],
|
||||
);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -165,7 +165,7 @@ class Git
|
|||
$defaultUsername = null;
|
||||
if (isset($authParts) && $authParts) {
|
||||
if (false !== strpos($authParts, ':')) {
|
||||
list($defaultUsername,) = explode(':', $authParts, 2);
|
||||
list($defaultUsername, ) = explode(':', $authParts, 2);
|
||||
} else {
|
||||
$defaultUsername = $authParts;
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ class Git
|
|||
'fatal: Authentication failed',
|
||||
'remote error: Invalid username or password.',
|
||||
'error: 401 Unauthorized',
|
||||
'fatal: unable to access'
|
||||
'fatal: unable to access',
|
||||
);
|
||||
|
||||
foreach ($authFailures as $authFailure) {
|
||||
|
|
|
@ -441,6 +441,7 @@ class Perforce
|
|||
if ($index3 !== false) {
|
||||
$phrase = trim(substr($result, $index3));
|
||||
$fields = explode(' ', $phrase);
|
||||
|
||||
return substr($identifier, 0, $index) . '/' . $file . '@' . $fields[1];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,18 +30,20 @@ class Platform
|
|||
if (preg_match('#^~[\\/]#', $path)) {
|
||||
return self::getUserDirectory() . substr($path, 1);
|
||||
}
|
||||
return preg_replace_callback('#^(\$|(?P<percent>%))(?P<var>\w++)(?(percent)%)(?P<path>.*)#', function($matches) {
|
||||
|
||||
return preg_replace_callback('#^(\$|(?P<percent>%))(?P<var>\w++)(?(percent)%)(?P<path>.*)#', function ($matches) {
|
||||
// Treat HOME as an alias for USERPROFILE on Windows for legacy reasons
|
||||
if (Platform::isWindows() && $matches['var'] == 'HOME') {
|
||||
return (getenv('HOME') ?: getenv('USERPROFILE')) . $matches['path'];
|
||||
}
|
||||
|
||||
return getenv($matches['var']) . $matches['path'];
|
||||
}, $path);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string The formal user home as detected from environment parameters
|
||||
* @throws \RuntimeException If the user home could not reliably be determined
|
||||
* @return string The formal user home as detected from environment parameters
|
||||
*/
|
||||
public static function getUserDirectory()
|
||||
{
|
||||
|
@ -55,6 +57,7 @@ class Platform
|
|||
|
||||
if (function_exists('posix_getuid') && function_exists('posix_getpwuid')) {
|
||||
$info = posix_getpwuid(posix_getuid());
|
||||
|
||||
return $info['dir'];
|
||||
}
|
||||
|
||||
|
|
|
@ -721,8 +721,7 @@ class RemoteFilesystem
|
|||
} elseif ($this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
|
||||
if ($auth['password'] === 'oauth2') {
|
||||
$headers[] = 'Authorization: Bearer '.$auth['username'];
|
||||
}
|
||||
else if ($auth['password'] === 'private-token') {
|
||||
} elseif ($auth['password'] === 'private-token') {
|
||||
$headers[] = 'PRIVATE-TOKEN: '.$auth['username'];
|
||||
}
|
||||
} elseif ('bitbucket.org' === $originUrl
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
namespace Composer\Util;
|
||||
|
||||
use Symfony\Component\Process\PhpProcess;
|
||||
use Composer\CaBundle\CaBundle;
|
||||
|
||||
/**
|
||||
|
|
|
@ -67,6 +67,7 @@ class XdebugHandler
|
|||
$command = $this->getCommand();
|
||||
$this->restart($command);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -249,7 +250,7 @@ class XdebugHandler
|
|||
}
|
||||
|
||||
if ($this->output->isDecorated()) {
|
||||
$offset = count($args) > 1 ? 2: 1;
|
||||
$offset = count($args) > 1 ? 2 : 1;
|
||||
array_splice($args, $offset, 0, '--ansi');
|
||||
}
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ class AllFunctionalTest extends TestCase
|
|||
break;
|
||||
|
||||
case 'EXPECT-EXIT-CODE':
|
||||
$sectionData = (integer) $sectionData;
|
||||
$sectionData = (int) $sectionData;
|
||||
break;
|
||||
|
||||
case 'EXPECT':
|
||||
|
|
|
@ -17,7 +17,10 @@ use Composer\Util\Filesystem;
|
|||
|
||||
class CacheTest extends TestCase
|
||||
{
|
||||
private $files, $root, $finder, $cache;
|
||||
private $files;
|
||||
private $root;
|
||||
private $finder;
|
||||
private $cache;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
|
|
|
@ -17,7 +17,6 @@ use Composer\TestCase;
|
|||
|
||||
class InitCommandTest extends TestCase
|
||||
{
|
||||
|
||||
public function testParseValidAuthorString()
|
||||
{
|
||||
$command = new InitCommand;
|
||||
|
@ -51,7 +50,7 @@ class InitCommandTest extends TestCase
|
|||
$command = new InitCommand;
|
||||
$author = $command->parseAuthorString(
|
||||
'Johnathon "Johnny" Smith <john@example.com>');
|
||||
$this->assertEquals('Johnathon "Johnny" Smith', $author['name'] );
|
||||
$this->assertEquals('Johnathon "Johnny" Smith', $author['name']);
|
||||
$this->assertEquals('john@example.com', $author['email']);
|
||||
}
|
||||
|
||||
|
@ -64,7 +63,7 @@ class InitCommandTest extends TestCase
|
|||
$command = new InitCommand;
|
||||
$author = $command->parseAuthorString(
|
||||
'Johnathon (Johnny) Smith <john@example.com>');
|
||||
$this->assertEquals('Johnathon (Johnny) Smith', $author['name'] );
|
||||
$this->assertEquals('Johnathon (Johnny) Smith', $author['name']);
|
||||
$this->assertEquals('john@example.com', $author['email']);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ use Composer\TestCase;
|
|||
|
||||
class RunScriptCommandTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @dataProvider getDevOptions
|
||||
* @param bool $dev
|
||||
|
@ -79,7 +78,7 @@ class RunScriptCommandTest extends TestCase
|
|||
'getSynopsis',
|
||||
'initialize',
|
||||
'isInteractive',
|
||||
'getComposer'
|
||||
'getComposer',
|
||||
))
|
||||
->getMock();
|
||||
$command->expects($this->any())->method('getComposer')->willReturn($composer);
|
||||
|
|
|
@ -261,7 +261,9 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
|
|||
'ssh://[user@]host.xz[:port]/path/to/repo.git/',
|
||||
);
|
||||
|
||||
return array_combine($urls, array_map(function ($e) { return array($e); }, $urls));
|
||||
return array_combine($urls, array_map(function ($e) {
|
||||
return array($e);
|
||||
}, $urls));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -280,7 +282,9 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
|
|||
'git://5.6.7.8/git.git',
|
||||
);
|
||||
|
||||
return array_combine($urls, array_map(function ($e) { return array($e); }, $urls));
|
||||
return array_combine($urls, array_map(function ($e) {
|
||||
return array($e);
|
||||
}, $urls));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -57,7 +57,7 @@ class RuleSetTest extends TestCase
|
|||
new GenericRule(array(), Rule::RULE_JOB_INSTALL, null),
|
||||
new GenericRule(array(), Rule::RULE_JOB_INSTALL, null),
|
||||
new GenericRule(array(), Rule::RULE_JOB_INSTALL, null),
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
$ruleSet = new RuleSet;
|
||||
|
|
|
@ -45,7 +45,8 @@ class GitDownloaderTest extends TestCase
|
|||
$refl->setValue(null, null);
|
||||
}
|
||||
|
||||
protected function setupConfig($config = null) {
|
||||
protected function setupConfig($config = null)
|
||||
{
|
||||
if (!$config) {
|
||||
$config = new Config();
|
||||
}
|
||||
|
@ -53,6 +54,7 @@ class GitDownloaderTest extends TestCase
|
|||
$tmpDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'cmptest-'.md5(uniqid('', true));
|
||||
$config->merge(array('config' => array('home' => $tmpDir)));
|
||||
}
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
|
@ -100,8 +102,9 @@ class GitDownloaderTest extends TestCase
|
|||
$processExecutor->expects($this->at(0))
|
||||
->method('execute')
|
||||
->with($this->equalTo($this->winCompat('git --version')))
|
||||
->will($this->returnCallback(function($command, &$output = null) {
|
||||
->will($this->returnCallback(function ($command, &$output = null) {
|
||||
$output = 'git version 1.0.0';
|
||||
|
||||
return 0;
|
||||
}));
|
||||
|
||||
|
@ -150,8 +153,9 @@ class GitDownloaderTest extends TestCase
|
|||
$processExecutor->expects($this->at(0))
|
||||
->method('execute')
|
||||
->with($this->equalTo($this->winCompat('git --version')))
|
||||
->will($this->returnCallback(function($command, &$output = null) {
|
||||
->will($this->returnCallback(function ($command, &$output = null) {
|
||||
$output = 'git version 2.3.1';
|
||||
|
||||
return 0;
|
||||
}));
|
||||
|
||||
|
@ -215,8 +219,9 @@ class GitDownloaderTest extends TestCase
|
|||
$processExecutor->expects($this->at(0))
|
||||
->method('execute')
|
||||
->with($this->equalTo($this->winCompat('git --version')))
|
||||
->will($this->returnCallback(function($command, &$output = null) {
|
||||
->will($this->returnCallback(function ($command, &$output = null) {
|
||||
$output = 'git version 1.0.0';
|
||||
|
||||
return 0;
|
||||
}));
|
||||
|
||||
|
@ -298,8 +303,9 @@ class GitDownloaderTest extends TestCase
|
|||
$processExecutor->expects($this->at(0))
|
||||
->method('execute')
|
||||
->with($this->equalTo($this->winCompat('git --version')))
|
||||
->will($this->returnCallback(function($command, &$output = null) {
|
||||
->will($this->returnCallback(function ($command, &$output = null) {
|
||||
$output = 'git version 1.0.0';
|
||||
|
||||
return 0;
|
||||
}));
|
||||
|
||||
|
@ -343,8 +349,9 @@ class GitDownloaderTest extends TestCase
|
|||
$processExecutor->expects($this->at(0))
|
||||
->method('execute')
|
||||
->with($this->equalTo($this->winCompat('git --version')))
|
||||
->will($this->returnCallback(function($command, &$output = null) {
|
||||
->will($this->returnCallback(function ($command, &$output = null) {
|
||||
$output = 'git version 1.0.0';
|
||||
|
||||
return 0;
|
||||
}));
|
||||
$processExecutor->expects($this->at(1))
|
||||
|
@ -455,6 +462,7 @@ origin https://github.com/old/url (push)
|
|||
composer https://github.com/old/url (fetch)
|
||||
composer https://github.com/old/url (push)
|
||||
';
|
||||
|
||||
return 0;
|
||||
}));
|
||||
$processExecutor->expects($this->at(3))
|
||||
|
|
|
@ -2266,7 +2266,6 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals('{
|
||||
}
|
||||
', $manipulator->getContents());
|
||||
|
||||
}
|
||||
|
||||
public function testIndentDetection()
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
|
@ -25,7 +26,7 @@ class XdebugHandlerMock extends XdebugHandler
|
|||
$this->output = Factory::createOutput();
|
||||
parent::__construct($this->output);
|
||||
|
||||
$loaded = null === $loaded ? true: $loaded;
|
||||
$loaded = null === $loaded ? true : $loaded;
|
||||
$class = new \ReflectionClass(get_parent_class($this));
|
||||
|
||||
$prop = $class->getProperty('loaded');
|
||||
|
|
|
@ -136,6 +136,7 @@ class ArrayLoaderTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$expectedConfig = $config;
|
||||
unset($expectedConfig['transport-options']);
|
||||
|
||||
return $expectedConfig;
|
||||
}
|
||||
|
||||
|
|
|
@ -178,9 +178,9 @@ class ComposerRepositoryTest extends TestCase
|
|||
'results' => array(
|
||||
array(
|
||||
'name' => 'foo',
|
||||
'description' => null
|
||||
)
|
||||
)
|
||||
'description' => null,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$rfs = $this->getMockBuilder('Composer\Util\RemoteFilesystem')
|
||||
|
|
|
@ -109,32 +109,32 @@ class GitBitbucketDriverTest extends TestCase
|
|||
array(
|
||||
$this->originUrl,
|
||||
'https://api.bitbucket.org/2.0/repositories/user/repo?fields=-project%2C-owner',
|
||||
false
|
||||
false,
|
||||
),
|
||||
array(
|
||||
$this->originUrl,
|
||||
'https://api.bitbucket.org/1.0/repositories/user/repo/main-branch',
|
||||
false
|
||||
false,
|
||||
),
|
||||
array(
|
||||
$this->originUrl,
|
||||
'https://api.bitbucket.org/2.0/repositories/user/repo/refs/tags?pagelen=100&fields=values.name%2Cvalues.target.hash%2Cnext&sort=-target.date',
|
||||
false
|
||||
false,
|
||||
),
|
||||
array(
|
||||
$this->originUrl,
|
||||
'https://api.bitbucket.org/2.0/repositories/user/repo/refs/branches?pagelen=100&fields=values.name%2Cvalues.target.hash%2Cnext&sort=-target.date',
|
||||
false
|
||||
false,
|
||||
),
|
||||
array(
|
||||
$this->originUrl,
|
||||
'https://api.bitbucket.org/1.0/repositories/user/repo/raw/master/composer.json',
|
||||
false
|
||||
false,
|
||||
),
|
||||
array(
|
||||
$this->originUrl,
|
||||
'https://api.bitbucket.org/2.0/repositories/user/repo/commit/master?fields=date',
|
||||
false
|
||||
false,
|
||||
)
|
||||
)
|
||||
->willReturnOnConsecutiveCalls(
|
||||
|
@ -154,14 +154,14 @@ class GitBitbucketDriverTest extends TestCase
|
|||
$this->assertEquals(
|
||||
array(
|
||||
'1.0.1' => '9b78a3932143497c519e49b8241083838c8ff8a1',
|
||||
'1.0.0' => 'd3393d514318a9267d2f8ebbf463a9aaa389f8eb'
|
||||
'1.0.0' => 'd3393d514318a9267d2f8ebbf463a9aaa389f8eb',
|
||||
),
|
||||
$driver->getTags()
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
array(
|
||||
'master' => '937992d19d72b5116c3e8c4a04f960e5fa270b22'
|
||||
'master' => '937992d19d72b5116c3e8c4a04f960e5fa270b22',
|
||||
),
|
||||
$driver->getBranches()
|
||||
);
|
||||
|
@ -174,20 +174,20 @@ class GitBitbucketDriverTest extends TestCase
|
|||
'authors' => array(
|
||||
array(
|
||||
'name' => 'Name',
|
||||
'email' => 'local@domain.tld'
|
||||
)
|
||||
'email' => 'local@domain.tld',
|
||||
),
|
||||
),
|
||||
'require' => array(
|
||||
'creator/package' => '^1.0'
|
||||
'creator/package' => '^1.0',
|
||||
),
|
||||
'require-dev' => array(
|
||||
'phpunit/phpunit' => '~4.8'
|
||||
'phpunit/phpunit' => '~4.8',
|
||||
),
|
||||
'time' => '2016-05-17 13:19:52',
|
||||
'support' => array(
|
||||
'source' => 'https://bitbucket.org/user/repo/src/937992d19d72b5116c3e8c4a04f960e5fa270b22/?at=master'
|
||||
'source' => 'https://bitbucket.org/user/repo/src/937992d19d72b5116c3e8c4a04f960e5fa270b22/?at=master',
|
||||
),
|
||||
'homepage' => 'https://bitbucket.org/user/repo'
|
||||
'homepage' => 'https://bitbucket.org/user/repo',
|
||||
),
|
||||
$driver->getComposerInformation('master')
|
||||
);
|
||||
|
@ -210,7 +210,7 @@ class GitBitbucketDriverTest extends TestCase
|
|||
'type' => 'zip',
|
||||
'url' => 'https://bitbucket.org/user/repo/get/reference.zip',
|
||||
'reference' => 'reference',
|
||||
'shasum' => ''
|
||||
'shasum' => '',
|
||||
),
|
||||
$driver->getDist('reference')
|
||||
);
|
||||
|
|
|
@ -19,7 +19,6 @@ use Composer\Config;
|
|||
|
||||
class HgDriverTest extends TestCase
|
||||
{
|
||||
|
||||
/** @type \Composer\IO\IOInterface|\PHPUnit_Framework_MockObject_MockObject */
|
||||
private $io;
|
||||
/** @type Config */
|
||||
|
@ -65,5 +64,4 @@ class HgDriverTest extends TestCase
|
|||
array('https://user@bitbucket.org/user/repo'),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ class BitbucketTest extends \PHPUnit_Framework_TestCase
|
|||
'http' => array(
|
||||
'method' => 'POST',
|
||||
'content' => 'grant_type=client_credentials',
|
||||
)
|
||||
),
|
||||
)
|
||||
)
|
||||
->willReturn(
|
||||
|
@ -110,8 +110,8 @@ class BitbucketTest extends \PHPUnit_Framework_TestCase
|
|||
'access-token' => $this->token,
|
||||
'access-token-expiration' => $this->time + 1800,
|
||||
'consumer-key' => $this->consumer_key,
|
||||
'consumer-secret' => $this->consumer_secret
|
||||
)
|
||||
'consumer-secret' => $this->consumer_secret,
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -132,8 +132,8 @@ class BitbucketTest extends \PHPUnit_Framework_TestCase
|
|||
'access-token' => 'randomExpiredToken',
|
||||
'access-token-expiration' => $this->time - 400,
|
||||
'consumer-key' => $this->consumer_key,
|
||||
'consumer-secret' => $this->consumer_secret
|
||||
)
|
||||
'consumer-secret' => $this->consumer_secret,
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -152,7 +152,7 @@ class BitbucketTest extends \PHPUnit_Framework_TestCase
|
|||
'http' => array(
|
||||
'method' => 'POST',
|
||||
'content' => 'grant_type=client_credentials',
|
||||
)
|
||||
),
|
||||
)
|
||||
)
|
||||
->willReturn(
|
||||
|
@ -196,7 +196,7 @@ class BitbucketTest extends \PHPUnit_Framework_TestCase
|
|||
'http' => array(
|
||||
'method' => 'POST',
|
||||
'content' => 'grant_type=client_credentials',
|
||||
)
|
||||
),
|
||||
)
|
||||
)
|
||||
->willThrowException(
|
||||
|
@ -279,7 +279,7 @@ class BitbucketTest extends \PHPUnit_Framework_TestCase
|
|||
"consumer-key" => $this->consumer_key,
|
||||
"consumer-secret" => $this->consumer_secret,
|
||||
"access-token" => $this->token,
|
||||
"access-token-expiration" => $this->time + 3600
|
||||
"access-token-expiration" => $this->time + 3600,
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -257,10 +257,9 @@ class RemoteFilesystemTest extends \PHPUnit_Framework_TestCase
|
|||
->willReturn(array(
|
||||
'username' => 'x-token-auth',
|
||||
// This token is fake, but it matches a valid token's pattern.
|
||||
'password' => '1A0yeK5Po3ZEeiiRiMWLivS0jirLdoGuaSGq9NvESFx1Fsdn493wUDXC8rz_1iKVRTl1GINHEUCsDxGh5lZ='
|
||||
'password' => '1A0yeK5Po3ZEeiiRiMWLivS0jirLdoGuaSGq9NvESFx1Fsdn493wUDXC8rz_1iKVRTl1GINHEUCsDxGh5lZ=',
|
||||
));
|
||||
|
||||
|
||||
$rfs = new RemoteFilesystem($io, $config);
|
||||
$hostname = parse_url($url, PHP_URL_HOST);
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
|
|
|
@ -56,7 +56,8 @@ class StreamContextFactoryTest extends \PHPUnit_Framework_TestCase
|
|||
),
|
||||
array(
|
||||
$a = array('http' => array('method' => 'GET', 'max_redirects' => 20, 'follow_location' => 1, 'header' => array('User-Agent: foo'))), array('http' => array('method' => 'GET', 'header' => 'User-Agent: foo')),
|
||||
array('options' => $a, 'notification' => $f = function () {}), array('notification' => $f),
|
||||
array('options' => $a, 'notification' => $f = function () {
|
||||
}), array('notification' => $f),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue