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

View File

@ -49,9 +49,8 @@ class ClassMapGenerator
* @param IOInterface $io IO object * @param IOInterface $io IO object
* @param string $namespace Optional namespace prefix to filter by * @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 * @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) 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\CommandEvent;
use Composer\Plugin\PluginEvents; use Composer\Plugin\PluginEvents;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;

View File

@ -278,7 +278,7 @@ EOT
'use-include-path' => array($booleanValidator, $booleanNormalizer), 'use-include-path' => array($booleanValidator, $booleanNormalizer),
'preferred-install' => array( 'preferred-install' => array(
function ($val) { return in_array($val, array('auto', 'source', 'dist'), true); }, function ($val) { return in_array($val, array('auto', 'source', 'dist'), true); },
function ($val) { return $val; } function ($val) { return $val; },
), ),
'store-auths' => array( 'store-auths' => array(
function ($val) { return in_array($val, array('true', 'false', 'prompt'), true); }, function ($val) { return in_array($val, array('true', 'false', 'prompt'), true); },
@ -288,7 +288,7 @@ EOT
} }
return $val !== 'false' && (bool) $val; return $val !== 'false' && (bool) $val;
} },
), ),
'notify-on-install' => array($booleanValidator, $booleanNormalizer), 'notify-on-install' => array($booleanValidator, $booleanNormalizer),
'vendor-dir' => array('is_string', function ($val) { return $val; }), 'vendor-dir' => array('is_string', function ($val) { return $val; }),
@ -301,7 +301,7 @@ EOT
'cache-files-ttl' => array('is_numeric', 'intval'), 'cache-files-ttl' => array('is_numeric', 'intval'),
'cache-files-maxsize' => array( 'cache-files-maxsize' => array(
function ($val) { return preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $val) > 0; }, 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( 'discard-changes' => array(
function ($val) { return in_array($val, array('stash', 'true', 'false', '1', '0'), true); }, function ($val) { return in_array($val, array('stash', 'true', 'false', '1', '0'), true); },
@ -311,7 +311,7 @@ EOT
} }
return $val !== 'false' && (bool) $val; return $val !== 'false' && (bool) $val;
} },
), ),
'autoloader-suffix' => array('is_string', function ($val) { return $val === 'null' ? null : $val; }), 'autoloader-suffix' => array('is_string', function ($val) { return $val === 'null' ? null : $val; }),
'optimize-autoloader' => array($booleanValidator, $booleanNormalizer), 'optimize-autoloader' => array($booleanValidator, $booleanNormalizer),
@ -336,7 +336,7 @@ EOT
}, },
function ($vals) { function ($vals) {
return $vals; return $vals;
} },
), ),
'github-domains' => array( 'github-domains' => array(
function ($vals) { function ($vals) {
@ -348,7 +348,7 @@ EOT
}, },
function ($vals) { function ($vals) {
return $vals; return $vals;
} },
), ),
); );

View File

