Merge remote-tracking branch 'curry684/code-quality' into 1.0
commit
da9b43dcc8
|
@ -18,7 +18,7 @@ use Composer\Installer\InstallationManager;
|
|||
use Composer\IO\IOInterface;
|
||||
use Composer\Package\AliasPackage;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Repository\InstalledRepositoryInterface;
|
||||
use Composer\Repository\WritableRepositoryInterface;
|
||||
use Composer\Util\Filesystem;
|
||||
use Composer\Script\ScriptEvents;
|
||||
|
||||
|
@ -85,7 +85,7 @@ class AutoloadGenerator
|
|||
$this->runScripts = (boolean) $runScripts;
|
||||
}
|
||||
|
||||
public function dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '')
|
||||
public function dump(Config $config, WritableRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '')
|
||||
{
|
||||
if ($this->classMapAuthoritative) {
|
||||
// Force scanPsr0Packages when classmap is authoritative
|
||||
|
|
|
@ -209,8 +209,9 @@ class BaseDependencyCommand extends BaseCommand
|
|||
/**
|
||||
* Recursively prints a tree of the selected results.
|
||||
*
|
||||
* @param array $results
|
||||
* @param string $prefix
|
||||
* @param array $results Results to be printed at this level.
|
||||
* @param string $prefix Prefix of the current tree level.
|
||||
* @param int $level Current level of recursion.
|
||||
*/
|
||||
protected function printTree($results, $prefix = '', $level = 1)
|
||||
{
|
||||
|
@ -220,6 +221,7 @@ class BaseDependencyCommand extends BaseCommand
|
|||
/**
|
||||
* @var PackageInterface $package
|
||||
* @var Link $link
|
||||
* @var array|bool $children
|
||||
*/
|
||||
list($package, $link, $children) = $result;
|
||||
|
||||
|
|
|
@ -373,6 +373,7 @@ EOT
|
|||
* @param InputInterface $input
|
||||
* @param bool $preferSource
|
||||
* @param bool $preferDist
|
||||
* @param bool $keepVcsRequiresPreferSource
|
||||
*/
|
||||
protected function updatePreferredOptions(Config $config, InputInterface $input, &$preferSource, &$preferDist, $keepVcsRequiresPreferSource = false)
|
||||
{
|
||||
|
|
|
@ -69,7 +69,7 @@ EOT
|
|||
);
|
||||
}
|
||||
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
$binary = $input->getArgument('binary');
|
||||
|
|
|
@ -67,7 +67,7 @@ EOT
|
|||
foreach ($repos as $repo) {
|
||||
foreach ($repo->findPackages($packageName) as $package) {
|
||||
$packageExists = true;
|
||||
if ($this->handlePackage($package, $input->getOption('homepage'), $input->getOption('show'))) {
|
||||
if ($package instanceof CompletePackageInterface && $this->handlePackage($package, $input->getOption('homepage'), $input->getOption('show'))) {
|
||||
$handled = true;
|
||||
break 2;
|
||||
}
|
||||
|
|
|
@ -114,6 +114,8 @@ EOT
|
|||
*
|
||||
* @param RepositoryInterface $repo
|
||||
* @param PackageInterface $package
|
||||
* @param array $bucket
|
||||
* @return array
|
||||
*/
|
||||
private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array())
|
||||
{
|
||||
|
|
|
@ -70,7 +70,7 @@ EOT
|
|||
if ($input->getOption('list')) {
|
||||
return $this->listScripts();
|
||||
} elseif (!$input->getArgument('script')) {
|
||||
throw new \RunTimeException('Missing required argument "script"');
|
||||
throw new \RuntimeException('Missing required argument "script"');
|
||||
}
|
||||
|
||||
$script = $input->getArgument('script');
|
||||
|
|
|
@ -19,7 +19,6 @@ use Symfony\Component\Console\Input\InputOption;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Composer\Repository\CompositeRepository;
|
||||
use Composer\Repository\PlatformRepository;
|
||||
use Composer\Repository\RepositoryFactory;
|
||||
use Composer\Repository\RepositoryInterface;
|
||||
use Composer\Plugin\CommandEvent;
|
||||
use Composer\Plugin\PluginEvents;
|
||||
|
|
|
@ -305,6 +305,8 @@ TAGSPUBKEY
|
|||
* @param string $localFilename
|
||||
* @param string $newFilename
|
||||
* @param string $backupTarget
|
||||
* @return \Exception|null
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function setLocalPhar($localFilename, $newFilename, $backupTarget = null)
|
||||
{
|
||||
|
@ -323,6 +325,7 @@ TAGSPUBKEY
|
|||
}
|
||||
|
||||
rename($newFilename, $localFilename);
|
||||
return null;
|
||||
} catch (\Exception $e) {
|
||||
if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
|
||||
throw $e;
|
||||
|
|
|
@ -89,7 +89,7 @@ EOT
|
|||
if ($input->getOption('tree') && ($input->getOption('all') || $input->getOption('available'))) {
|
||||
$io->writeError('The --tree (-t) option is not usable in combination with --all or --available (-a)');
|
||||
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// init repos
|
||||
|
@ -332,7 +332,11 @@ EOT
|
|||
}
|
||||
|
||||
/**
|
||||
* prints package meta data
|
||||
* Prints package metadata.
|
||||
*
|
||||
* @param CompletePackageInterface $package
|
||||
* @param array $versions
|
||||
* @param RepositoryInterface $installedRepo
|
||||
*/
|
||||
protected function printMeta(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo)
|
||||
{
|
||||
|
@ -389,7 +393,11 @@ EOT
|
|||
}
|
||||
|
||||
/**
|
||||
* prints all available versions of this package and highlights the installed one if any
|
||||
* Prints all available versions of this package and highlights the installed one if any.
|
||||
*
|
||||
* @param CompletePackageInterface $package
|
||||
* @param array $versions
|
||||
* @param RepositoryInterface $installedRepo
|
||||
*/
|
||||
protected function printVersions(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo)
|
||||
{
|
||||
|
|
|
@ -80,7 +80,8 @@ class Config
|
|||
private $useEnvironment;
|
||||
|
||||
/**
|
||||
* @param bool $useEnvironment Use COMPOSER_ environment variables to replace config settings
|
||||
* @param bool $useEnvironment Use COMPOSER_ environment variables to replace config settings
|
||||
* @param string $baseDir Optional base directory of the config
|
||||
*/
|
||||
public function __construct($useEnvironment = true, $baseDir = null)
|
||||
{
|
||||
|
|
|
@ -45,6 +45,9 @@ class Request
|
|||
* Mark an existing package as being installed and having to remain installed
|
||||
*
|
||||
* These jobs will not be tempered with by the solver
|
||||
*
|
||||
* @param string $packageName
|
||||
* @param ConstraintInterface|null $constraint
|
||||
*/
|
||||
public function fix($packageName, ConstraintInterface $constraint = null)
|
||||
{
|
||||
|
|
|
@ -69,7 +69,7 @@ class HgDownloader extends VcsDownloader
|
|||
public function getLocalChanges(PackageInterface $package, $path)
|
||||
{
|
||||
if (!is_dir($path.'/.hg')) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
$this->process->execute('hg st', $output, realpath($path));
|
||||
|
|
|
@ -73,7 +73,7 @@ class SvnDownloader extends VcsDownloader
|
|||
public function getLocalChanges(PackageInterface $package, $path)
|
||||
{
|
||||
if (!$this->hasMetadataRepository($path)) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
$this->process->execute('svn status --ignore-externals', $output, $path);
|
||||
|
|
|
@ -137,11 +137,9 @@ class EventDispatcher
|
|||
* Triggers the listeners of an event.
|
||||
*
|
||||
* @param Event $event The event object to pass to the event handlers/listeners.
|
||||
* @param string $additionalArgs
|
||||
* @throws \RuntimeException
|
||||
* @throws \Exception
|
||||
* @return int return code of the executed script if any, for php scripts a false return
|
||||
* value is changed to 1, anything else to 0
|
||||
* @throws \RuntimeException|\Exception
|
||||
*/
|
||||
protected function doDispatch(Event $event)
|
||||
{
|
||||
|
|
|
@ -25,6 +25,7 @@ use Composer\Util\Platform;
|
|||
use Composer\Util\ProcessExecutor;
|
||||
use Composer\Util\RemoteFilesystem;
|
||||
use Composer\Util\Silencer;
|
||||
use Seld\JsonLint\DuplicateKeyException;
|
||||
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
|
||||
use Composer\EventDispatcher\EventDispatcher;
|
||||
use Composer\Autoload\AutoloadGenerator;
|
||||
|
@ -270,7 +271,7 @@ class Factory
|
|||
$jsonParser = new JsonParser;
|
||||
try {
|
||||
$jsonParser->parse(file_get_contents($localConfig), JsonParser::DETECT_KEY_CONFLICTS);
|
||||
} catch (\Seld\JsonLint\DuplicateKeyException $e) {
|
||||
} catch (DuplicateKeyException $e) {
|
||||
$details = $e->getDetails();
|
||||
$io->writeError('<warning>Key '.$details['key'].' is a duplicate in '.$localConfig.' at line '.$details['line'].'</warning>');
|
||||
}
|
||||
|
|
|
@ -23,15 +23,12 @@ use Symfony\Component\Console\Helper\HelperSet;
|
|||
class BufferIO extends ConsoleIO
|
||||
{
|
||||
/**
|
||||
* @param string $input
|
||||
* @param int $verbosity
|
||||
* @param OutputFormatterInterface $formatter
|
||||
* @param string $input
|
||||
* @param int $verbosity
|
||||
* @param OutputFormatterInterface|null $formatter
|
||||
*/
|
||||
public function __construct(
|
||||
$input = '',
|
||||
$verbosity = StreamOutput::VERBOSITY_NORMAL,
|
||||
OutputFormatterInterface $formatter = null
|
||||
) {
|
||||
public function __construct($input = '', $verbosity = StreamOutput::VERBOSITY_NORMAL, OutputFormatterInterface $formatter = null)
|
||||
{
|
||||
$input = new StringInput($input);
|
||||
$input->setInteractive(false);
|
||||
|
||||
|
|
|
@ -27,12 +27,20 @@ use Symfony\Component\Console\Question\Question;
|
|||
*/
|
||||
class ConsoleIO extends BaseIO
|
||||
{
|
||||
/** @var InputInterface */
|
||||
protected $input;
|
||||
/** @var OutputInterface */
|
||||
protected $output;
|
||||
/** @var HelperSet */
|
||||
protected $helperSet;
|
||||
/** @var string */
|
||||
protected $lastMessage;
|
||||
/** @var string */
|
||||
protected $lastMessageErr;
|
||||
|
||||
/** @var float */
|
||||
private $startTime;
|
||||
/** @var array<int, int> */
|
||||
private $verbosityMap;
|
||||
|
||||
/**
|
||||
|
@ -56,6 +64,9 @@ class ConsoleIO extends BaseIO
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $startTime
|
||||
*/
|
||||
public function enableDebugging($startTime)
|
||||
{
|
||||
$this->startTime = $startTime;
|
||||
|
@ -274,6 +285,9 @@ class ConsoleIO extends BaseIO
|
|||
return $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return OutputInterface
|
||||
*/
|
||||
private function getErrorOutput()
|
||||
{
|
||||
if ($this->output instanceof ConsoleOutputInterface) {
|
||||
|
|
|
@ -15,9 +15,7 @@ namespace Composer\Installer;
|
|||
use Composer\IO\IOInterface;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Util\Filesystem;
|
||||
use Composer\Util\Platform;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
use Composer\Util\Silencer;
|
||||
|
||||
/**
|
||||
* Utility to handle installation of package "bin"/binaries for PEAR packages
|
||||
|
@ -30,10 +28,12 @@ class PearBinaryInstaller extends BinaryInstaller
|
|||
private $vendorDir;
|
||||
|
||||
/**
|
||||
* @param IOInterface $io
|
||||
* @param string $binDir
|
||||
* @param string $binCompat
|
||||
* @param Filesystem $filesystem
|
||||
* @param IOInterface $io
|
||||
* @param string $binDir
|
||||
* @param string $vendorDir
|
||||
* @param string $binCompat
|
||||
* @param Filesystem $filesystem
|
||||
* @param PearInstaller $installer
|
||||
*/
|
||||
public function __construct(IOInterface $io, $binDir, $vendorDir, $binCompat, Filesystem $filesystem, PearInstaller $installer)
|
||||
{
|
||||
|
|
|
@ -18,7 +18,6 @@ use Composer\Downloader\PearPackageExtractor;
|
|||
use Composer\Repository\InstalledRepositoryInterface;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Util\Platform;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
use Composer\Util\Filesystem;
|
||||
|
||||
/**
|
||||
|
|
|
@ -29,7 +29,7 @@ class SuggestedPackagesReporter
|
|||
protected $suggestedPackages = array();
|
||||
|
||||
/**
|
||||
* @var Composer\IO\IOInterface
|
||||
* @var IOInterface
|
||||
*/
|
||||
private $io;
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ class JsonFile
|
|||
*
|
||||
* @param string $path path to a lockfile
|
||||
* @param RemoteFilesystem $rfs required for loading http/https json files
|
||||
* @param IOInterface $io
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function __construct($path, RemoteFilesystem $rfs = null, IOInterface $io = null)
|
||||
|
@ -105,7 +106,7 @@ class JsonFile
|
|||
*
|
||||
* @param array $hash writes hash into json file
|
||||
* @param int $options json_encode options (defaults to JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)
|
||||
* @throws \UnexpectedValueException
|
||||
* @throws \UnexpectedValueException|\Exception
|
||||
*/
|
||||
public function write(array $hash, $options = 448)
|
||||
{
|
||||
|
|
|
@ -83,7 +83,7 @@ abstract class BaseExcludeFilter
|
|||
$line = trim($line);
|
||||
|
||||
if (!$line || 0 === strpos($line, '#')) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
return call_user_func($lineParser, $line);
|
||||
|
|
|
@ -69,12 +69,9 @@ class GitExcludeFilter extends BaseExcludeFilter
|
|||
{
|
||||
$parts = preg_split('#\s+#', $line);
|
||||
|
||||
if (count($parts) != 2) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($parts[1] === 'export-ignore') {
|
||||
if (count($parts) == 2 && $parts[1] === 'export-ignore') {
|
||||
return $this->generatePattern($parts[0]);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
namespace Composer\Package\Loader;
|
||||
|
||||
use Composer\Package\BasePackage;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Package\AliasPackage;
|
||||
use Composer\Config;
|
||||
use Composer\Package\RootPackageInterface;
|
||||
use Composer\Repository\RepositoryFactory;
|
||||
use Composer\Package\Version\VersionGuesser;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
|
@ -59,7 +59,7 @@ class RootPackageLoader extends ArrayLoader
|
|||
* @param array $config package data
|
||||
* @param string $class FQCN to be instantiated
|
||||
* @param string $cwd cwd of the root package to be used to guess the version if it is not provided
|
||||
* @return PackageInterface
|
||||
* @return RootPackageInterface
|
||||
*/
|
||||
public function load(array $config, $class = 'Composer\Package\RootPackage', $cwd = null)
|
||||
{
|
||||
|
|
|
@ -56,6 +56,7 @@ class ArrayRepository extends BaseRepository
|
|||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -272,6 +272,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
|||
* @param Pool $pool
|
||||
* @param string $name package name
|
||||
* @param bool $bypassFilters If set to true, this bypasses the stability filtering, and forces a recompute without cache
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function whatProvides(Pool $pool, $name, $bypassFilters = false)
|
||||
{
|
||||
|
|
|
@ -53,7 +53,6 @@ class ChannelReader extends BaseChannelReader
|
|||
$xml = $this->requestXml($url, "/channel.xml");
|
||||
|
||||
$channelName = (string) $xml->name;
|
||||
$channelSummary = (string) $xml->summary;
|
||||
$channelAlias = (string) $xml->suggestedalias;
|
||||
|
||||
$supportedVersions = array_keys($this->readerMap);
|
||||
|
|
|
@ -25,7 +25,11 @@ use Composer\Json\JsonFile;
|
|||
class RepositoryFactory
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
* @param IOInterface $io
|
||||
* @param Config $config
|
||||
* @param string $repository
|
||||
* @param bool $allowFilesystem
|
||||
* @return array|mixed
|
||||
*/
|
||||
public static function configFromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
|
||||
{
|
||||
|
@ -52,6 +56,10 @@ class RepositoryFactory
|
|||
}
|
||||
|
||||
/**
|
||||
* @param IOInterface $io
|
||||
* @param Config $config
|
||||
* @param string $repository
|
||||
* @param bool $allowFilesystem
|
||||
* @return RepositoryInterface
|
||||
*/
|
||||
public static function fromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
|
||||
|
@ -62,9 +70,12 @@ class RepositoryFactory
|
|||
}
|
||||
|
||||
/**
|
||||
* @param IOInterface $io
|
||||
* @param Config $config
|
||||
* @param array $repoConfig
|
||||
* @return RepositoryInterface
|
||||
*/
|
||||
public static function createRepo($io, $config, array $repoConfig)
|
||||
public static function createRepo(IOInterface $io, Config $config, array $repoConfig)
|
||||
{
|
||||
$rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
|
||||
$repos = static::createRepos($rm, array($repoConfig));
|
||||
|
@ -73,6 +84,9 @@ class RepositoryFactory
|
|||
}
|
||||
|
||||
/**
|
||||
* @param IOInterface|null $io
|
||||
* @param Config|null $config
|
||||
* @param RepositoryManager|null $rm
|
||||
* @return RepositoryInterface[]
|
||||
*/
|
||||
public static function defaultRepos(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
|
||||
|
|
|
@ -58,6 +58,7 @@ class RepositoryManager
|
|||
return $package;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,7 +17,6 @@ use Composer\Json\JsonFile;
|
|||
use Composer\Util\ProcessExecutor;
|
||||
use Composer\Util\Filesystem;
|
||||
use Composer\IO\IOInterface;
|
||||
use Composer\Downloader\TransportException;
|
||||
|
||||
/**
|
||||
* @author Per Bernhardt <plb@webfactory.de>
|
||||
|
|
|
@ -66,9 +66,9 @@ class ErrorHandler
|
|||
}
|
||||
|
||||
/**
|
||||
* Register error handler
|
||||
* Register error handler.
|
||||
*
|
||||
* @static
|
||||
* @param IOInterface|null $io
|
||||
*/
|
||||
public static function register(IOInterface $io = null)
|
||||
{
|
||||
|
|
|
@ -14,7 +14,6 @@ namespace Composer\Util;
|
|||
|
||||
use Composer\Config;
|
||||
use Composer\IO\IOInterface;
|
||||
use Composer\Downloader\TransportException;
|
||||
|
||||
/**
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
|
|
|
@ -70,6 +70,7 @@ class GitLab
|
|||
/**
|
||||
* Authorizes a GitLab domain interactively via OAuth.
|
||||
*
|
||||
* @param string $scheme Scheme used in the origin URL
|
||||
* @param string $originUrl The host this GitLab instance is located at
|
||||
* @param string $message The reason this authorization is required
|
||||
*
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
namespace Composer\Util;
|
||||
|
||||
use Composer\Config;
|
||||
use Composer\Downloader\TransportException;
|
||||
use Composer\IO\IOInterface;
|
||||
|
||||
/**
|
||||
|
|
|
@ -70,7 +70,7 @@ final class TlsHelper
|
|||
}
|
||||
|
||||
if (!isset($info['subject']['commonName'])) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
$commonName = strtolower($info['subject']['commonName']);
|
||||
|
@ -82,6 +82,7 @@ final class TlsHelper
|
|||
if (0 === strpos($name, 'DNS:')) {
|
||||
return strtolower(ltrim(substr($name, 4)));
|
||||
}
|
||||
return null;
|
||||
}, $subjectAltNames));
|
||||
$subjectAltNames = array_values($subjectAltNames);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue