Strict typing fixes
parent
f25446e507
commit
29312be4df
|
@ -41,8 +41,8 @@ class ArchiveCommand extends Command
|
||||||
new InputArgument('package', InputArgument::OPTIONAL, 'The package to archive instead of the current project'),
|
new InputArgument('package', InputArgument::OPTIONAL, 'The package to archive instead of the current project'),
|
||||||
new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'),
|
new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'),
|
||||||
new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the resulting archive: tar or zip'),
|
new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the resulting archive: tar or zip'),
|
||||||
new InputOption('dir', false, InputOption::VALUE_REQUIRED, 'Write the archive to this directory'),
|
new InputOption('dir', null, InputOption::VALUE_REQUIRED, 'Write the archive to this directory'),
|
||||||
new InputOption('file', false, InputOption::VALUE_REQUIRED, 'Write the archive with the given file name.'
|
new InputOption('file', null, InputOption::VALUE_REQUIRED, 'Write the archive with the given file name.'
|
||||||
.' Note that the format will be appended.'),
|
.' Note that the format will be appended.'),
|
||||||
))
|
))
|
||||||
->setHelp(<<<EOT
|
->setHelp(<<<EOT
|
||||||
|
|
|
@ -112,6 +112,7 @@ EOT
|
||||||
return $this->installProject(
|
return $this->installProject(
|
||||||
$io,
|
$io,
|
||||||
$config,
|
$config,
|
||||||
|
$input,
|
||||||
$input->getArgument('package'),
|
$input->getArgument('package'),
|
||||||
$input->getArgument('directory'),
|
$input->getArgument('directory'),
|
||||||
$input->getArgument('version'),
|
$input->getArgument('version'),
|
||||||
|
@ -125,12 +126,11 @@ EOT
|
||||||
$input->getOption('keep-vcs'),
|
$input->getOption('keep-vcs'),
|
||||||
$input->getOption('no-progress'),
|
$input->getOption('no-progress'),
|
||||||
$input->getOption('no-install'),
|
$input->getOption('no-install'),
|
||||||
$input->getOption('ignore-platform-reqs'),
|
$input->getOption('ignore-platform-reqs')
|
||||||
$input
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function installProject(IOInterface $io, Config $config, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repositoryUrl = null, $disablePlugins = false, $noScripts = false, $keepVcs = false, $noProgress = false, $noInstall = false, $ignorePlatformReqs = false, InputInterface $input)
|
public function installProject(IOInterface $io, Config $config, InputInterface $input, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repositoryUrl = null, $disablePlugins = false, $noScripts = false, $keepVcs = false, $noProgress = false, $noInstall = false, $ignorePlatformReqs = false)
|
||||||
{
|
{
|
||||||
$oldCwd = getcwd();
|
$oldCwd = getcwd();
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,7 @@ EOT
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'json':
|
case 'json':
|
||||||
|
$dependencies = array();
|
||||||
foreach ($packages as $package) {
|
foreach ($packages as $package) {
|
||||||
$dependencies[$package->getPrettyName()] = array(
|
$dependencies[$package->getPrettyName()] = array(
|
||||||
'version' => $package->getFullPrettyVersion(),
|
'version' => $package->getFullPrettyVersion(),
|
||||||
|
|
|
@ -23,9 +23,13 @@ use Composer\Util\Filesystem;
|
||||||
*/
|
*/
|
||||||
abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterface
|
abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterface
|
||||||
{
|
{
|
||||||
|
/** @var IOInterface */
|
||||||
protected $io;
|
protected $io;
|
||||||
|
/** @var Config */
|
||||||
protected $config;
|
protected $config;
|
||||||
|
/** @var ProcessExecutor */
|
||||||
protected $process;
|
protected $process;
|
||||||
|
/** @var Filesystem */
|
||||||
protected $filesystem;
|
protected $filesystem;
|
||||||
|
|
||||||
public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
|
public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
|
||||||
|
|
|
@ -123,7 +123,7 @@ interface IOInterface
|
||||||
* @param string|array $question The question to ask
|
* @param string|array $question The question to ask
|
||||||
* @param callback $validator A PHP callback
|
* @param callback $validator A PHP callback
|
||||||
* @param null|int $attempts Max number of times to ask before giving up (default of null means infinite)
|
* @param null|int $attempts Max number of times to ask before giving up (default of null means infinite)
|
||||||
* @param string $default The default answer if none is given by the user
|
* @param mixed $default The default answer if none is given by the user
|
||||||
*
|
*
|
||||||
* @throws \Exception When any of the validators return an error
|
* @throws \Exception When any of the validators return an error
|
||||||
* @return mixed
|
* @return mixed
|
||||||
|
|
|
@ -154,9 +154,9 @@ class GitHubDriver extends VcsDriver
|
||||||
while ($notFoundRetries) {
|
while ($notFoundRetries) {
|
||||||
try {
|
try {
|
||||||
$resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/composer.json?ref='.urlencode($identifier);
|
$resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/composer.json?ref='.urlencode($identifier);
|
||||||
$composer = JsonFile::parseJson($this->getContents($resource));
|
$resource = JsonFile::parseJson($this->getContents($resource));
|
||||||
if (empty($composer['content']) || $composer['encoding'] !== 'base64' || !($composer = base64_decode($composer['content']))) {
|
if (empty($resource['content']) || $resource['encoding'] !== 'base64' || !($composer = base64_decode($resource['content']))) {
|
||||||
throw new \RuntimeException('Could not retrieve composer.json from '.$resource);
|
throw new \RuntimeException('Could not retrieve composer.json for '.$identifier);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} catch (TransportException $e) {
|
} catch (TransportException $e) {
|
||||||
|
@ -167,7 +167,7 @@ class GitHubDriver extends VcsDriver
|
||||||
// TODO should be removed when possible
|
// TODO should be removed when possible
|
||||||
// retry fetching if github returns a 404 since they happen randomly
|
// retry fetching if github returns a 404 since they happen randomly
|
||||||
$notFoundRetries--;
|
$notFoundRetries--;
|
||||||
$composer = false;
|
$composer = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,12 +26,19 @@ use Composer\Util\Filesystem;
|
||||||
*/
|
*/
|
||||||
abstract class VcsDriver implements VcsDriverInterface
|
abstract class VcsDriver implements VcsDriverInterface
|
||||||
{
|
{
|
||||||
|
/** @var string */
|
||||||
protected $url;
|
protected $url;
|
||||||
|
/** @var string */
|
||||||
protected $originUrl;
|
protected $originUrl;
|
||||||
|
/** @var array */
|
||||||
protected $repoConfig;
|
protected $repoConfig;
|
||||||
|
/** @var IOInterface */
|
||||||
protected $io;
|
protected $io;
|
||||||
|
/** @var Config */
|
||||||
protected $config;
|
protected $config;
|
||||||
|
/** @var ProcessExecutor */
|
||||||
protected $process;
|
protected $process;
|
||||||
|
/** @var RemoteFilesystem */
|
||||||
protected $remoteFilesystem;
|
protected $remoteFilesystem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -20,9 +20,13 @@ use Composer\IO\IOInterface;
|
||||||
*/
|
*/
|
||||||
class Git
|
class Git
|
||||||
{
|
{
|
||||||
|
/** @var IOInterface */
|
||||||
protected $io;
|
protected $io;
|
||||||
|
/** @var Config */
|
||||||
protected $config;
|
protected $config;
|
||||||
|
/** @var ProcessExecutor */
|
||||||
protected $process;
|
protected $process;
|
||||||
|
/** @var Filesystem */
|
||||||
protected $filesystem;
|
protected $filesystem;
|
||||||
|
|
||||||
public function __construct(IOInterface $io, Config $config, ProcessExecutor $process, Filesystem $fs)
|
public function __construct(IOInterface $io, Config $config, ProcessExecutor $process, Filesystem $fs)
|
||||||
|
|
Loading…
Reference in New Issue