Strict typing fixes

main
Jordi Boggiano 9 years ago
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('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('dir', false, 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('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.'),
))
->setHelp(<<<EOT

@ -112,6 +112,7 @@ EOT
return $this->installProject(
$io,
$config,
$input,
$input->getArgument('package'),
$input->getArgument('directory'),
$input->getArgument('version'),
@ -125,12 +126,11 @@ EOT
$input->getOption('keep-vcs'),
$input->getOption('no-progress'),
$input->getOption('no-install'),
$input->getOption('ignore-platform-reqs'),
$input
$input->getOption('ignore-platform-reqs')
);
}
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();

@ -88,6 +88,7 @@ EOT
break;
case 'json':
$dependencies = array();
foreach ($packages as $package) {
$dependencies[$package->getPrettyName()] = array(
'version' => $package->getFullPrettyVersion(),

@ -23,9 +23,13 @@ use Composer\Util\Filesystem;
*/
abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterface
{
/** @var IOInterface */
protected $io;
/** @var Config */
protected $config;
/** @var ProcessExecutor */
protected $process;
/** @var Filesystem */
protected $filesystem;
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 callback $validator A PHP callback
* @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
* @return mixed

@ -154,9 +154,9 @@ class GitHubDriver extends VcsDriver
while ($notFoundRetries) {
try {
$resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/composer.json?ref='.urlencode($identifier);
$composer = JsonFile::parseJson($this->getContents($resource));
if (empty($composer['content']) || $composer['encoding'] !== 'base64' || !($composer = base64_decode($composer['content']))) {
throw new \RuntimeException('Could not retrieve composer.json from '.$resource);
$resource = JsonFile::parseJson($this->getContents($resource));
if (empty($resource['content']) || $resource['encoding'] !== 'base64' || !($composer = base64_decode($resource['content']))) {
throw new \RuntimeException('Could not retrieve composer.json for '.$identifier);
}
break;
} catch (TransportException $e) {
@ -167,7 +167,7 @@ class GitHubDriver extends VcsDriver
// TODO should be removed when possible
// retry fetching if github returns a 404 since they happen randomly
$notFoundRetries--;
$composer = false;
$composer = null;
}
}

@ -26,12 +26,19 @@ use Composer\Util\Filesystem;
*/
abstract class VcsDriver implements VcsDriverInterface
{
/** @var string */
protected $url;
/** @var string */
protected $originUrl;
/** @var array */
protected $repoConfig;
/** @var IOInterface */
protected $io;
/** @var Config */
protected $config;
/** @var ProcessExecutor */
protected $process;
/** @var RemoteFilesystem */
protected $remoteFilesystem;
/**

@ -20,9 +20,13 @@ use Composer\IO\IOInterface;
*/
class Git
{
/** @var IOInterface */
protected $io;
/** @var Config */
protected $config;
/** @var ProcessExecutor */
protected $process;
/** @var Filesystem */
protected $filesystem;
public function __construct(IOInterface $io, Config $config, ProcessExecutor $process, Filesystem $fs)

Loading…
Cancel
Save