1
0
Fork 0
pull/4467/head
Jordi Boggiano 2015-09-28 10:51:14 +01:00
parent 96a8bc6c5b
commit ce08582671
86 changed files with 366 additions and 391 deletions

View File

@ -277,13 +277,13 @@ EOF;
$includePathFilePath = $targetDir.'/include_paths.php';
if ($includePathFileContents = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
file_put_contents($includePathFilePath, $includePathFileContents);
} else if (file_exists($includePathFilePath)){
} elseif (file_exists($includePathFilePath)) {
unlink($includePathFilePath);
}
$includeFilesFilePath = $targetDir.'/autoload_files.php';
if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
file_put_contents($includeFilesFilePath, $includeFilesFileContents);
} else if (file_exists($includeFilesFilePath)) {
} elseif (file_exists($includeFilesFilePath)) {
unlink($includeFilesFilePath);
}
file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));

View File

@ -49,9 +49,8 @@ class ClassMapGenerator
* @param IOInterface $io IO object
* @param string $namespace Optional namespace prefix to filter by
*
* @return array A class map array
*
* @throws \RuntimeException When the path is neither an existing file nor directory
* @return array A class map array
*/
public static function createMap($path, $whitelist = null, IOInterface $io = null, $namespace = null)
{

View File

@ -20,7 +20,6 @@ use Composer\Script\ScriptEvents;
use Composer\Plugin\CommandEvent;
use Composer\Plugin\PluginEvents;
use Composer\Util\Filesystem;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;

View File

@ -278,7 +278,7 @@ EOT
'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 $val; },
),
'store-auths' => array(
function ($val) { return in_array($val, array('true', 'false', 'prompt'), true); },
@ -288,7 +288,7 @@ EOT
}
return $val !== 'false' && (bool) $val;
}
},
),
'notify-on-install' => array($booleanValidator, $booleanNormalizer),
'vendor-dir' => array('is_string', function ($val) { return $val; }),
@ -301,7 +301,7 @@ EOT
'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 $val; },
),
'discard-changes' => array(
function ($val) { return in_array($val, array('stash', 'true', 'false', '1', '0'), true); },
@ -311,7 +311,7 @@ EOT
}
return $val !== 'false' && (bool) $val;
}
},
),
'autoloader-suffix' => array('is_string', function ($val) { return $val === 'null' ? null : $val; }),
'optimize-autoloader' => array($booleanValidator, $booleanNormalizer),
@ -336,7 +336,7 @@ EOT
},
function ($vals) {
return $vals;
}
},
),
'github-domains' => array(
function ($vals) {
@ -348,7 +348,7 @@ EOT
},
function ($vals) {
return $vals;
}
},
),
);

View File

@ -347,8 +347,8 @@ EOT
* Updated preferSource or preferDist based on the preferredInstall config option
* @param Config $config
* @param InputInterface $input
* @param boolean $preferSource
* @param boolean $preferDist
* @param bool $preferSource
* @param bool $preferDist
*/
protected function updatePreferredOptions(Config $config, InputInterface $input, &$preferSource, &$preferDist, $keepVcsRequiresPreferSource = false)
{

View File

@ -264,7 +264,7 @@ EOT
$url = $domain === 'github.com' ? 'https://api.'.$domain.'/user/repos' : 'https://'.$domain.'/api/v3/user/repos';
return $this->rfs->getContents($domain, $url, false, array(
'retry-auth-failure' => false
'retry-auth-failure' => false,
)) ? true : 'Unexpected error';
} catch (\Exception $e) {
if ($e instanceof TransportException && $e->getCode() === 401) {
@ -276,10 +276,10 @@ EOT
}
/**
* @param string $domain
* @param string $token
* @return array
* @param string $domain
* @param string $token
* @throws TransportException
* @return array
*/
private function getGithubRateLimit($domain, $token = null)
{

View File

@ -148,7 +148,7 @@ EOT
$io->writeError(array(
'',
$formatter->formatBlock('Welcome to the Composer config generator', 'bg=blue;fg=white', true),
''
'',
));
// namespace
@ -284,7 +284,7 @@ EOT
/**
* @private
* @param string $author
* @param string $author
* @return array
*/
public function parseAuthorString($author)
@ -293,7 +293,7 @@ EOT
if ($this->isValidEmail($match['email'])) {
return array(
'name' => trim($match['name']),
'email' => $match['email']
'email' => $match['email'],
);
}
}
@ -368,7 +368,7 @@ EOT
$io->writeError(array(
'',
sprintf('Found <info>%s</info> packages matching <info>%s</info>', count($matches), $package),
''
'',
));
$io->writeError($choices);
@ -591,8 +591,8 @@ EOT
*
* @param InputInterface $input
* @param string $name
* @return string
* @throws \InvalidArgumentException
* @return string
*/
private function findBestVersionForPackage(InputInterface $input, $name)
{

View File

@ -245,8 +245,8 @@ EOT
* @param RepositoryInterface $repos
* @param string $name
* @param string $version
* @return array array(CompletePackageInterface, array of versions)
* @throws \InvalidArgumentException
* @return array array(CompletePackageInterface, array of versions)
*/
protected function getPackage(RepositoryInterface $installedRepo, RepositoryInterface $repos, $name, $version = null)
{

View File

@ -42,7 +42,7 @@ class ValidateCommand extends Command
new InputOption('no-check-publish', null, InputOption::VALUE_NONE, 'Do not check for publish errors'),
new InputOption('with-dependencies', 'A', InputOption::VALUE_NONE, 'Also validate the composer.json of all installed dependencies'),
new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code for warnings as well as errors'),
new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file', './composer.json')
new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file', './composer.json'),
))
->setHelp(<<<EOT
The validate command validates a given composer.json and composer.lock

View File

@ -33,8 +33,8 @@ class Compiler
/**
* Compiles composer into a single phar file
*
* @throws \RuntimeException
* @param string $pharFile The full path to the file to create
* @throws \RuntimeException
*/
public function compile($pharFile = 'composer.phar')
{

View File

@ -57,7 +57,7 @@ class Config
'type' => 'composer',
'url' => 'https?://packagist.org',
'allow_ssl_downgrade' => true,
)
),
);
private $config;
@ -68,7 +68,7 @@ class Config
private $useEnvironment;
/**
* @param boolean $useEnvironment Use COMPOSER_ environment variables to replace config settings
* @param bool $useEnvironment Use COMPOSER_ environment variables to replace config settings
*/
public function __construct($useEnvironment = true, $baseDir = null)
{
@ -331,8 +331,8 @@ class Config
* This should be used to read COMPOSER_ environment variables
* that overload config values.
*
* @param string $var
* @return string|boolean
* @param string $var
* @return string|bool
*/
private function getComposerEnv($var)
{

View File

@ -159,8 +159,8 @@ class Application extends BaseApplication
/**
* @param InputInterface $input
* @return string
* @throws \RuntimeException
* @return string
*/
private function getNewWorkingDir(InputInterface $input)
{

View File

@ -27,7 +27,7 @@ class HtmlOutputFormatter extends OutputFormatter
34 => 'blue',
35 => 'magenta',
36 => 'cyan',
37 => 'white'
37 => 'white',
);
private static $availableBackgroundColors = array(
40 => 'black',
@ -37,7 +37,7 @@ class HtmlOutputFormatter extends OutputFormatter
44 => 'blue',
45 => 'magenta',
46 => 'cyan',
47 => 'white'
47 => 'white',
);
private static $availableOptions = array(
1 => 'bold',

View File

@ -150,11 +150,11 @@ class Pool implements \Countable
}
/**
* Retrieves the package object for a given package id.
*
* @param int $id
* @return PackageInterface
*/
* Retrieves the package object for a given package id.
*
* @param int $id
* @return PackageInterface
*/
public function packageById($id)
{
return $this->packages[$id - 1];

View File

@ -59,7 +59,7 @@ class Request
'cmd' => $cmd,
'packageName' => $packageName,
'constraint' => $constraint,
'fixed' => $fixed
'fixed' => $fixed,
);
}

View File

@ -62,6 +62,7 @@ class Rule
public function getHash()
{
$data = unpack('ihash', md5(implode(',', $this->literals), true));
return $data['hash'];
}

View File

@ -83,7 +83,7 @@ class RuleWatchNode
/**
* Given one watched literal, this method returns the other watched literal
*
* @param int $literal The watched literal that should not be returned
* @param int $literal The watched literal that should not be returned
* @return int A literal
*/
public function getOtherWatch($literal)

View File

@ -217,7 +217,7 @@ class Solver
* Evaluates each term affected by the decision (linked through watches)
* If we find unit rules we make new decisions based on them
*
* @param integer $level
* @param int $level
* @return Rule|null A rule on conflict, otherwise null.
*/
protected function propagate($level)

View File

@ -103,10 +103,9 @@ class DownloadManager
/**
* Returns downloader for a specific installation type.
*
* @param string $type installation type
* @return DownloaderInterface
*
* @param string $type installation type
* @throws \InvalidArgumentException if downloader for provided type is not registered
* @return DownloaderInterface
*/
public function getDownloader($type)
{
@ -121,12 +120,11 @@ class DownloadManager
/**
* Returns downloader for already installed package.
*
* @param PackageInterface $package package instance
* @return DownloaderInterface|null
*
* @param PackageInterface $package package instance
* @throws \InvalidArgumentException if package has no installation source specified
* @throws \LogicException if specific downloader used to load package with
* wrong type
* wrong type
* @return DownloaderInterface|null
*/
public function getDownloaderForInstalledPackage(PackageInterface $package)
{

View File

@ -137,7 +137,7 @@ class FileDownloader implements DownloaderInterface
break;
} catch (TransportException $e) {
// if we got an http response with a proper code, then requesting again will probably not help, abort
if ((0 !== $e->getCode() && !in_array($e->getCode(),array(500, 502, 503, 504))) || !$retries) {
if ((0 !== $e->getCode() && !in_array($e->getCode(), array(500, 502, 503, 504))) || !$retries) {
throw $e;
}
if ($this->io->isVerbose()) {
@ -225,11 +225,10 @@ class FileDownloader implements DownloaderInterface
/**
* Process the download url
*
* @param PackageInterface $package package the url is coming from
* @param string $url download url
* @return string url
*
* @param PackageInterface $package package the url is coming from
* @param string $url download url
* @throws \RuntimeException If any problem with the url
* @return string url
*/
protected function processUrl(PackageInterface $package, $url)
{

View File

@ -209,13 +209,12 @@ class GitDownloader extends VcsDownloader
/**
* Updates the given path to the given commit ref
*
* @param string $path
* @param string $reference
* @param string $branch
* @param \DateTime $date
* @return null|string if a string is returned, it is the commit reference that was checked out if the original could not be found
*
* @param string $path
* @param string $reference
* @param string $branch
* @param \DateTime $date
* @throws \RuntimeException
* @return null|string if a string is returned, it is the commit reference that was checked out if the original could not be found
*/
protected function updateToCommit($path, $reference, $branch, $date)
{

View File

@ -48,7 +48,6 @@ class PearPackageExtractor
* @param array $vars used for replacement tasks
* @throws \RuntimeException
* @throws \UnexpectedValueException
*
*/
public function extractTo($target, array $roles = array('php' => '/', 'script' => '/bin'), $vars = array())
{
@ -130,9 +129,9 @@ class PearPackageExtractor
* @param string $source string path to extracted files
* @param array $roles array [role => roleRoot] relative root for files having that role
* @param array $vars list of values can be used for replacement tasks
* @throws \RuntimeException
* @return array array of 'source' => 'target', where source is location of file in the tarball (relative to source
* path, and target is destination of file (also relative to $source path)
* @throws \RuntimeException
*/
private function buildCopyActions($source, array $roles, $vars)
{

View File

@ -43,7 +43,7 @@ class PerforceDownloader extends VcsDownloader
private function getLabelFromSourceReference($ref)
{
$pos = strpos($ref,'@');
$pos = strpos($ref, '@');
if (false !== $pos) {
return substr($ref, $pos + 1);
}

View File

@ -151,7 +151,7 @@ class SvnDownloader extends VcsDownloader
*/
protected function getCommitLogs($fromReference, $toReference, $path)
{
if (preg_match('{.*@(\d+)$}', $fromReference) && preg_match('{.*@(\d+)$}', $toReference) ) {
if (preg_match('{.*@(\d+)$}', $fromReference) && preg_match('{.*@(\d+)$}', $toReference)) {
// strip paths from references and only keep the actual revision
$fromRevision = preg_replace('{.*@(\d+)$}', '$1', $fromReference);
$toRevision = preg_replace('{.*@(\d+)$}', '$1', $toReference);

View File

@ -35,7 +35,7 @@ class Event
protected $flags;
/**
* @var boolean Whether the event should not be passed to more listeners
* @var bool Whether the event should not be passed to more listeners
*/
private $propagationStopped = false;
@ -86,7 +86,7 @@ class Event
/**
* Checks if stopPropagation has been called
*
* @return boolean Whether propagation has been stopped
* @return bool Whether propagation has been stopped
*/
public function isPropagationStopped()
{

View File

@ -136,10 +136,10 @@ class EventDispatcher
*
* @param Event $event The event object to pass to the event handlers/listeners.
* @param string $additionalArgs
* @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
* @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
*/
protected function doDispatch(Event $event)
{
@ -212,8 +212,8 @@ class EventDispatcher
}
/**
* @param mixed $target
* @param Event $event
* @param mixed $target
* @param Event $event
* @return Event|CommandEvent
*/
protected function checkListenerExpectedEvent($target, Event $event)
@ -260,7 +260,7 @@ class EventDispatcher
*
* @param string $eventName The event name - typically a constant
* @param Callable $listener A callable expecting an event argument
* @param integer $priority A higher value represents a higher priority
* @param int $priority A higher value represents a higher priority
*/
protected function addListener($eventName, $listener, $priority = 0)
{
@ -313,8 +313,8 @@ class EventDispatcher
/**
* Checks if an event has listeners registered
*
* @param Event $event
* @return boolean
* @param Event $event
* @return bool
*/
public function hasEventListeners(Event $event)
{
@ -355,8 +355,8 @@ class EventDispatcher
/**
* Checks if string given references a class path and method
*
* @param string $callable
* @return boolean
* @param string $callable
* @return bool
*/
protected function isPhpScript($callable)
{

View File

@ -37,8 +37,8 @@ use Composer\Semver\VersionParser;
class Factory
{
/**
* @return string
* @throws \RuntimeException
* @return string
*/
protected static function getHomeDir()
{

View File

@ -23,8 +23,8 @@ use Symfony\Component\Console\Helper\HelperSet;
class BufferIO extends ConsoleIO
{
/**
* @param string $input
* @param int $verbosity
* @param string $input
* @param int $verbosity
* @param OutputFormatterInterface $formatter
*/
public function __construct(

View File

@ -111,8 +111,8 @@ class ConsoleIO extends BaseIO
/**
* @param array $messages
* @param boolean $newline
* @param boolean $stderr
* @param bool $newline
* @param bool $stderr
*/
private function doWrite($messages, $newline, $stderr)
{
@ -153,9 +153,9 @@ class ConsoleIO extends BaseIO
/**
* @param array $messages
* @param boolean $newline
* @param integer $size
* @param boolean $stderr
* @param bool $newline
* @param int $size
* @param bool $stderr
*/
private function doOverwrite($messages, $newline, $size, $stderr)
{

View File

@ -77,7 +77,7 @@ interface IOInterface
*
* @param string|array $messages The message as an array of lines or a single string
* @param bool $newline Whether to add a newline or not
* @param integer $size The size of line
* @param int $size The size of line
*/
public function overwrite($messages, $newline = true, $size = null);
@ -86,7 +86,7 @@ interface IOInterface
*
* @param string|array $messages The message as an array of lines or a single string
* @param bool $newline Whether to add a newline or not
* @param integer $size The size of line
* @param int $size The size of line
*/
public function overwriteError($messages, $newline = true, $size = null);
@ -96,9 +96,8 @@ interface IOInterface
* @param string|array $question The question to ask
* @param string $default The default answer if none is given by the user
*
* @return string The user answer
*
* @throws \RuntimeException If there is no data to read in the input stream
* @return string The user answer
*/
public function ask($question, $default = null);
@ -123,12 +122,11 @@ interface IOInterface
*
* @param string|array $question The question to ask
* @param callback $validator A PHP callback
* @param null|integer $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
*
* @return mixed
*
* @throws \Exception When any of the validators return an error
* @return mixed
*/
public function askAndValidate($question, $validator, $attempts = null, $default = null);
@ -153,7 +151,7 @@ interface IOInterface
*
* @param string $repositoryName The unique name of repository
*
* @return boolean
* @return bool
*/
public function hasAuthentication($repositoryName);

View File

@ -160,9 +160,8 @@ class Installer
/**
* Run installation (or update)
*
* @return int 0 on success or a positive error code on failure
*
* @throws \Exception
* @return int 0 on success or a positive error code on failure
*/
public function run()
{
@ -358,11 +357,11 @@ class Installer
}
/**
* @param RepositoryInterface $localRepo
* @param RepositoryInterface $installedRepo
* @param PlatformRepository $platformRepo
* @param array $aliases
* @param bool $withDevReqs
* @param RepositoryInterface $localRepo
* @param RepositoryInterface $installedRepo
* @param PlatformRepository $platformRepo
* @param array $aliases
* @param bool $withDevReqs
* @return int
*/
protected function doInstall($localRepo, $installedRepo, $platformRepo, $aliases, $withDevReqs)
@ -700,8 +699,8 @@ class Installer
}
/**
* @param bool $withDevReqs
* @param RepositoryInterface|null $lockedRepository
* @param bool $withDevReqs
* @param RepositoryInterface|null $lockedRepository
* @return Pool
*/
private function createPool($withDevReqs, RepositoryInterface $lockedRepository = null)
@ -766,8 +765,8 @@ class Installer
}
/**
* @param RootPackageInterface $rootPackage
* @param PlatformRepository $platformRepo
* @param RootPackageInterface $rootPackage
* @param PlatformRepository $platformRepo
* @return Request
*/
private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo)
@ -804,16 +803,16 @@ class Installer
}
/**
* @param WritableRepositoryInterface $localRepo
* @param Pool $pool
* @param PolicyInterface $policy
* @param array $repositories
* @param RepositoryInterface $installedRepo
* @param RepositoryInterface $lockedRepository
* @param bool $installFromLock
* @param bool $withDevReqs
* @param string $task
* @param array|null $operations
* @param WritableRepositoryInterface $localRepo
* @param Pool $pool
* @param PolicyInterface $policy
* @param array $repositories
* @param RepositoryInterface $installedRepo
* @param RepositoryInterface $lockedRepository
* @param bool $installFromLock
* @param bool $withDevReqs
* @param string $task
* @param array|null $operations
* @return array
*/
private function processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, $installFromLock, $withDevReqs, $task, array $operations = null)
@ -948,8 +947,8 @@ class Installer
/**
* Loads the most "current" list of packages that are installed meaning from lock ideally or from installed repo as fallback
* @param bool $withDevReqs
* @param RepositoryInterface $installedRepo
* @param bool $withDevReqs
* @param RepositoryInterface $installedRepo
* @return array
*/
private function getCurrentPackages($withDevReqs, $installedRepo)
@ -982,7 +981,7 @@ class Installer
foreach ($aliases as $alias) {
$normalizedAliases[$alias['package']][$alias['version']] = array(
'alias' => $alias['alias'],
'alias_normalized' => $alias['alias_normalized']
'alias_normalized' => $alias['alias_normalized'],
);
}
@ -1062,7 +1061,7 @@ class Installer
}
/**
* @param PackageInterface $package
* @param PackageInterface $package
* @return bool
*/
private function isUpdateable(PackageInterface $package)
@ -1095,7 +1094,7 @@ class Installer
}
/**
* @param array $links
* @param array $links
* @return array
*/
private function extractPlatformRequirements($links)
@ -1118,7 +1117,7 @@ class Installer
* update whitelist themselves.
*
* @param RepositoryInterface $localRepo
* @param boolean $devMode
* @param bool $devMode
* @param array $rootRequires An array of links to packages in require of the root package
* @param array $rootDevRequires An array of links to packages in require-dev of the root package
*/
@ -1251,7 +1250,7 @@ class Installer
}
/**
* @param RepositoryInterface $additionalInstalledRepository
* @param RepositoryInterface $additionalInstalledRepository
* @return $this
*/
public function setAdditionalInstalledRepository(RepositoryInterface $additionalInstalledRepository)
@ -1264,7 +1263,7 @@ class Installer
/**
* Whether to run in drymode or not
*
* @param boolean $dryRun
* @param bool $dryRun
* @return Installer
*/
public function setDryRun($dryRun = true)
@ -1287,7 +1286,7 @@ class Installer
/**
* prefer source installation
*
* @param boolean $preferSource
* @param bool $preferSource
* @return Installer
*/
public function setPreferSource($preferSource = true)
@ -1300,7 +1299,7 @@ class Installer
/**
* prefer dist installation
*
* @param boolean $preferDist
* @param bool $preferDist
* @return Installer
*/
public function setPreferDist($preferDist = true)
@ -1349,7 +1348,7 @@ class Installer
/**
* update packages
*
* @param boolean $update
* @param bool $update
* @return Installer
*/
public function setUpdate($update = true)
@ -1362,7 +1361,7 @@ class Installer
/**
* enables dev packages
*
* @param boolean $devMode
* @param bool $devMode
* @return Installer
*/
public function setDevMode($devMode = true)
@ -1375,7 +1374,7 @@ class Installer
/**
* set whether to run autoloader or not
*
* @param boolean $dumpAutoloader
* @param bool $dumpAutoloader
* @return Installer
*/
public function setDumpAutoloader($dumpAutoloader = true)
@ -1388,7 +1387,7 @@ class Installer
/**
* set whether to run scripts or not
*
* @param boolean $runScripts
* @param bool $runScripts
* @return Installer
*/
public function setRunScripts($runScripts = true)
@ -1414,7 +1413,7 @@ class Installer
/**
* run in verbose mode
*
* @param boolean $verbose
* @param bool $verbose
* @return Installer
*/
public function setVerbose($verbose = true)
@ -1437,7 +1436,7 @@ class Installer
/**
* set ignore Platform Package requirements
*
* @param boolean $ignorePlatformReqs
* @param bool $ignorePlatformReqs
* @return Installer
*/
public function setIgnorePlatformRequirements($ignorePlatformReqs = false)
@ -1464,7 +1463,7 @@ class Installer
/**
* Should dependencies of whitelisted packages be updated recursively?
*
* @param boolean $updateDependencies
* @param bool $updateDependencies
* @return Installer
*/
public function setWhitelistDependencies($updateDependencies = true)
@ -1477,7 +1476,7 @@ class Installer
/**
* Should packages be preferred in a stable version when updating?
*
* @param boolean $preferStable
* @param bool $preferStable
* @return Installer
*/
public function setPreferStable($preferStable = true)
@ -1490,7 +1489,7 @@ class Installer
/**
* Should packages be preferred in a lowest version when updating?
*
* @param boolean $preferLowest
* @param bool $preferLowest
* @return Installer
*/
public function setPreferLowest($preferLowest = true)

View File

@ -89,9 +89,8 @@ class InstallationManager
*
* @param string $type package type
*
* @return InstallerInterface
*
* @throws \InvalidArgumentException if installer for provided type is not registered
* @return InstallerInterface
*/
public function getInstaller($type)
{
@ -249,7 +248,7 @@ class InstallationManager
'header' => array('Content-type: application/x-www-form-urlencoded'),
'content' => http_build_query($params, '', '&'),
'timeout' => 3,
)
),
);
$context = StreamContextFactory::getContext($url, $opts);
@ -273,7 +272,7 @@ class InstallationManager
'header' => array('Content-Type: application/json'),
'content' => json_encode($postData),
'timeout' => 6,
)
),
);
$context = StreamContextFactory::getContext($repoUrl, $opts);

View File

@ -137,8 +137,8 @@ class JsonFile
* Validates the schema of the current json file according to composer-schema.json rules
*
* @param int $schema a JsonFile::*_SCHEMA constant
* @return bool true on success
* @throws JsonValidationException
* @return bool true on success
*/
public function validateSchema($schema = self::STRICT_SCHEMA)
{
@ -218,7 +218,7 @@ class JsonFile
/**
* Throws an exception according to a given code with a customized message
*
* @param int $code return code of json_last_error function
* @param int $code return code of json_last_error function
* @throws \RuntimeException
*/
private static function throwEncodeError($code)
@ -269,10 +269,10 @@ class JsonFile
*
* @param string $json
* @param string $file
* @return bool true on success
* @throws \UnexpectedValueException
* @throws JsonValidationException
* @throws ParsingException
* @return bool true on success
*/
protected static function validateSyntax($json, $file = null)
{

View File

@ -23,7 +23,6 @@ namespace Composer\Json;
class JsonFormatter
{
/**
*
* This code is based on the function found at:
* http://recursive-design.com/blog/2008/03/11/format-json-with-php/
*

View File

@ -162,7 +162,7 @@ class AliasPackage extends BasePackage implements CompletePackageInterface
}
/**
* @param array $links
* @param array $links
* @param string $linkType
* @internal param string $prettyVersion
* @return array

View File

@ -37,7 +37,7 @@ interface ArchiverInterface
* @param string $format The archive format
* @param string $sourceType The source type (git, svn, hg, etc.)
*
* @return boolean true if the format is supported by the archiver
* @return bool true if the format is supported by the archiver
*/
public function supports($format, $sourceType);
}

View File

@ -26,7 +26,7 @@ class HgExcludeFilter extends BaseExcludeFilter
/**
* Either HG_IGNORE_REGEX or HG_IGNORE_GLOB
* @var integer
* @var int
*/
protected $patternMode;

View File

@ -161,7 +161,7 @@ abstract class BasePackage implements PackageInterface
/**
* checks if this package is a platform package
*
* @return boolean
* @return bool
*/
public function isPlatform()
{

View File

@ -172,7 +172,7 @@ class CompletePackage extends Package implements CompletePackageInterface
}
/**
* @return boolean
* @return bool
*/
public function isAbandoned()
{
@ -180,7 +180,7 @@ class CompletePackage extends Package implements CompletePackageInterface
}
/**
* @param boolean|string $abandoned
* @param bool|string $abandoned
*/
public function setAbandoned($abandoned)
{

View File

@ -82,7 +82,7 @@ interface CompletePackageInterface extends PackageInterface
/**
* Returns if the package is abandoned or not
*
* @return boolean
* @return bool
*/
public function isAbandoned();

View File

@ -110,7 +110,7 @@ class Link
}
/**
* @param PackageInterface $sourcePackage
* @param PackageInterface $sourcePackage
* @return string
*/
public function getPrettyString(PackageInterface $sourcePackage)

View File

@ -245,7 +245,7 @@ class Locker
$lock = array(
'_readme' => array('This file locks the dependencies of your project to a known state',
'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file',
'This file is @gener'.'ated automatically'),
'This file is @gener'.'ated automatically', ),
'hash' => $this->hash,
'content-hash' => $this->contentHash,
'packages' => null,
@ -426,6 +426,7 @@ class Locker
}
ksort($relevantContent);
return md5(json_encode($relevantContent));
}
}

View File

@ -197,7 +197,7 @@ interface PackageInterface
*
* @see getPrettyVersion
*
* @param bool $truncate If the source reference is a sha1 hash, truncate it
* @param bool $truncate If the source reference is a sha1 hash, truncate it
* @return string version
*/
public function getFullPrettyVersion($truncate = true);

View File

@ -57,7 +57,7 @@ class VersionGuesser
/**
* @param array $packageConfig
* @param string $path Path to guess into
* @param string $path Path to guess into
*/
public function guessVersion(array $packageConfig, $path)
{

View File

@ -45,9 +45,9 @@ class PluginManager
/**
* Initializes plugin manager
*
* @param IOInterface $io
* @param Composer $composer
* @param Composer $globalComposer
* @param IOInterface $io
* @param Composer $composer
* @param Composer $globalComposer
*/
public function __construct(IOInterface $io, Composer $composer, Composer $globalComposer = null)
{

View File

@ -78,7 +78,7 @@ class ArtifactRepository extends ArrayRepository
/**
* Find a file by name, returning the one that has the shortest path.
*
* @param \ZipArchive $zip
* @param \ZipArchive $zip
* @param $filename
* @return bool|int
*/
@ -141,7 +141,7 @@ class ArtifactRepository extends ArrayRepository
$package['dist'] = array(
'type' => 'zip',
'url' => $file->getPathname(),
'shasum' => sha1_file($file->getRealPath())
'shasum' => sha1_file($file->getRealPath()),
);
$package = $this->loader->load($package);

View File

@ -586,7 +586,7 @@ class ComposerRepository extends ArrayRepository
// url-encode $ signs in URLs as bad proxies choke on them
if (($pos = strpos($filename, '$')) && preg_match('{^https?://.*}i', $filename)) {
$filename = substr($filename, 0, $pos) . '%24' . substr($filename, $pos+1);
$filename = substr($filename, 0, $pos) . '%24' . substr($filename, $pos + 1);
}
$retries = 3;

View File

@ -16,7 +16,6 @@ use Composer\Config;
use Composer\IO\IOInterface;
use Composer\Json\JsonFile;
use Composer\Package\Loader\ArrayLoader;
use Composer\Package\Loader\LoaderInterface;
use Composer\Package\Version\VersionGuesser;
use Composer\Semver\VersionParser;
use Composer\Util\ProcessExecutor;
@ -74,9 +73,9 @@ class PathRepository extends ArrayRepository
/**
* Initializes path repository.
*
* @param array $repoConfig
* @param array $repoConfig
* @param IOInterface $io
* @param Config $config
* @param Config $config
*/
public function __construct(array $repoConfig, IOInterface $io, Config $config)
{
@ -104,7 +103,7 @@ class PathRepository extends ArrayRepository
foreach ($this->getUrlMatches() as $url) {
$path = realpath($url) . '/';
$composerFilePath = $path.'composer.json';
if (!file_exists($composerFilePath)) {
continue;
}
@ -140,6 +139,6 @@ class PathRepository extends ArrayRepository
*/
private function getUrlMatches()
{
return glob($this->url, GLOB_MARK|GLOB_ONLYDIR);
return glob($this->url, GLOB_MARK | GLOB_ONLYDIR);
}
}

View File

@ -91,8 +91,8 @@ class RepositoryManager
*
* @param string $type repository type
* @param array $config repository configuration
* @return RepositoryInterface
* @throws \InvalidArgumentException if repository for provided type is not registered
* @return RepositoryInterface
*/
public function createRepository($type, $config)
{

View File

@ -119,7 +119,7 @@ class PerforceDriver extends VcsDriver
'type' => 'perforce',
'url' => $this->repoConfig['url'],
'reference' => $identifier,
'p4user' => $this->perforce->getUser()
'p4user' => $this->perforce->getUser(),
);
return $source;

View File

@ -77,14 +77,13 @@ interface VcsDriverInterface
* Return true if the repository has a composer file for a given identifier,
* false otherwise.
*
* @param string $identifier Any identifier to a specific branch/tag/commit
* @return boolean Whether the repository has a composer file for a given identifier.
* @param string $identifier Any identifier to a specific branch/tag/commit
* @return bool Whether the repository has a composer file for a given identifier.
*/
public function hasComposerFile($identifier);
/**
* Performs any cleanup necessary as the driver is not longer needed
*
*/
public function cleanup();

View File

@ -35,7 +35,7 @@ class Event extends BaseEvent
private $io;
/**
* @var boolean Dev mode flag
* @var bool Dev mode flag
*/
private $devMode;
@ -45,7 +45,7 @@ class Event extends BaseEvent
* @param string $name The event name
* @param Composer $composer The composer object
* @param IOInterface $io The IOInterface object
* @param boolean $devMode Whether or not we are in dev mode
* @param bool $devMode Whether or not we are in dev mode
* @param array $args Arguments passed by the user
* @param array $flags Optional flags to pass data not as argument
*/
@ -80,7 +80,7 @@ class Event extends BaseEvent
/**
* Return the dev mode flag
*
* @return boolean
* @return bool
*/
public function isDevMode()
{

View File

@ -38,8 +38,8 @@ class ConfigValidator
/**
* Validates the config, and returns the result.
*
* @param string $file The path to the file
* @param integer $arrayLoaderValidationFlags Flags for ArrayLoader validation
* @param string $file The path to the file
* @param int $arrayLoaderValidationFlags Flags for ArrayLoader validation
*
* @return array a triple containing the errors, publishable errors, and warnings
*/

View File

@ -88,10 +88,9 @@ class Filesystem
* Uses the process component if proc_open is enabled on the PHP
* installation.
*
* @param string $directory
* @return bool
*
* @param string $directory
* @throws \RuntimeException
* @return bool
*/
public function removeDirectory($directory)
{
@ -174,10 +173,9 @@ class Filesystem
/**
* Attempts to unlink a file and in case of failure retries after 350ms on windows
*
* @param string $path
* @return bool
*
* @param string $path
* @throws \RuntimeException
* @return bool
*/
public function unlink($path)
{
@ -200,10 +198,9 @@ class Filesystem
/**
* Attempts to rmdir a file and in case of failure retries after 350ms on windows
*
* @param string $path
* @return bool
*
* @param string $path
* @throws \RuntimeException
* @return bool
*/
public function rmdir($path)
{

View File

@ -105,9 +105,7 @@ class Git
return;
}
}
} elseif ( // private non-github repo that failed to authenticate
$this->isAuthenticationFailure($url, $match)
) {
} elseif ($this->isAuthenticationFailure($url, $match)) { // private non-github repo that failed to authenticate
if (strpos($match[2], '@')) {
list($authParts, $match[2]) = explode('@', $match[2], 2);
}
@ -119,7 +117,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;
}

View File

@ -114,7 +114,7 @@ class NoProxyPattern
* @param string $cidr IPv4 block in CIDR notation
* @param string $ip IPv4 address
*
* @return boolean
* @return bool
*/
private static function inCIDRBlock($cidr, $ip)
{

View File

@ -297,7 +297,7 @@ class Perforce
}
throw new \Exception('p4 command not found in path: ' . $errorOutput);
}
throw new \Exception('Invalid user name: ' . $this->getUser() );
throw new \Exception('Invalid user name: ' . $this->getUser());
}
return true;
@ -305,7 +305,7 @@ class Perforce
public function connectClient()
{
$p4CreateClientCommand = $this->generateP4Command('client -i < ' . str_replace( " ", "\\ ", $this->getP4ClientSpec() ));
$p4CreateClientCommand = $this->generateP4Command('client -i < ' . str_replace(" ", "\\ ", $this->getP4ClientSpec()));
$this->executeCommand($p4CreateClientCommand);
}

View File

@ -56,11 +56,11 @@ class RemoteFilesystem
/**
* Copy the remote file in local.
*
* @param string $originUrl The origin URL
* @param string $fileUrl The file URL
* @param string $fileName the local filename
* @param boolean $progress Display the progression
* @param array $options Additional context options
* @param string $originUrl The origin URL
* @param string $fileUrl The file URL
* @param string $fileName the local filename
* @param bool $progress Display the progression
* @param array $options Additional context options
*
* @return bool true
*/
@ -72,10 +72,10 @@ class RemoteFilesystem
/**
* Get the content.
*
* @param string $originUrl The origin URL
* @param string $fileUrl The file URL
* @param boolean $progress Display the progression
* @param array $options Additional context options
* @param string $originUrl The origin URL
* @param string $fileUrl The file URL
* @param bool $progress Display the progression
* @param array $options Additional context options
*
* @return bool|string The content
*/
@ -107,11 +107,11 @@ class RemoteFilesystem
/**
* Get file content or copy action.
*
* @param string $originUrl The origin URL
* @param string $fileUrl The file URL
* @param array $additionalOptions context options
* @param string $fileName the local filename
* @param boolean $progress Display the progression
* @param string $originUrl The origin URL
* @param string $fileUrl The file URL
* @param array $additionalOptions context options
* @param string $fileName the local filename
* @param bool $progress Display the progression
*
* @throws TransportException|\Exception
* @throws TransportException When the file could not be downloaded
@ -195,7 +195,7 @@ class RemoteFilesystem
$this->degradedMode = true;
$this->io->writeError(array(
'<error>'.$e->getMessage().'</error>',
'<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>'
'<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
));
return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
@ -253,7 +253,7 @@ class RemoteFilesystem
$this->degradedMode = true;
$this->io->writeError(array(
'<error>Failed to decode response: '.$e->getMessage().'</error>',
'<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>'
'<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
));
return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
@ -303,7 +303,7 @@ class RemoteFilesystem
$this->degradedMode = true;
$this->io->writeError(array(
'<error>'.$e->getMessage().'</error>',
'<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>'
'<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
));
return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
@ -322,12 +322,12 @@ class RemoteFilesystem
/**
* Get notification action.
*
* @param integer $notificationCode The notification code
* @param integer $severity The severity level
* @param int $notificationCode The notification code
* @param int $severity The severity level
* @param string $message The message
* @param integer $messageCode The message code
* @param integer $bytesTransferred The loaded size
* @param integer $bytesMax The total size
* @param int $messageCode The message code
* @param int $bytesTransferred The loaded size
* @param int $bytesMax The total size
* @throws TransportException
*/
protected function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax)
@ -436,7 +436,7 @@ class RemoteFilesystem
php_uname('s'),
php_uname('r'),
$phpVersion
)
),
);
if (extension_loaded('zlib')) {

View File

@ -26,8 +26,8 @@ final class StreamContextFactory
* @param string $url URL the context is to be used for
* @param array $defaultOptions Options to merge with the default
* @param array $defaultParams Parameters to specify on the context
* @return resource Default context
* @throws \RuntimeException if https proxy required and OpenSSL uninstalled
* @return resource Default context
*/
public static function getContext($url, array $defaultOptions = array(), array $defaultParams = array())
{

View File

@ -54,7 +54,7 @@ class Svn
protected $process;
/**
* @var integer
* @var int
*/
protected $qtyAuthTries = 0;
@ -94,9 +94,8 @@ class Svn
* @param string $path Target for a checkout
* @param bool $verbose Output all output to the user
*
* @return string
*
* @throws \RuntimeException
* @return string
*/
public function execute($command, $url, $cwd = null, $path = null, $verbose = false)
{
@ -147,7 +146,7 @@ class Svn
}
/**
* @param boolean $cacheCredentials
* @param bool $cacheCredentials
*/
public function setCacheCredentials($cacheCredentials)
{
@ -157,8 +156,8 @@ class Svn
/**
* Repositories requests credentials, let's put them in.
*
* @return \Composer\Util\Svn
* @throws \RuntimeException
* @return \Composer\Util\Svn
*/
protected function doAuthDance()
{
@ -229,8 +228,8 @@ class Svn
/**
* Get the password for the svn command. Can be empty.
*
* @return string
* @throws \LogicException
* @return string
*/
protected function getPassword()
{
@ -244,8 +243,8 @@ class Svn
/**
* Get the username for the svn command.
*
* @return string
* @throws \LogicException
* @return string
*/
protected function getUsername()
{

View File

@ -200,7 +200,7 @@ class AutoloadGeneratorTest extends TestCase
$package->setDevAutoload(array(
'files' => array('devfiles/foo.php'),
'psr-0' => array(
'Main' => 'tests/'
'Main' => 'tests/',
),
));
@ -381,7 +381,7 @@ class AutoloadGeneratorTest extends TestCase
$package->setAutoload(array(
'psr-0' => array('Prefix' => 'foo/bar/non/existing/'),
'psr-4' => array('Prefix\\' => 'foo/bar/non/existing2/')
'psr-4' => array('Prefix\\' => 'foo/bar/non/existing2/'),
));
$this->repository->expects($this->once())
@ -720,7 +720,7 @@ class AutoloadGeneratorTest extends TestCase
$mainPackage = new Package('z', '1.0', '1.0');
$mainPackage->setAutoload(array(
'psr-0' => array('A\\B' => $this->workingDir.'/lib'),
'classmap' => array($this->workingDir.'/src')
'classmap' => array($this->workingDir.'/src'),
));
$mainPackage->setRequires(array(new Link('z', 'a/a')));

View File

@ -35,7 +35,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
$data = array();
$data['local config inherits system defaults'] = array(
array(
'packagist' => array('type' => 'composer', 'url' => 'https?://packagist.org', 'allow_ssl_downgrade' => true)
'packagist' => array('type' => 'composer', 'url' => 'https?://packagist.org', 'allow_ssl_downgrade' => true),
),
array(),
);
@ -44,7 +44,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
array(),
array(
array('packagist' => false),
)
),
);
$data['local config adds above defaults'] = array(
@ -62,7 +62,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
$data['system config adds above core defaults'] = array(
array(
'example.com' => array('type' => 'composer', 'url' => 'http://example.com'),
'packagist' => array('type' => 'composer', 'url' => 'https?://packagist.org', 'allow_ssl_downgrade' => true)
'packagist' => array('type' => 'composer', 'url' => 'https?://packagist.org', 'allow_ssl_downgrade' => true),
),
array(),
array(
@ -73,11 +73,11 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
$data['local config can disable repos by name and re-add them anonymously to bring them above system config'] = array(
array(
0 => array('type' => 'composer', 'url' => 'http://packagist.org'),
'example.com' => array('type' => 'composer', 'url' => 'http://example.com')
'example.com' => array('type' => 'composer', 'url' => 'http://example.com'),
),
array(
array('packagist' => false),
array('type' => 'composer', 'url' => 'http://packagist.org')
array('type' => 'composer', 'url' => 'http://packagist.org'),
),
array(
'example.com' => array('type' => 'composer', 'url' => 'http://example.com'),
@ -87,10 +87,10 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
$data['local config can override by name to bring a repo above system config'] = array(
array(
'packagist' => array('type' => 'composer', 'url' => 'http://packagistnew.org'),
'example.com' => array('type' => 'composer', 'url' => 'http://example.com')
'example.com' => array('type' => 'composer', 'url' => 'http://example.com'),
),
array(
'packagist' => array('type' => 'composer', 'url' => 'http://packagistnew.org')
'packagist' => array('type' => 'composer', 'url' => 'http://packagistnew.org'),
),
array(
'example.com' => array('type' => 'composer', 'url' => 'http://example.com'),
@ -139,7 +139,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
$config->merge(array('config' => array(
'bin-dir' => '$HOME/foo',
'cache-dir' => '/baz/',
'vendor-dir' => 'vendor'
'vendor-dir' => 'vendor',
)));
$home = rtrim(getenv('HOME') ?: getenv('USERPROFILE'), '\\/');
@ -153,7 +153,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
$config = new Config(false, '/foo/bar');
$config->merge(array('config' => array(
'bin-dir' => '{$vendor-dir}/foo',
'vendor-dir' => 'vendor'
'vendor-dir' => 'vendor',
)));
$this->assertEquals('/foo/bar/vendor', $config->get('vendor-dir'));

View File

@ -503,7 +503,7 @@ class SolverTest extends TestCase
$this->repo->addPackage($packageX = $this->getPackage('X', '1.0'));
$packageX->setRequires(array(
'a' => new Link('X', 'A', $this->getVersionConstraint('>=', '2.0.0.0'), 'requires'),
'b' => new Link('X', 'B', $this->getVersionConstraint('>=', '2.0.0.0'), 'requires')
'b' => new Link('X', 'B', $this->getVersionConstraint('>=', '2.0.0.0'), 'requires'),
));
$this->repo->addPackage($packageA = $this->getPackage('A', '2.0.0'));
@ -522,7 +522,7 @@ class SolverTest extends TestCase
$this->repo->addPackage($packageS = $this->getPackage('S', '2.0.0'));
$packageS->setReplaces(array(
'a' => new Link('S', 'A', $this->getVersionConstraint('>=', '2.0.0.0'), 'replaces'),
'b' => new Link('S', 'B', $this->getVersionConstraint('>=', '2.0.0.0'), 'replaces')
'b' => new Link('S', 'B', $this->getVersionConstraint('>=', '2.0.0.0'), 'replaces'),
));
$this->reposComplete();
@ -850,13 +850,13 @@ class SolverTest extends TestCase
$result[] = array(
'job' => 'update',
'from' => $operation->getInitialPackage(),
'to' => $operation->getTargetPackage()
'to' => $operation->getTargetPackage(),
);
} else {
$job = ('uninstall' === $operation->getJobType() ? 'remove' : 'install');
$result[] = array(
'job' => $job,
'package' => $operation->getPackage()
'package' => $operation->getPackage(),
);
}
}

View File

@ -46,7 +46,7 @@ class PearPackageExtractorTest extends \PHPUnit_Framework_TestCase
'to' => 'PEAR/Frontend/Gtk/xpm/black_close_icon.xpm',
'role' => 'php',
'tasks' => array(),
)
),
);
$this->assertSame($expectedFileActions, $fileActions);
}
@ -69,7 +69,7 @@ class PearPackageExtractorTest extends \PHPUnit_Framework_TestCase
'to' => 'Net/URL.php',
'role' => 'php',
'tasks' => array(),
)
),
);
$this->assertSame($expectedFileActions, $fileActions);
}
@ -99,16 +99,16 @@ class PearPackageExtractorTest extends \PHPUnit_Framework_TestCase
'role' => 'php',
'tasks' => array(),
),
'php/Test.php' => array (
'php/Test.php' => array(
'from' => 'Zend_Authentication-2.0.0beta4/php/Test.php',
'to' => '/php/Test.php',
'role' => 'script',
'tasks' => array (
array (
'tasks' => array(
array(
'from' => '@version@',
'to' => 'version',
)
)
),
),
),
'renamedFile.php' => array(
'from' => 'Zend_Authentication-2.0.0beta4/renamedFile.php',

View File

@ -28,7 +28,7 @@ class EventDispatcherTest extends TestCase
{
$io = $this->getMock('Composer\IO\IOInterface');
$dispatcher = $this->getDispatcherStubForListenersTest(array(
'Composer\Test\EventDispatcher\EventDispatcherTest::call'
'Composer\Test\EventDispatcher\EventDispatcherTest::call',
), $io);
$io->expects($this->at(0))
@ -50,7 +50,7 @@ class EventDispatcherTest extends TestCase
{
$io = $this->getMock('Composer\IO\IOInterface');
$dispatcher = $this->getDispatcherStubForListenersTest(array(
'Composer\Test\EventDispatcher\EventDispatcherTest::expectsCommandEvent'
'Composer\Test\EventDispatcher\EventDispatcherTest::expectsCommandEvent',
), $io);
$this->assertEquals(1, $dispatcher->dispatchScript(ScriptEvents::POST_INSTALL_CMD, false));
@ -60,7 +60,7 @@ class EventDispatcherTest extends TestCase
{
$io = $this->getMock('Composer\IO\IOInterface');
$dispatcher = $this->getDispatcherStubForListenersTest(array(
'Composer\Test\EventDispatcher\EventDispatcherTest::expectsVariableEvent'
'Composer\Test\EventDispatcher\EventDispatcherTest::expectsVariableEvent',
), $io);
$this->assertEquals(1, $dispatcher->dispatchScript(ScriptEvents::POST_INSTALL_CMD, false));

View File

@ -107,7 +107,7 @@ class InstallerTest extends TestCase
$a,
new ArrayRepository(array($b)),
array(
'install' => array($b)
'install' => array($b),
),
);
@ -127,7 +127,7 @@ class InstallerTest extends TestCase
$a,
new ArrayRepository(array($a, $b)),
array(
'install' => array($b)
'install' => array($b),
),
);

View File

@ -44,7 +44,7 @@ class ComposerSchemaTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(array(
array(
'property' => 'minimum-stability',
'message' => 'Does not match the regex pattern ^dev|alpha|beta|rc|RC|stable$'
'message' => 'Does not match the regex pattern ^dev|alpha|beta|rc|RC|stable$',
),
), $this->check($json), 'empty string');
@ -52,7 +52,7 @@ class ComposerSchemaTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(array(
array(
'property' => 'minimum-stability',
'message' => 'Does not match the regex pattern ^dev|alpha|beta|rc|RC|stable$'
'message' => 'Does not match the regex pattern ^dev|alpha|beta|rc|RC|stable$',
),
), $this->check($json), 'dummy');

View File

@ -38,7 +38,7 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
" \"require\": {\n".
" \"vendor/baz\": \"qux\"\n".
" }\n".
"}\n"
"}\n",
),
array(
'{
@ -53,7 +53,7 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
"vendor/baz": "qux"
}
}
'
',
),
array(
'{
@ -68,7 +68,7 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
"vendor/baz": "qux"
}
}
'
',
),
array(
'{
@ -87,7 +87,7 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
"vendor/baz": "qux"
}
}
'
',
),
array(
'{
@ -107,7 +107,7 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
"vendor/baz": "qux"
}
}
'
',
),
array(
'{
@ -127,7 +127,7 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
"vendor/baz": "qux"
}
}
'
',
),
array(
'{
@ -159,7 +159,7 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
}
}]
}
'
',
),
array(
'{
@ -188,7 +188,7 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
"foo": "qux"
}
}
'
',
),
array(
'{
@ -207,7 +207,7 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
"foo": "qux"
}
}
'
',
),
array(
'{
@ -229,7 +229,7 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
"foo": "qux"
}
}
'
',
),
array(
'{
@ -277,7 +277,7 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
"foo": "qux"
}
}
'
',
),
);
}
@ -311,7 +311,7 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
"vendor/baz": "qux"
}
}
'
',
),
array(
'{
@ -329,7 +329,7 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
"foo": "bar"
}
}
'
',
),
array(
'{
@ -401,7 +401,7 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
}
}
}
'
',
),
'works on simple ones last' => array(
'{
@ -426,7 +426,7 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
}
}
}
'
',
),
'works on simple ones unique' => array(
'{
@ -443,7 +443,7 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
"repositories": {
}
}
'
',
),
'works on simple ones middle' => array(
'{
@ -476,7 +476,7 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
}
}
}
'
',
),
'works on undefined ones' => array(
'{
@ -497,7 +497,7 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
}
}
}
'
',
),
'works on child having unmatched name' => array(
'{
@ -518,7 +518,7 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
}
}
}
'
',
),
'works on child having duplicate name' => array(
'{
@ -541,7 +541,7 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
}
}
}
'
',
),
'works on empty repos' => array(
'{
@ -549,19 +549,19 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
}
}',
'bar',
true
true,
),
'works on empty repos2' => array(
'{
"repositories": {}
}',
'bar',
true
true,
),
'works on missing repos' => array(
"{\n}",
'bar',
true
true,
),
'works on deep repos' => array(
'{
@ -577,7 +577,7 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
"repositories": {
}
}
'
',
),
'fails on deep repos with borked texts' => array(
'{
@ -588,7 +588,7 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
}
}',
'bar',
false
false,
),
'fails on deep repos with borked texts2' => array(
'{
@ -599,7 +599,7 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
}
}',
'bar',
false
false,
),
'fails on deep arrays with borked texts' => array(
'{
@ -610,7 +610,7 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
]
}',
'bar',
false
false,
),
'fails on deep arrays with borked texts2' => array(
'{
@ -621,7 +621,7 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
]
}',
'bar',
false
false,
),
);
}

View File

@ -36,7 +36,7 @@ class JsonValidationExceptionTest extends \PHPUnit_Framework_TestCase
{
return array(
array('test message', array()),
array(null, null)
array(null, null),
);
}
}

View File

@ -14,7 +14,6 @@ namespace Composer\Test\Package\Archiver;
use Composer\Package\Archiver\ArchivableFilesFinder;
use Composer\Util\Filesystem;
use Symfony\Component\Process\Process;
use Symfony\Component\Process\ExecutableFinder;
@ -287,7 +286,7 @@ class ArchivableFilesFinderTest extends \PHPUnit_Framework_TestCase
*
* @param string $process The name of the binary to test.
*
* @return boolean True if the process is available, false otherwise.
* @return bool True if the process is available, false otherwise.
*/
protected function isProcessAvailable($process)
{

View File

@ -54,22 +54,22 @@ class BasePackageTest extends \PHPUnit_Framework_TestCase
array(
'sourceReference' => 'v2.1.0-RC2',
'truncate' => true,
'expected' => 'PrettyVersion v2.1.0-RC2'
'expected' => 'PrettyVersion v2.1.0-RC2',
),
array(
'sourceReference' => 'bbf527a27356414bfa9bf520f018c5cb7af67c77',
'truncate' => true,
'expected' => 'PrettyVersion bbf527a'
'expected' => 'PrettyVersion bbf527a',
),
array(
'sourceReference' => 'v1.0.0',
'truncate' => false,
'expected' => 'PrettyVersion v1.0.0'
'expected' => 'PrettyVersion v1.0.0',
),
array(
'sourceReference' => 'bbf527a27356414bfa9bf520f018c5cb7af67c77',
'truncate' => false,
'expected' => 'PrettyVersion bbf527a27356414bfa9bf520f018c5cb7af67c77'
'expected' => 'PrettyVersion bbf527a27356414bfa9bf520f018c5cb7af67c77',
),
);

View File

@ -45,7 +45,7 @@ class ArrayDumperTest extends \PHPUnit_Framework_TestCase
array(
'name' => 'foo',
'version' => '1.0',
'version_normalized' => '1.0.0.0'
'version_normalized' => '1.0.0.0',
),
$config
);
@ -100,7 +100,7 @@ class ArrayDumperTest extends \PHPUnit_Framework_TestCase
return array(
array(
'type',
'library'
'library',
),
array(
'time',
@ -110,46 +110,46 @@ class ArrayDumperTest extends \PHPUnit_Framework_TestCase
),
array(
'authors',
array('Nils Adermann <naderman@naderman.de>', 'Jordi Boggiano <j.boggiano@seld.be>')
array('Nils Adermann <naderman@naderman.de>', 'Jordi Boggiano <j.boggiano@seld.be>'),
),
array(
'homepage',
'https://getcomposer.org'
'https://getcomposer.org',
),
array(
'description',
'Dependency Manager'
'Dependency Manager',
),
array(
'keywords',
array('package', 'dependency', 'autoload'),
null,
array('autoload', 'dependency', 'package')
array('autoload', 'dependency', 'package'),
),
array(
'bin',
array('bin/composer'),
'binaries'
'binaries',
),
array(
'license',
array('MIT')
array('MIT'),
),
array(
'autoload',
array('psr-0' => array('Composer' => 'src/'))
array('psr-0' => array('Composer' => 'src/')),
),
array(
'repositories',
array('packagist' => false)
array('packagist' => false),
),
array(
'scripts',
array('post-update-cmd' => 'MyVendor\\MyClass::postUpdate')
array('post-update-cmd' => 'MyVendor\\MyClass::postUpdate'),
),
array(
'extra',
array('class' => 'MyVendor\\Installer')
array('class' => 'MyVendor\\Installer'),
),
array(
'archive',
@ -174,7 +174,7 @@ class ArrayDumperTest extends \PHPUnit_Framework_TestCase
array(
'suggest',
array('foo/bar' => 'very useful package'),
'suggests'
'suggests',
),
array(
'support',
@ -184,43 +184,43 @@ class ArrayDumperTest extends \PHPUnit_Framework_TestCase
'require',
array(new Link('foo', 'foo/bar', new Constraint('=', '1.0.0.0'), 'requires', '1.0.0'), new Link('bar', 'bar/baz', new Constraint('=', '1.0.0.0'), 'requires', '1.0.0')),
'requires',
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0')
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0'),
),
array(
'require-dev',
array(new Link('foo', 'foo/bar', new Constraint('=', '1.0.0.0'), 'requires', '1.0.0'), new Link('bar', 'bar/baz', new Constraint('=', '1.0.0.0'), 'requires', '1.0.0')),
'devRequires',
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0')
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0'),
),
array(
'suggest',
array('foo/bar' => 'very useful package', 'bar/baz' => 'another useful package'),
'suggests',
array('bar/baz' => 'another useful package', 'foo/bar' => 'very useful package')
array('bar/baz' => 'another useful package', 'foo/bar' => 'very useful package'),
),
array(
'provide',
array(new Link('foo', 'foo/bar', new Constraint('=', '1.0.0.0'), 'requires', '1.0.0'), new Link('bar', 'bar/baz', new Constraint('=', '1.0.0.0'), 'requires', '1.0.0')),
'provides',
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0')
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0'),
),
array(
'replace',
array(new Link('foo', 'foo/bar', new Constraint('=', '1.0.0.0'), 'requires', '1.0.0'), new Link('bar', 'bar/baz', new Constraint('=', '1.0.0.0'), 'requires', '1.0.0')),
'replaces',
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0')
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0'),
),
array(
'conflict',
array(new Link('foo', 'foo/bar', new Constraint('=', '1.0.0.0'), 'requires', '1.0.0'), new Link('bar', 'bar/baz', new Constraint('=', '1.0.0.0'), 'requires', '1.0.0')),
'conflicts',
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0')
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0'),
),
array(
'transport-options',
array('ssl' => array('local_cert' => '/opt/certs/test.pem')),
'transportOptions'
)
'transportOptions',
),
);
}