@ -347,8 +347,8 @@ EOT
* Updated preferSource or preferDist based on the preferredInstall config option * Updated preferSource or preferDist based on the preferredInstall config option
* @param Config $config * @param Config $config
* @param InputInterface $input * @param InputInterface $input
* @param boolean $preferSource * @param bool $preferSource
* @param boolean $preferDist * @param bool $preferDist
*/ */
protected function updatePreferredOptions(Config $config, InputInterface $input, &$preferSource, &$preferDist, $keepVcsRequiresPreferSource = false) 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'; $url = $domain === 'github.com' ? 'https://api.'.$domain.'/user/repos' : 'https://'.$domain.'/api/v3/user/repos';
return $this->rfs->getContents($domain, $url, false, array( return $this->rfs->getContents($domain, $url, false, array(
'retry-auth-failure' => false 'retry-auth-failure' => false,
)) ? true : 'Unexpected error'; )) ? true : 'Unexpected error';
} catch (\Exception $e) { } catch (\Exception $e) {
if ($e instanceof TransportException && $e->getCode() === 401) { if ($e instanceof TransportException && $e->getCode() === 401) {
@ -278,8 +278,8 @@ EOT
/** /**
* @param string $domain * @param string $domain
* @param string $token * @param string $token
* @return array
* @throws TransportException * @throws TransportException
* @return array
*/ */
private function getGithubRateLimit($domain, $token = null) private function getGithubRateLimit($domain, $token = null)
{ {

View File

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

View File

@ -245,8 +245,8 @@ EOT
* @param RepositoryInterface $repos * @param RepositoryInterface $repos
* @param string $name * @param string $name
* @param string $version * @param string $version
* @return array array(CompletePackageInterface, array of versions)
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array array(CompletePackageInterface, array of versions)
*/ */
protected function getPackage(RepositoryInterface $installedRepo, RepositoryInterface $repos, $name, $version = null) 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('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('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 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 ->setHelp(<<<EOT
The validate command validates a given composer.json and composer.lock 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 * Compiles composer into a single phar file
* *
* @throws \RuntimeException
* @param string $pharFile The full path to the file to create * @param string $pharFile The full path to the file to create
* @throws \RuntimeException
*/ */
public function compile($pharFile = 'composer.phar') public function compile($pharFile = 'composer.phar')
{ {

View File

@ -57,7 +57,7 @@ class Config
'type' => 'composer', 'type' => 'composer',
'url' => 'https?://packagist.org', 'url' => 'https?://packagist.org',
'allow_ssl_downgrade' => true, 'allow_ssl_downgrade' => true,
) ),
); );
private $config; private $config;
@ -68,7 +68,7 @@ class Config
private $useEnvironment; 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) public function __construct($useEnvironment = true, $baseDir = null)
{ {
@ -332,7 +332,7 @@ class Config
* that overload config values. * that overload config values.
* *
* @param string $var * @param string $var
* @return string|boolean * @return string|bool
*/ */
private function getComposerEnv($var) private function getComposerEnv($var)
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -137,7 +137,7 @@ class FileDownloader implements DownloaderInterface
break; break;
} catch (TransportException $e) { } catch (TransportException $e) {
// if we got an http response with a proper code, then requesting again will probably not help, abort // 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; throw $e;
} }
if ($this->io->isVerbose()) { if ($this->io->isVerbose()) {
@ -227,9 +227,8 @@ class FileDownloader implements DownloaderInterface
* *
* @param PackageInterface $package package the url is coming from * @param PackageInterface $package package the url is coming from
* @param string $url download url * @param string $url download url
* @return string url
*
* @throws \RuntimeException If any problem with the url * @throws \RuntimeException If any problem with the url
* @return string url
*/ */
protected function processUrl(PackageInterface $package, $url) protected function processUrl(PackageInterface $package, $url)
{ {

View File

@ -213,9 +213,8 @@ class GitDownloader extends VcsDownloader
* @param string $reference * @param string $reference
* @param string $branch * @param string $branch
* @param \DateTime $date * @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
*
* @throws \RuntimeException * @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) protected function updateToCommit($path, $reference, $branch, $date)
{ {

View File

@ -48,7 +48,6 @@ class PearPackageExtractor
* @param array $vars used for replacement tasks * @param array $vars used for replacement tasks
* @throws \RuntimeException * @throws \RuntimeException
* @throws \UnexpectedValueException * @throws \UnexpectedValueException
*
*/ */
public function extractTo($target, array $roles = array('php' => '/', 'script' => '/bin'), $vars = array()) 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 string $source string path to extracted files
* @param array $roles array [role => roleRoot] relative root for files having that role * @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 * @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 * @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) * path, and target is destination of file (also relative to $source path)
* @throws \RuntimeException
*/ */
private function buildCopyActions($source, array $roles, $vars) private function buildCopyActions($source, array $roles, $vars)
{ {

View File

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

View File

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

View File

@ -35,7 +35,7 @@ class Event
protected $flags; 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; private $propagationStopped = false;
@ -86,7 +86,7 @@ class Event
/** /**
* Checks if stopPropagation has been called * Checks if stopPropagation has been called
* *
* @return boolean Whether propagation has been stopped * @return bool Whether propagation has been stopped
*/ */
public function isPropagationStopped() 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 Event $event The event object to pass to the event handlers/listeners.
* @param string $additionalArgs * @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 \RuntimeException
* @throws \Exception * @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) protected function doDispatch(Event $event)
{ {
@ -260,7 +260,7 @@ class EventDispatcher
* *
* @param string $eventName The event name - typically a constant * @param string $eventName The event name - typically a constant
* @param Callable $listener A callable expecting an event argument * @param Callable $listener A callable expecting an event argument
* @param 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) protected function addListener($eventName, $listener, $priority = 0)
{ {
@ -314,7 +314,7 @@ class EventDispatcher
* Checks if an event has listeners registered * Checks if an event has listeners registered
* *
* @param Event $event * @param Event $event
* @return boolean * @return bool
*/ */
public function hasEventListeners(Event $event) public function hasEventListeners(Event $event)
{ {
@ -356,7 +356,7 @@ class EventDispatcher
* Checks if string given references a class path and method * Checks if string given references a class path and method
* *
* @param string $callable * @param string $callable
* @return boolean * @return bool
*/ */
protected function isPhpScript($callable) protected function isPhpScript($callable)
{ {

View File

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

View File

@ -111,8 +111,8 @@ class ConsoleIO extends BaseIO
/** /**
* @param array $messages * @param array $messages
* @param boolean $newline * @param bool $newline
* @param boolean $stderr * @param bool $stderr
*/ */
private function doWrite($messages, $newline, $stderr) private function doWrite($messages, $newline, $stderr)
{ {
@ -153,9 +153,9 @@ class ConsoleIO extends BaseIO
/** /**
* @param array $messages * @param array $messages
* @param boolean $newline * @param bool $newline
* @param integer $size * @param int $size
* @param boolean $stderr * @param bool $stderr
*/ */
private function doOverwrite($messages, $newline, $size, $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 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 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); 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 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 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); public function overwriteError($messages, $newline = true, $size = null);
@ -96,9 +96,8 @@ interface IOInterface
* @param string|array $question The question to ask * @param string|array $question The question to ask
* @param string $default The default answer if none is given by the user * @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 * @throws \RuntimeException If there is no data to read in the input stream
* @return string The user answer
*/ */
public function ask($question, $default = null); public function ask($question, $default = null);
@ -123,12 +122,11 @@ interface IOInterface
* *
* @param string|array $question The question to ask * @param string|array $question The question to ask
* @param callback $validator A PHP callback * @param callback $validator A PHP callback
* @param null|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 * @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 * @throws \Exception When any of the validators return an error
* @return mixed
*/ */
public function askAndValidate($question, $validator, $attempts = null, $default = null); public function askAndValidate($question, $validator, $attempts = null, $default = null);
@ -153,7 +151,7 @@ interface IOInterface
* *
* @param string $repositoryName The unique name of repository * @param string $repositoryName The unique name of repository
* *
* @return boolean * @return bool
*/ */
public function hasAuthentication($repositoryName); public function hasAuthentication($repositoryName);

View File

@ -160,9 +160,8 @@ class Installer
/** /**
* Run installation (or update) * Run installation (or update)
* *
* @return int 0 on success or a positive error code on failure
*
* @throws \Exception * @throws \Exception
* @return int 0 on success or a positive error code on failure
*/ */
public function run() public function run()
{ {
@ -982,7 +981,7 @@ class Installer
foreach ($aliases as $alias) { foreach ($aliases as $alias) {
$normalizedAliases[$alias['package']][$alias['version']] = array( $normalizedAliases[$alias['package']][$alias['version']] = array(
'alias' => $alias['alias'], 'alias' => $alias['alias'],
'alias_normalized' => $alias['alias_normalized'] 'alias_normalized' => $alias['alias_normalized'],
); );
} }
@ -1118,7 +1117,7 @@ class Installer
* update whitelist themselves. * update whitelist themselves.
* *
* @param RepositoryInterface $localRepo * @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 $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 * @param array $rootDevRequires An array of links to packages in require-dev of the root package
*/ */
@ -1264,7 +1263,7 @@ class Installer
/** /**
* Whether to run in drymode or not * Whether to run in drymode or not
* *
* @param boolean $dryRun * @param bool $dryRun
* @return Installer * @return Installer
*/ */
public function setDryRun($dryRun = true) public function setDryRun($dryRun = true)
@ -1287,7 +1286,7 @@ class Installer
/** /**
* prefer source installation * prefer source installation
* *
* @param boolean $preferSource * @param bool $preferSource
* @return Installer * @return Installer
*/ */
public function setPreferSource($preferSource = true) public function setPreferSource($preferSource = true)
@ -1300,7 +1299,7 @@ class Installer
/** /**
* prefer dist installation * prefer dist installation
* *
* @param boolean $preferDist * @param bool $preferDist
* @return Installer * @return Installer
*/ */
public function setPreferDist($preferDist = true) public function setPreferDist($preferDist = true)
@ -1349,7 +1348,7 @@ class Installer
/** /**
* update packages * update packages
* *
* @param boolean $update * @param bool $update
* @return Installer * @return Installer
*/ */
public function setUpdate($update = true) public function setUpdate($update = true)
@ -1362,7 +1361,7 @@ class Installer
/** /**
* enables dev packages * enables dev packages
* *
* @param boolean $devMode * @param bool $devMode
* @return Installer * @return Installer
*/ */
public function setDevMode($devMode = true) public function setDevMode($devMode = true)
@ -1375,7 +1374,7 @@ class Installer
/** /**
* set whether to run autoloader or not * set whether to run autoloader or not
* *
* @param boolean $dumpAutoloader * @param bool $dumpAutoloader
* @return Installer * @return Installer
*/ */
public function setDumpAutoloader($dumpAutoloader = true) public function setDumpAutoloader($dumpAutoloader = true)
@ -1388,7 +1387,7 @@ class Installer
/** /**
* set whether to run scripts or not * set whether to run scripts or not
* *
* @param boolean $runScripts * @param bool $runScripts
* @return Installer * @return Installer
*/ */
public function setRunScripts($runScripts = true) public function setRunScripts($runScripts = true)
@ -1414,7 +1413,7 @@ class Installer
/** /**
* run in verbose mode * run in verbose mode
* *
* @param boolean $verbose * @param bool $verbose
* @return Installer * @return Installer
*/ */
public function setVerbose($verbose = true) public function setVerbose($verbose = true)
@ -1437,7 +1436,7 @@ class Installer
/** /**
* set ignore Platform Package requirements * set ignore Platform Package requirements
* *
* @param boolean $ignorePlatformReqs * @param bool $ignorePlatformReqs
* @return Installer * @return Installer
*/ */
public function setIgnorePlatformRequirements($ignorePlatformReqs = false) public function setIgnorePlatformRequirements($ignorePlatformReqs = false)
@ -1464,7 +1463,7 @@ class Installer
/** /**
* Should dependencies of whitelisted packages be updated recursively? * Should dependencies of whitelisted packages be updated recursively?
* *
* @param boolean $updateDependencies * @param bool $updateDependencies
* @return Installer * @return Installer
*/ */
public function setWhitelistDependencies($updateDependencies = true) public function setWhitelistDependencies($updateDependencies = true)
@ -1477,7 +1476,7 @@ class Installer
/** /**
* Should packages be preferred in a stable version when updating? * Should packages be preferred in a stable version when updating?
* *
* @param boolean $preferStable * @param bool $preferStable
* @return Installer * @return Installer
*/ */
public function setPreferStable($preferStable = true) public function setPreferStable($preferStable = true)
@ -1490,7 +1489,7 @@ class Installer
/** /**
* Should packages be preferred in a lowest version when updating? * Should packages be preferred in a lowest version when updating?
* *
* @param boolean $preferLowest * @param bool $preferLowest
* @return Installer * @return Installer
*/ */
public function setPreferLowest($preferLowest = true) public function setPreferLowest($preferLowest = true)

View File

@ -89,9 +89,8 @@ class InstallationManager
* *
* @param string $type package type * @param string $type package type
* *
* @return InstallerInterface
*
* @throws \InvalidArgumentException if installer for provided type is not registered * @throws \InvalidArgumentException if installer for provided type is not registered
* @return InstallerInterface
*/ */
public function getInstaller($type) public function getInstaller($type)
{ {
@ -249,7 +248,7 @@ class InstallationManager
'header' => array('Content-type: application/x-www-form-urlencoded'), 'header' => array('Content-type: application/x-www-form-urlencoded'),
'content' => http_build_query($params, '', '&'), 'content' => http_build_query($params, '', '&'),
'timeout' => 3, 'timeout' => 3,
) ),
); );
$context = StreamContextFactory::getContext($url, $opts); $context = StreamContextFactory::getContext($url, $opts);
@ -273,7 +272,7 @@ class InstallationManager
'header' => array('Content-Type: application/json'), 'header' => array('Content-Type: application/json'),
'content' => json_encode($postData), 'content' => json_encode($postData),
'timeout' => 6, 'timeout' => 6,
) ),
); );
$context = StreamContextFactory::getContext($repoUrl, $opts); $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 * Validates the schema of the current json file according to composer-schema.json rules
* *
* @param int $schema a JsonFile::*_SCHEMA constant * @param int $schema a JsonFile::*_SCHEMA constant
* @return bool true on success
* @throws JsonValidationException * @throws JsonValidationException
* @return bool true on success
*/ */
public function validateSchema($schema = self::STRICT_SCHEMA) public function validateSchema($schema = self::STRICT_SCHEMA)
{ {
@ -269,10 +269,10 @@ class JsonFile
* *
* @param string $json * @param string $json
* @param string $file * @param string $file
* @return bool true on success
* @throws \UnexpectedValueException * @throws \UnexpectedValueException
* @throws JsonValidationException * @throws JsonValidationException
* @throws ParsingException * @throws ParsingException
* @return bool true on success
*/ */
protected static function validateSyntax($json, $file = null) protected static function validateSyntax($json, $file = null)
{ {

View File

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

View File

@ -37,7 +37,7 @@ interface ArchiverInterface
* @param string $format The archive format * @param string $format The archive format
* @param string $sourceType The source type (git, svn, hg, etc.) * @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); public function supports($format, $sourceType);
} }

View File

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

View File

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

View File

@ -172,7 +172,7 @@ class CompletePackage extends Package implements CompletePackageInterface
} }
/** /**
* @return boolean * @return bool
*/ */
public function isAbandoned() 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) public function setAbandoned($abandoned)
{ {

View File

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

View File

@ -245,7 +245,7 @@ class Locker
$lock = array( $lock = array(
'_readme' => array('This file locks the dependencies of your project to a known state', '_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', '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, 'hash' => $this->hash,
'content-hash' => $this->contentHash, 'content-hash' => $this->contentHash,
'packages' => null, 'packages' => null,
@ -426,6 +426,7 @@ class Locker
} }
ksort($relevantContent); ksort($relevantContent);
return md5(json_encode($relevantContent)); return md5(json_encode($relevantContent));
} }
} }

View File

@ -141,7 +141,7 @@ class ArtifactRepository extends ArrayRepository
$package['dist'] = array( $package['dist'] = array(
'type' => 'zip', 'type' => 'zip',
'url' => $file->getPathname(), 'url' => $file->getPathname(),
'shasum' => sha1_file($file->getRealPath()) 'shasum' => sha1_file($file->getRealPath()),
); );
$package = $this->loader->load($package); $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 // url-encode $ signs in URLs as bad proxies choke on them
if (($pos = strpos($filename, '$')) && preg_match('{^https?://.*}i', $filename)) { 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; $retries = 3;

View File

@ -16,7 +16,6 @@ use Composer\Config;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
use Composer\Json\JsonFile; use Composer\Json\JsonFile;
use Composer\Package\Loader\ArrayLoader; use Composer\Package\Loader\ArrayLoader;
use Composer\Package\Loader\LoaderInterface;
use Composer\Package\Version\VersionGuesser; use Composer\Package\Version\VersionGuesser;
use Composer\Semver\VersionParser; use Composer\Semver\VersionParser;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
@ -140,6 +139,6 @@ class PathRepository extends ArrayRepository
*/ */
private function getUrlMatches() 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 string $type repository type
* @param array $config repository configuration * @param array $config repository configuration
* @return RepositoryInterface
* @throws \InvalidArgumentException if repository for provided type is not registered * @throws \InvalidArgumentException if repository for provided type is not registered
* @return RepositoryInterface
*/ */
public function createRepository($type, $config) public function createRepository($type, $config)
{ {

View File

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

View File

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

View File

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

View File

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

View File

@ -89,9 +89,8 @@ class Filesystem
* installation. * installation.
* *
* @param string $directory * @param string $directory
* @return bool
*
* @throws \RuntimeException * @throws \RuntimeException
* @return bool
*/ */
public function removeDirectory($directory) public function removeDirectory($directory)
{ {
@ -175,9 +174,8 @@ class Filesystem
* Attempts to unlink a file and in case of failure retries after 350ms on windows * Attempts to unlink a file and in case of failure retries after 350ms on windows
* *
* @param string $path * @param string $path
* @return bool
*
* @throws \RuntimeException * @throws \RuntimeException
* @return bool
*/ */
public function unlink($path) public function unlink($path)
{ {
@ -201,9 +199,8 @@ class Filesystem
* Attempts to rmdir a file and in case of failure retries after 350ms on windows * Attempts to rmdir a file and in case of failure retries after 350ms on windows
* *
* @param string $path * @param string $path
* @return bool
*
* @throws \RuntimeException * @throws \RuntimeException
* @return bool
*/ */
public function rmdir($path) public function rmdir($path)
{ {

View File

@ -105,9 +105,7 @@ class Git
return; return;
} }
} }
} elseif ( // private non-github repo that failed to authenticate } elseif ($this->isAuthenticationFailure($url, $match)) { // private non-github repo that failed to authenticate
$this->isAuthenticationFailure($url, $match)
) {
if (strpos($match[2], '@')) { if (strpos($match[2], '@')) {
list($authParts, $match[2]) = explode('@', $match[2], 2); list($authParts, $match[2]) = explode('@', $match[2], 2);
} }
@ -119,7 +117,7 @@ class Git
$defaultUsername = null; $defaultUsername = null;
if (isset($authParts) && $authParts) { if (isset($authParts) && $authParts) {
if (false !== strpos($authParts, ':')) { if (false !== strpos($authParts, ':')) {
list($defaultUsername,) = explode(':', $authParts, 2); list($defaultUsername, ) = explode(':', $authParts, 2);
} else { } else {
$defaultUsername = $authParts; $defaultUsername = $authParts;
} }

View File

@ -114,7 +114,7 @@ class NoProxyPattern
* @param string $cidr IPv4 block in CIDR notation * @param string $cidr IPv4 block in CIDR notation
* @param string $ip IPv4 address * @param string $ip IPv4 address
* *
* @return boolean * @return bool
*/ */
private static function inCIDRBlock($cidr, $ip) 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('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; return true;
@ -305,7 +305,7 @@ class Perforce
public function connectClient() public function connectClient()
{ {
$p4CreateClientCommand = $this->generateP4Command('client -i < ' . str_replace( " ", "\\ ", $this->getP4ClientSpec() )); $p4CreateClientCommand = $this->generateP4Command('client -i < ' . str_replace(" ", "\\ ", $this->getP4ClientSpec()));
$this->executeCommand($p4CreateClientCommand); $this->executeCommand($p4CreateClientCommand);
} }

View File

@ -59,7 +59,7 @@ class RemoteFilesystem
* @param string $originUrl The origin URL * @param string $originUrl The origin URL
* @param string $fileUrl The file URL * @param string $fileUrl The file URL
* @param string $fileName the local filename * @param string $fileName the local filename
* @param boolean $progress Display the progression * @param bool $progress Display the progression
* @param array $options Additional context options * @param array $options Additional context options
* *
* @return bool true * @return bool true
@ -74,7 +74,7 @@ class RemoteFilesystem
* *
* @param string $originUrl The origin URL * @param string $originUrl The origin URL
* @param string $fileUrl The file URL * @param string $fileUrl The file URL
* @param boolean $progress Display the progression * @param bool $progress Display the progression
* @param array $options Additional context options * @param array $options Additional context options
* *
* @return bool|string The content * @return bool|string The content
@ -111,7 +111,7 @@ class RemoteFilesystem
* @param string $fileUrl The file URL * @param string $fileUrl The file URL
* @param array $additionalOptions context options * @param array $additionalOptions context options
* @param string $fileName the local filename * @param string $fileName the local filename
* @param boolean $progress Display the progression * @param bool $progress Display the progression
* *
* @throws TransportException|\Exception * @throws TransportException|\Exception
* @throws TransportException When the file could not be downloaded * @throws TransportException When the file could not be downloaded
@ -195,7 +195,7 @@ class RemoteFilesystem
$this->degradedMode = true; $this->degradedMode = true;
$this->io->writeError(array( $this->io->writeError(array(
'<error>'.$e->getMessage().'</error>', '<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); return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
@ -253,7 +253,7 @@ class RemoteFilesystem
$this->degradedMode = true; $this->degradedMode = true;
$this->io->writeError(array( $this->io->writeError(array(
'<error>Failed to decode response: '.$e->getMessage().'</error>', '<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); return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
@ -303,7 +303,7 @@ class RemoteFilesystem
$this->degradedMode = true; $this->degradedMode = true;
$this->io->writeError(array( $this->io->writeError(array(
'<error>'.$e->getMessage().'</error>', '<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); return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
@ -322,12 +322,12 @@ class RemoteFilesystem
/** /**
* Get notification action. * Get notification action.
* *
* @param integer $notificationCode The notification code * @param int $notificationCode The notification code
* @param integer $severity The severity level * @param int $severity The severity level
* @param string $message The message * @param string $message The message
* @param integer $messageCode The message code * @param int $messageCode The message code
* @param integer $bytesTransferred The loaded size * @param int $bytesTransferred The loaded size
* @param integer $bytesMax The total size * @param int $bytesMax The total size
* @throws TransportException * @throws TransportException
*/ */
protected function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax) protected function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax)
@ -436,7 +436,7 @@ class RemoteFilesystem
php_uname('s'), php_uname('s'),
php_uname('r'), php_uname('r'),
$phpVersion $phpVersion
) ),
); );
if (extension_loaded('zlib')) { 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 string $url URL the context is to be used for
* @param array $defaultOptions Options to merge with the default * @param array $defaultOptions Options to merge with the default
* @param array $defaultParams Parameters to specify on the context * @param array $defaultParams Parameters to specify on the context
* @return resource Default context
* @throws \RuntimeException if https proxy required and OpenSSL uninstalled * @throws \RuntimeException if https proxy required and OpenSSL uninstalled
* @return resource Default context
*/ */
public static function getContext($url, array $defaultOptions = array(), array $defaultParams = array()) public static function getContext($url, array $defaultOptions = array(), array $defaultParams = array())
{ {

View File

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

View File

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

View File

@ -35,7 +35,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
$data = array(); $data = array();
$data['local config inherits system defaults'] = array( $data['local config inherits system defaults'] = array(
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(), array(),
); );
@ -44,7 +44,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
array(), array(),
array( array(
array('packagist' => false), array('packagist' => false),
) ),
); );
$data['local config adds above defaults'] = array( $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( $data['system config adds above core defaults'] = array(
array( array(
'example.com' => array('type' => 'composer', 'url' => 'http://example.com'), '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(),
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( $data['local config can disable repos by name and re-add them anonymously to bring them above system config'] = array(
array( array(
0 => array('type' => 'composer', 'url' => 'http://packagist.org'), 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(
array('packagist' => false), array('packagist' => false),
array('type' => 'composer', 'url' => 'http://packagist.org') array('type' => 'composer', 'url' => 'http://packagist.org'),
), ),
array( array(
'example.com' => array('type' => 'composer', 'url' => 'http://example.com'), '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( $data['local config can override by name to bring a repo above system config'] = array(
array( array(
'packagist' => array('type' => 'composer', 'url' => 'http://packagistnew.org'), '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( array(
'packagist' => array('type' => 'composer', 'url' => 'http://packagistnew.org') 'packagist' => array('type' => 'composer', 'url' => 'http://packagistnew.org'),
), ),
array( array(
'example.com' => array('type' => 'composer', 'url' => 'http://example.com'), 'example.com' => array('type' => 'composer', 'url' => 'http://example.com'),
@ -139,7 +139,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
$config->merge(array('config' => array( $config->merge(array('config' => array(
'bin-dir' => '$HOME/foo', 'bin-dir' => '$HOME/foo',
'cache-dir' => '/baz/', 'cache-dir' => '/baz/',
'vendor-dir' => 'vendor' 'vendor-dir' => 'vendor',
))); )));
$home = rtrim(getenv('HOME') ?: getenv('USERPROFILE'), '\\/'); $home = rtrim(getenv('HOME') ?: getenv('USERPROFILE'), '\\/');
@ -153,7 +153,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
$config = new Config(false, '/foo/bar'); $config = new Config(false, '/foo/bar');
$config->merge(array('config' => array( $config->merge(array('config' => array(
'bin-dir' => '{$vendor-dir}/foo', 'bin-dir' => '{$vendor-dir}/foo',
'vendor-dir' => 'vendor' 'vendor-dir' => 'vendor',
))); )));
$this->assertEquals('/foo/bar/vendor', $config->get('vendor-dir')); $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')); $this->repo->addPackage($packageX = $this->getPackage('X', '1.0'));
$packageX->setRequires(array( $packageX->setRequires(array(
'a' => new Link('X', 'A', $this->getVersionConstraint('>=', '2.0.0.0'), 'requires'), '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')); $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')); $this->repo->addPackage($packageS = $this->getPackage('S', '2.0.0'));
$packageS->setReplaces(array( $packageS->setReplaces(array(
'a' => new Link('S', 'A', $this->getVersionConstraint('>=', '2.0.0.0'), 'replaces'), '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(); $this->reposComplete();
@ -850,13 +850,13 @@ class SolverTest extends TestCase
$result[] = array( $result[] = array(
'job' => 'update', 'job' => 'update',
'from' => $operation->getInitialPackage(), 'from' => $operation->getInitialPackage(),
'to' => $operation->getTargetPackage() 'to' => $operation->getTargetPackage(),
); );
} else { } else {
$job = ('uninstall' === $operation->getJobType() ? 'remove' : 'install'); $job = ('uninstall' === $operation->getJobType() ? 'remove' : 'install');
$result[] = array( $result[] = array(
'job' => $job, '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', 'to' => 'PEAR/Frontend/Gtk/xpm/black_close_icon.xpm',
'role' => 'php', 'role' => 'php',
'tasks' => array(), 'tasks' => array(),
) ),
); );
$this->assertSame($expectedFileActions, $fileActions); $this->assertSame($expectedFileActions, $fileActions);
} }
@ -69,7 +69,7 @@ class PearPackageExtractorTest extends \PHPUnit_Framework_TestCase
'to' => 'Net/URL.php', 'to' => 'Net/URL.php',
'role' => 'php', 'role' => 'php',
'tasks' => array(), 'tasks' => array(),
) ),
); );
$this->assertSame($expectedFileActions, $fileActions); $this->assertSame($expectedFileActions, $fileActions);
} }
@ -99,16 +99,16 @@ class PearPackageExtractorTest extends \PHPUnit_Framework_TestCase
'role' => 'php', 'role' => 'php',
'tasks' => array(), 'tasks' => array(),
), ),
'php/Test.php' => array ( 'php/Test.php' => array(
'from' => 'Zend_Authentication-2.0.0beta4/php/Test.php', 'from' => 'Zend_Authentication-2.0.0beta4/php/Test.php',
'to' => '/php/Test.php', 'to' => '/php/Test.php',
'role' => 'script', 'role' => 'script',
'tasks' => array ( 'tasks' => array(
array ( array(
'from' => '@version@', 'from' => '@version@',
'to' => 'version', 'to' => 'version',
) ),
) ),
), ),
'renamedFile.php' => array( 'renamedFile.php' => array(
'from' => 'Zend_Authentication-2.0.0beta4/renamedFile.php', 'from' => 'Zend_Authentication-2.0.0beta4/renamedFile.php',

View File

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

View File

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

View File

@ -44,7 +44,7 @@ class ComposerSchemaTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(array( $this->assertEquals(array(
array( array(
'property' => 'minimum-stability', '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'); ), $this->check($json), 'empty string');
@ -52,7 +52,7 @@ class ComposerSchemaTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(array( $this->assertEquals(array(
array( array(
'property' => 'minimum-stability', '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'); ), $this->check($json), 'dummy');

View File

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

View File

@ -36,7 +36,7 @@ class JsonValidationExceptionTest extends \PHPUnit_Framework_TestCase
{ {
return array( return array(
array('test message', 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\Package\Archiver\ArchivableFilesFinder;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;
use Symfony\Component\Process\Process; use Symfony\Component\Process\Process;
use Symfony\Component\Process\ExecutableFinder; 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. * @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) protected function isProcessAvailable($process)
{ {

View File

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

View File

@ -45,7 +45,7 @@ class ArrayDumperTest extends \PHPUnit_Framework_TestCase
array( array(
'name' => 'foo', 'name' => 'foo',
'version' => '1.0', 'version' => '1.0',
'version_normalized' => '1.0.0.0' 'version_normalized' => '1.0.0.0',
), ),
$config $config
); );
@ -100,7 +100,7 @@ class ArrayDumperTest extends \PHPUnit_Framework_TestCase
return array( return array(
array( array(
'type', 'type',
'library' 'library',
), ),
array( array(
'time', 'time',
@ -110,46 +110,46 @@ class ArrayDumperTest extends \PHPUnit_Framework_TestCase
), ),
array( array(
'authors', '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( array(
'homepage', 'homepage',
'https://getcomposer.org' 'https://getcomposer.org',
), ),
array( array(
'description', 'description',
'Dependency Manager' 'Dependency Manager',
), ),
array( array(
'keywords', 'keywords',
array('package', 'dependency', 'autoload'), array('package', 'dependency', 'autoload'),
null, null,
array('autoload', 'dependency', 'package') array('autoload', 'dependency', 'package'),
), ),
array( array(
'bin', 'bin',
array('bin/composer'), array('bin/composer'),
'binaries' 'binaries',
), ),
array( array(
'license', 'license',
array('MIT') array('MIT'),
), ),
array( array(
'autoload', 'autoload',
array('psr-0' => array('Composer' => 'src/')) array('psr-0' => array('Composer' => 'src/')),
), ),
array( array(
'repositories', 'repositories',
array('packagist' => false) array('packagist' => false),
), ),
array( array(
'scripts', 'scripts',
array('post-update-cmd' => 'MyVendor\\MyClass::postUpdate') array('post-update-cmd' => 'MyVendor\\MyClass::postUpdate'),
), ),
array( array(
'extra', 'extra',
array('class' => 'MyVendor\\Installer') array('class' => 'MyVendor\\Installer'),
), ),
array( array(
'archive', 'archive',
@ -174,7 +174,7 @@ class ArrayDumperTest extends \PHPUnit_Framework_TestCase
array( array(
'suggest', 'suggest',
array('foo/bar' => 'very useful package'), array('foo/bar' => 'very useful package'),
'suggests' 'suggests',
), ),
array( array(
'support', 'support',
@ -184,43 +184,43 @@ class ArrayDumperTest extends \PHPUnit_Framework_TestCase
'require', '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')), 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', 'requires',
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0') array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0'),
), ),
array( array(
'require-dev', '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')), 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', 'devRequires',
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0') array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0'),
), ),
array( array(
'suggest', 'suggest',
array('foo/bar' => 'very useful package', 'bar/baz' => 'another useful package'), array('foo/bar' => 'very useful package', 'bar/baz' => 'another useful package'),
'suggests', 'suggests',
array('bar/baz' => 'another useful package', 'foo/bar' => 'very useful package') array('bar/baz' => 'another useful package', 'foo/bar' => 'very useful package'),
), ),
array( array(
'provide', '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')), 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', 'provides',
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0') array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0'),
), ),
array( array(
'replace', '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')), 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', 'replaces',
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0') array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0'),
), ),
array( array(
'conflict', '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')), 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', 'conflicts',
array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0') array('bar/baz' => '1.0.0', 'foo/bar' => '1.0.0'),
), ),
array( array(
'transport-options', 'transport-options',
array('ssl' => array('local_cert' => '/opt/certs/test.pem')), 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 class ArrayLoaderTest extends \PHPUnit_Framework_TestCase
{ {
/** /**
* @var ArrayLoader * @var ArrayLoader
*/ */
@ -124,7 +123,7 @@ class ArrayLoaderTest extends \PHPUnit_Framework_TestCase
'exclude' => array('/foo/bar', 'baz', '!/foo/bar/baz'), 'exclude' => array('/foo/bar', 'baz', '!/foo/bar/baz'),
), ),
'transport-options' => array('ssl' => array('local_cert' => '/opt/certs/test.pem')), 'transport-options' => array('ssl' => array('local_cert' => '/opt/certs/test.pem')),
'abandoned' => 'foo/bar' 'abandoned' => 'foo/bar',
); );
$package = $this->loader->load($config); $package = $this->loader->load($config);
@ -195,7 +194,7 @@ class ArrayLoaderTest extends \PHPUnit_Framework_TestCase
$config = array( $config = array(
'name' => 'A', 'name' => 'A',
'version' => '1.2.3.4', 'version' => '1.2.3.4',
'abandoned' => 'foo/bar' 'abandoned' => 'foo/bar',
); );
$package = $this->loader->load($config); $package = $this->loader->load($config);
@ -207,7 +206,7 @@ class ArrayLoaderTest extends \PHPUnit_Framework_TestCase
{ {
$config = array( $config = array(
'name' => 'A', 'name' => 'A',
'version' => '1.2.3.4' 'version' => '1.2.3.4',
); );
$package = $this->loader->load($config); $package = $this->loader->load($config);

View File

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

View File

@ -118,7 +118,7 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase
array( array(
'type' => 'composer', 'type' => 'composer',
'url' => 'https://packagist.org/', 'url' => 'https://packagist.org/',
) ),
), ),
'config' => array( 'config' => array(
'bin-dir' => 'bin', 'bin-dir' => 'bin',
@ -139,14 +139,14 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase
'branch-alias' => array( 'branch-alias' => array(
'dev-master' => '2.0-dev', 'dev-master' => '2.0-dev',
'dev-old' => '1.0.x-dev', 'dev-old' => '1.0.x-dev',
'3.x-dev' => '3.1.x-dev' '3.x-dev' => '3.1.x-dev',
), ),
), ),
'bin' => array( 'bin' => array(
'bin/foo', 'bin/foo',
'bin/bar', '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 array( // test as array
@ -220,8 +220,8 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase
'name' => 'foo', 'name' => 'foo',
), ),
array( 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(
array( array(
@ -230,7 +230,7 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase
), ),
array( array(
'homepage : should be a string, integer given', 'homepage : should be a string, integer given',
) ),
), ),
array( array(
array( array(
@ -241,7 +241,7 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase
), ),
array( array(
'support.source : invalid value, must be a string', 'support.source : invalid value, must be a string',
) ),
), ),
array( array(
array( array(
@ -249,8 +249,8 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase
'autoload' => 'strings', 'autoload' => 'strings',
), ),
array( array(
'autoload : should be an array, string given' 'autoload : should be an array, string given',
) ),
), ),
array( array(
array( array(
@ -262,8 +262,8 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase
), ),
), ),
array( 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(
array( array(
@ -271,8 +271,8 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase
'transport-options' => 'test', 'transport-options' => 'test',
), ),
array( 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', 'homepage' => 'foo:bar',
), ),
array( 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(
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.forum : invalid value (foo:bar), must be an http/https URL',
'support.issues : 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', 'support.wiki : invalid value (foo:bar), must be an http/https URL',
) ),
), ),
array( array(
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/foo : unbound version constraints (dev-master) should be avoided',
'require.bar/hacked : unbound version constraints (@stable) should be avoided', 'require.bar/hacked : unbound version constraints (@stable) should be avoided',
), ),
false false,
), ),
array( array(
array( array(
'name' => 'foo/bar', 'name' => 'foo/bar',
'extra' => array( 'extra' => array(
'branch-alias' => array( 'branch-alias' => array(
'5.x-dev' => '3.1.x-dev' '5.x-dev' => '3.1.x-dev',
),
), ),
)
), ),
array( 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(
array( array(
'name' => 'foo/bar', 'name' => 'foo/bar',
'extra' => array( 'extra' => array(
'branch-alias' => array( 'branch-alias' => array(
'5.x-dev' => '3.1-dev' '5.x-dev' => '3.1-dev',
),
), ),
)
), ),
array( 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( ->will($this->returnValue(array(
'packages' => array( 'packages' => array(
array('name' => 'pkg1', 'version' => '1.0.0-beta'), 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(); $repo = $locker->getLockedRepository();
@ -127,12 +127,12 @@ class LockerTest extends \PHPUnit_Framework_TestCase
->with(array( ->with(array(
'_readme' => array('This file locks the dependencies of your project to a known state', '_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', '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, 'hash' => $hash,
'content-hash' => $contentHash, 'content-hash' => $contentHash,
'packages' => array( 'packages' => array(
array('name' => 'pkg1', 'version' => '1.0.0-beta'), 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(), 'packages-dev' => array(),
'aliases' => array(), 'aliases' => array(),

View File

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

View File

@ -26,7 +26,7 @@ class FilesystemRepositoryTest extends TestCase
->expects($this->once()) ->expects($this->once())
->method('read') ->method('read')
->will($this->returnValue(array( ->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 $json
->expects($this->once()) ->expects($this->once())
@ -94,7 +94,7 @@ class FilesystemRepositoryTest extends TestCase
->expects($this->once()) ->expects($this->once())
->method('write') ->method('write')
->with(array( ->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')); $repository->addPackage($this->getPackage('mypkg', '0.1.10'));

View File

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

View File

@ -106,18 +106,18 @@ class ChannelReaderTest extends TestCase
'ext', 'ext',
'xml' 'xml'
), ),
),
) )
) )
),
) )
) ),
)
)
) )
); );
$packages = $ref->invoke($reader, $channelInfo, new VersionParser()); $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->setType('pear-library');
$expectedPackage->setDistType('file'); $expectedPackage->setDistType('file');
$expectedPackage->setDescription('description'); $expectedPackage->setDescription('description');

View File

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

View File

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

View File

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

View File

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

View File

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