View File

@ -17,7 +17,6 @@ use Composer\Package\Dumper\ArrayDumper;
class ArrayLoaderTest extends \PHPUnit_Framework_TestCase
{
/**
* @var ArrayLoader
*/
@ -124,7 +123,7 @@ class ArrayLoaderTest extends \PHPUnit_Framework_TestCase
'exclude' => array('/foo/bar', 'baz', '!/foo/bar/baz'),
),
'transport-options' => array('ssl' => array('local_cert' => '/opt/certs/test.pem')),
'abandoned' => 'foo/bar'
'abandoned' => 'foo/bar',
);
$package = $this->loader->load($config);
@ -195,7 +194,7 @@ class ArrayLoaderTest extends \PHPUnit_Framework_TestCase
$config = array(
'name' => 'A',
'version' => '1.2.3.4',
'abandoned' => 'foo/bar'
'abandoned' => 'foo/bar',
);
$package = $this->loader->load($config);
@ -207,7 +206,7 @@ class ArrayLoaderTest extends \PHPUnit_Framework_TestCase
{
$config = array(
'name' => 'A',
'version' => '1.2.3.4'
'version' => '1.2.3.4',
);
$package = $this->loader->load($config);

View File

@ -41,7 +41,7 @@ class RootPackageLoaderTest extends \PHPUnit_Framework_TestCase
'foo/bar' => '~2.1.0-beta2',
'bar/baz' => '1.0.x-dev as 1.2.0',
'qux/quux' => '1.0.*@rc',
'zux/complex' => '~1.0,>=1.0.2@dev'
'zux/complex' => '~1.0,>=1.0.2@dev',
),
'minimum-stability' => 'alpha',
));
@ -83,8 +83,6 @@ class RootPackageLoaderTest extends \PHPUnit_Framework_TestCase
$this->assertEquals("No version set (parsed as 1.0.0)", $package->getPrettyVersion());
}
public function testFeatureBranchPrettyVersion()
{
if (!function_exists('proc_open')) {

View File

@ -118,7 +118,7 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase
array(
'type' => 'composer',
'url' => 'https://packagist.org/',
)
),
),
'config' => array(
'bin-dir' => 'bin',
@ -139,14 +139,14 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase
'branch-alias' => array(
'dev-master' => '2.0-dev',
'dev-old' => '1.0.x-dev',
'3.x-dev' => '3.1.x-dev'
'3.x-dev' => '3.1.x-dev',
),
),
'bin' => array(
'bin/foo',
'bin/bar',
),
'transport-options' => array('ssl' => array('local_cert' => '/opt/certs/test.pem'))
'transport-options' => array('ssl' => array('local_cert' => '/opt/certs/test.pem')),
),
),
array( // test as array
@ -220,8 +220,8 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase
'name' => 'foo',
),
array(
'name : invalid value (foo), must match [A-Za-z0-9][A-Za-z0-9_.-]*/[A-Za-z0-9][A-Za-z0-9_.-]*'
)
'name : invalid value (foo), must match [A-Za-z0-9][A-Za-z0-9_.-]*/[A-Za-z0-9][A-Za-z0-9_.-]*',
),
),
array(
array(
@ -230,7 +230,7 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase
),
array(
'homepage : should be a string, integer given',
)
),
),
array(
array(
@ -241,7 +241,7 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase
),
array(
'support.source : invalid value, must be a string',
)
),
),
array(
array(
@ -249,8 +249,8 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase
'autoload' => 'strings',
),
array(
'autoload : should be an array, string given'
)
'autoload : should be an array, string given',
),
),
array(
array(
@ -262,8 +262,8 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase
),
),
array(
'autoload : invalid value (psr0), must be one of psr-0, psr-4, classmap, files'
)
'autoload : invalid value (psr0), must be one of psr-0, psr-4, classmap, files',
),
),
array(
array(
@ -271,8 +271,8 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase
'transport-options' => 'test',
),
array(
'transport-options : should be an array, string given'
)
'transport-options : should be an array, string given',
),
),
);
}
@ -286,8 +286,8 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase
'homepage' => 'foo:bar',
),
array(
'homepage : invalid value (foo:bar), must be an http/https URL'
)
'homepage : invalid value (foo:bar), must be an http/https URL',
),
),
array(
array(
@ -304,7 +304,7 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase
'support.forum : invalid value (foo:bar), must be an http/https URL',
'support.issues : invalid value (foo:bar), must be an http/https URL',
'support.wiki : invalid value (foo:bar), must be an http/https URL',
)
),
),
array(
array(
@ -322,35 +322,35 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase
'require.bar/foo : unbound version constraints (dev-master) should be avoided',
'require.bar/hacked : unbound version constraints (@stable) should be avoided',
),
false
false,
),
array(
array(
'name' => 'foo/bar',
'extra' => array(
'branch-alias' => array(
'5.x-dev' => '3.1.x-dev'
'5.x-dev' => '3.1.x-dev',
),
)
),
),
array(
'extra.branch-alias.5.x-dev : the target branch (3.1.x-dev) is not a valid numeric alias for this version'
'extra.branch-alias.5.x-dev : the target branch (3.1.x-dev) is not a valid numeric alias for this version',
),
false
false,
),
array(
array(
'name' => 'foo/bar',
'extra' => array(
'branch-alias' => array(
'5.x-dev' => '3.1-dev'
'5.x-dev' => '3.1-dev',
),
)
),
),
array(
'extra.branch-alias.5.x-dev : the target branch (3.1-dev) is not a valid numeric alias for this version'
'extra.branch-alias.5.x-dev : the target branch (3.1-dev) is not a valid numeric alias for this version',
),
false
false,
),
);
}

View File

@ -71,8 +71,8 @@ class LockerTest extends \PHPUnit_Framework_TestCase
->will($this->returnValue(array(
'packages' => array(
array('name' => 'pkg1', 'version' => '1.0.0-beta'),
array('name' => 'pkg2', 'version' => '0.1.10')
)
array('name' => 'pkg2', 'version' => '0.1.10'),
),
)));
$repo = $locker->getLockedRepository();
@ -127,12 +127,12 @@ class LockerTest extends \PHPUnit_Framework_TestCase
->with(array(
'_readme' => array('This file locks the dependencies of your project to a known state',
'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file',
'This file is @gener'.'ated automatically'),
'This file is @gener'.'ated automatically', ),
'hash' => $hash,
'content-hash' => $contentHash,
'packages' => array(
array('name' => 'pkg1', 'version' => '1.0.0-beta'),
array('name' => 'pkg2', 'version' => '0.1.10')
array('name' => 'pkg2', 'version' => '0.1.10'),
),
'packages-dev' => array(),
'aliases' => array(),

View File

@ -216,7 +216,7 @@ class PluginInstallerTest extends TestCase
}
/**
* @param string $newPluginApiVersion
* @param string $newPluginApiVersion
* @param CompletePackage[] $plugins
*/
private function setPluginApiVersionWithPlugins($newPluginApiVersion, array $plugins = array())

View File

@ -75,8 +75,8 @@ class ComposerRepositoryTest extends TestCase
array('foo/bar' => array(
'name' => 'foo/bar',
'versions' => array(
'1.0.0' => array('name' => 'foo/bar', 'version' => '1.0.0')
)
'1.0.0' => array('name' => 'foo/bar', 'version' => '1.0.0'),
),
)),
),
// New repository format
@ -110,7 +110,7 @@ class ComposerRepositoryTest extends TestCase
$properties = array(
'cache' => $cache,
'loader' => new ArrayLoader(),
'providerListing' => array('p/a.json' => array('sha256' => 'xxx'))
'providerListing' => array('p/a.json' => array('sha256' => 'xxx')),
);
foreach ($properties as $property => $value) {
@ -140,7 +140,7 @@ class ComposerRepositoryTest extends TestCase
'name' => 'a',
'version' => '0.6',
)),
)
),
)));
$pool = $this->getMock('Composer\DependencyResolver\Pool');

View File

@ -26,7 +26,7 @@ class FilesystemRepositoryTest extends TestCase
->expects($this->once())
->method('read')
->will($this->returnValue(array(
array('name' => 'package1', 'version' => '1.0.0-beta', 'type' => 'vendor')
array('name' => 'package1', 'version' => '1.0.0-beta', 'type' => 'vendor'),
)));
$json
->expects($this->once())
@ -94,7 +94,7 @@ class FilesystemRepositoryTest extends TestCase
->expects($this->once())
->method('write')
->with(array(
array('name' => 'mypkg', 'type' => 'library', 'version' => '0.1.10', 'version_normalized' => '0.1.10.0')
array('name' => 'mypkg', 'type' => 'library', 'version' => '0.1.10', 'version_normalized' => '0.1.10.0'),
));
$repository->addPackage($this->getPackage('mypkg', '0.1.10'));

View File

@ -15,9 +15,6 @@ namespace Composer\Repository;
use Composer\Package\Loader\ArrayLoader;
use Composer\Semver\VersionParser;
use Composer\TestCase;
use Composer\IO\NullIO;
use Composer\Config;
use Composer\Package\BasePackage;
class PathRepositoryTest extends TestCase
{

View File

@ -106,18 +106,18 @@ class ChannelReaderTest extends TestCase
'ext',
'xml'
),
)
),
)
)
)
),
)
)
),
)
);
$packages = $ref->invoke($reader, $channelInfo, new VersionParser());
$expectedPackage = new CompletePackage('pear-test.loc/sample', '1.0.0.1' , '1.0.0.1');
$expectedPackage = new CompletePackage('pear-test.loc/sample', '1.0.0.1', '1.0.0.1');
$expectedPackage->setType('pear-library');
$expectedPackage->setDistType('file');
$expectedPackage->setDescription('description');

View File

@ -40,7 +40,7 @@ class PearRepositoryTest extends TestCase
);
$repoConfig = array(
'url' => $url
'url' => $url,
);
$this->createRepository($repoConfig);
@ -64,7 +64,7 @@ class PearRepositoryTest extends TestCase
public function testRepositoryRead($url, array $expectedPackages)
{
$repoConfig = array(
'url' => $url
'url' => $url,
);
if (!@file_get_contents('http://'.$url)) {
@ -88,37 +88,37 @@ class PearRepositoryTest extends TestCase
'pear.php.net',
array(
array('name' => 'pear-pear.php.net/PEAR', 'version' => '1.9.4'),
)
),
),
array(
'pear.pdepend.org',
array(
array('name' => 'pear-pear.pdepend.org/PHP_Depend', 'version' => '1.0.5'),
)
),
),
array(
'pear.phpmd.org',
array(
array('name' => 'pear-pear.phpmd.org/PHP_PMD', 'version' => '1.3.3'),
)
),
),
array(
'pear.doctrine-project.org',
array(
array('name' => 'pear-pear.doctrine-project.org/DoctrineORM', 'version' => '2.2.2'),
)
),
),
array(
'pear.symfony-project.com',
array(
array('name' => 'pear-pear.symfony-project.com/YAML', 'version' => '1.0.6'),
)
),
),
array(
'pear.pirum-project.org',
array(
array('name' => 'pear-pear.pirum-project.org/Pirum', 'version' => '1.1.4'),
)
),
),
);
}

View File

@ -18,8 +18,8 @@ use RecursiveArrayIterator;
use RecursiveIteratorIterator;
/**
* @author Rob Bast <rob.bast@gmail.com>
*/
* @author Rob Bast <rob.bast@gmail.com>
*/
class GitHubTest extends \PHPUnit_Framework_TestCase
{
private $username = 'username';

View File

@ -53,7 +53,7 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
'depot' => self::TEST_DEPOT,
'branch' => self::TEST_BRANCH,
'p4user' => self::TEST_P4USER,
'unique_perforce_client_name' => self::TEST_CLIENT_NAME
'unique_perforce_client_name' => self::TEST_CLIENT_NAME,
);
}
@ -222,9 +222,9 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
'depot' => 'depot',
'branch' => 'branch',
'p4user' => 'user',
'p4password' => 'TEST_PASSWORD'
'p4password' => 'TEST_PASSWORD',
);
$this->perforce = new Perforce($repoConfig, 'port', 'path', $this->processExecutor, false, $this->getMockIOInterface(), 'TEST');
$this->perforce = new Perforce($repoConfig, 'port', 'path', $this->processExecutor, false, $this->getMockIOInterface(), 'TEST');
$password = $this->perforce->queryP4Password();
$this->assertEquals('TEST_PASSWORD', $password);
}
@ -476,7 +476,7 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
'name' => 'test/perforce',
'description' => 'Basic project for testing',
'minimum-stability' => 'dev',
'autoload' => array('psr-0' => array())
'autoload' => array('psr-0' => array()),
);
$this->assertEquals($expected, $result);
}
@ -517,7 +517,7 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
'name' => 'test/perforce',
'description' => 'Basic project for testing',
'minimum-stability' => 'dev',
'autoload' => array('psr-0' => array())
'autoload' => array('psr-0' => array()),
);
$this->assertEquals($expected, $result);
}
@ -546,7 +546,7 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
'name' => 'test/perforce',
'description' => 'Basic project for testing',
'minimum-stability' => 'dev',
'autoload' => array('psr-0' => array())
'autoload' => array('psr-0' => array()),
);
$this->assertEquals($expected, $result);
}
@ -588,7 +588,7 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
'name' => 'test/perforce',
'description' => 'Basic project for testing',
'minimum-stability' => 'dev',
'autoload' => array('psr-0' => array())
'autoload' => array('psr-0' => array()),
);
$this->assertEquals($expected, $result);
}
@ -662,7 +662,7 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
'"psr-0" : {',
'}',
'}',
'}'
'}',
);
return implode($composer_json);
@ -688,7 +688,7 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
'SubmitOptions: revertunchanged',
PHP_EOL,
'LineEnd: local',
PHP_EOL
PHP_EOL,
);
if ($withStream) {
$expectedArray[] = 'Stream:';

View File

@ -52,11 +52,11 @@ class StreamContextFactoryTest extends \PHPUnit_Framework_TestCase
return array(
array(
$a = array('http' => array('follow_location' => 1, 'max_redirects' => 20)), array(),
array('options' => $a), array()
array('options' => $a), array(),
),
array(
$a = array('http' => array('method' => 'GET', 'max_redirects' => 20, 'follow_location' => 1)), array('http' => array('method' => 'GET')),
array('options' => $a, 'notification' => $f = function () {}), array('notification' => $f)
array('options' => $a, 'notification' => $f = function () {}), array('notification' => $f),
),
);
}
@ -143,8 +143,8 @@ class StreamContextFactoryTest extends \PHPUnit_Framework_TestCase
'follow_location' => 1,
), 'ssl' => array(
'SNI_enabled' => true,
'SNI_server_name' => 'example.org'
)
'SNI_server_name' => 'example.org',
),
);
if (PHP_VERSION_ID >= 50600) {
unset($expected['ssl']['SNI_server_name']);
@ -173,8 +173,8 @@ class StreamContextFactoryTest extends \PHPUnit_Framework_TestCase
'follow_location' => 1,
), 'ssl' => array(
'SNI_enabled' => true,
'SNI_server_name' => 'example.org'
)
'SNI_server_name' => 'example.org',
),
);
if (PHP_VERSION_ID >= 50600) {
unset($expected['ssl']['SNI_server_name']);
@ -221,17 +221,17 @@ class StreamContextFactoryTest extends \PHPUnit_Framework_TestCase
{
$options = array(
'http' => array(
'header' => "X-Foo: bar\r\nContent-Type: application/json\r\nAuthorization: Basic aW52YWxpZA=="
)
'header' => "X-Foo: bar\r\nContent-Type: application/json\r\nAuthorization: Basic aW52YWxpZA==",
),
);
$expectedOptions = array(
'http' => array(
'header' => array(
"X-Foo: bar",
"Authorization: Basic aW52YWxpZA==",
"Content-Type: application/json"
)
)
"Content-Type: application/json",
),
),
);
$context = StreamContextFactory::getContext('http://example.org', $options);
$ctxoptions = stream_context_get_options($context);

View File

@ -60,9 +60,9 @@ class SvnTest extends \PHPUnit_Framework_TestCase
$config->merge(array(
'config' => array(
'http-basic' => array(
'svn.apache.org' => array('username' => 'foo', 'password' => 'bar')
)
)
'svn.apache.org' => array('username' => 'foo', 'password' => 'bar'),
),
),
));
$svn = new Svn($url, new NullIO, $config);
@ -81,9 +81,9 @@ class SvnTest extends \PHPUnit_Framework_TestCase
array(
'config' => array(
'http-basic' => array(
'svn.apache.org' => array('username' => 'foo', 'password' => 'bar')
)
)
'svn.apache.org' => array('username' => 'foo', 'password' => 'bar'),
),
),
)
);
@ -104,9 +104,9 @@ class SvnTest extends \PHPUnit_Framework_TestCase
array(
'config' => array(
'http-basic' => array(
'svn.apache.org' => array('username' => 'foo', 'password' => 'bar')
)
)
'svn.apache.org' => array('username' => 'foo', 'password' => 'bar'),
),
),
)
);