1
0
Fork 0
pull/7487/head
Jordi Boggiano 2018-07-24 14:32:52 +02:00
parent 02d56da414
commit ff59bbdab0
59 changed files with 196 additions and 111 deletions

View File

@ -25,11 +25,11 @@ return PhpCsFixer\Config::create()
'@PSR2' => true, '@PSR2' => true,
'array_syntax' => array('syntax' => 'long'), 'array_syntax' => array('syntax' => 'long'),
'binary_operator_spaces' => true, 'binary_operator_spaces' => true,
'blank_line_before_return' => true, 'blank_line_before_statement' => array('statements' => array('declare', 'return')),
'cast_spaces' => true, 'cast_spaces' => array('space' => 'single'),
'header_comment' => array('header' => $header), 'header_comment' => array('header' => $header),
'include' => true, 'include' => true,
'method_separation' => true, 'class_attributes_separation' => array('elements' => array('method')),
'no_blank_lines_after_class_opening' => true, 'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true, 'no_blank_lines_after_phpdoc' => true,
'no_empty_statement' => true, 'no_empty_statement' => true,
@ -38,7 +38,6 @@ return PhpCsFixer\Config::create()
'no_leading_namespace_whitespace' => true, 'no_leading_namespace_whitespace' => true,
'no_trailing_comma_in_singleline_array' => true, 'no_trailing_comma_in_singleline_array' => true,
'no_unused_imports' => true, 'no_unused_imports' => true,
'no_useless_else' => true,
'no_whitespace_in_blank_line' => true, 'no_whitespace_in_blank_line' => true,
'object_operator_without_whitespace' => true, 'object_operator_without_whitespace' => true,
'phpdoc_align' => true, 'phpdoc_align' => true,
@ -50,7 +49,6 @@ return PhpCsFixer\Config::create()
'phpdoc_trim' => true, 'phpdoc_trim' => true,
'phpdoc_types' => true, 'phpdoc_types' => true,
'psr0' => true, 'psr0' => true,
'short_scalar_cast' => true,
'single_blank_line_before_namespace' => true, 'single_blank_line_before_namespace' => true,
'standardize_not_equals' => true, 'standardize_not_equals' => true,
'ternary_operator_spaces' => true, 'ternary_operator_spaces' => true,

View File

@ -903,8 +903,8 @@ INITIALIZER;
/** /**
* Filters out dev-dependencies when not in dev-mode * Filters out dev-dependencies when not in dev-mode
* *
* @param array $packageMap * @param array $packageMap
* @param PackageInterface $mainPackage * @param PackageInterface $mainPackage
* @return array * @return array
*/ */
protected function filterPackageMap(array $packageMap, PackageInterface $mainPackage) protected function filterPackageMap(array $packageMap, PackageInterface $mainPackage)
@ -940,6 +940,7 @@ INITIALIZER;
function ($item) use ($include) { function ($item) use ($include) {
$package = $item[0]; $package = $item[0];
$name = $package->getName(); $name = $package->getName();
return isset($include[$name]); return isset($include[$name]);
} }
); );

View File

@ -25,7 +25,8 @@ class AboutCommand extends BaseCommand
$this $this
->setName('about') ->setName('about')
->setDescription('Shows the short information about Composer.') ->setDescription('Shows the short information about Composer.')
->setHelp(<<<EOT ->setHelp(
<<<EOT
<info>php composer.phar about</info> <info>php composer.phar about</info>
EOT EOT
) )
@ -34,7 +35,8 @@ EOT
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {
$this->getIO()->write(<<<EOT $this->getIO()->write(
<<<EOT
<info>Composer - Package Management for PHP</info> <info>Composer - Package Management for PHP</info>
<comment>Composer is a dependency manager tracking local dependencies of your projects and libraries. <comment>Composer is a dependency manager tracking local dependencies of your projects and libraries.
See https://getcomposer.org/ for more information.</comment> See https://getcomposer.org/ for more information.</comment>

View File

@ -48,7 +48,8 @@ class ArchiveCommand extends BaseCommand
.' Note that the format will be appended.'), .' Note that the format will be appended.'),
new InputOption('ignore-filters', false, InputOption::VALUE_NONE, 'Ignore filters when saving package'), new InputOption('ignore-filters', false, InputOption::VALUE_NONE, 'Ignore filters when saving package'),
)) ))
->setHelp(<<<EOT ->setHelp(
<<<EOT
The <info>archive</info> command creates an archive of the specified format The <info>archive</info> command creates an archive of the specified format
containing the files and directories of the Composer project or the specified containing the files and directories of the Composer project or the specified
package in the specified version and writes it to the specified directory. package in the specified version and writes it to the specified directory.

View File

@ -129,8 +129,11 @@ class BaseDependencyCommand extends BaseCommand
$results = $repository->getDependents($needles, $constraint, $inverted, $recursive); $results = $repository->getDependents($needles, $constraint, $inverted, $recursive);
if (empty($results)) { if (empty($results)) {
$extra = (null !== $constraint) ? sprintf(' in versions %smatching %s', $inverted ? 'not ' : '', $textConstraint) : ''; $extra = (null !== $constraint) ? sprintf(' in versions %smatching %s', $inverted ? 'not ' : '', $textConstraint) : '';
$this->getIO()->writeError(sprintf('<info>There is no installed package depending on "%s"%s</info>', $this->getIO()->writeError(sprintf(
$needle, $extra)); '<info>There is no installed package depending on "%s"%s</info>',
$needle,
$extra
));
} elseif ($renderTree) { } elseif ($renderTree) {
$this->initStyles($output); $this->initStyles($output);
$root = $packages[0]; $root = $packages[0];

View File

@ -26,7 +26,8 @@ class CheckPlatformReqsCommand extends BaseCommand
{ {
$this->setName('check-platform-reqs') $this->setName('check-platform-reqs')
->setDescription('Check that platform requirements are satisfied.') ->setDescription('Check that platform requirements are satisfied.')
->setHelp(<<<EOT ->setHelp(
<<<EOT
Checks that your PHP and extensions versions match the platform requirements of the installed packages. Checks that your PHP and extensions versions match the platform requirements of the installed packages.
<info>php composer.phar check-platform-reqs</info> <info>php composer.phar check-platform-reqs</info>

View File

@ -28,7 +28,8 @@ class ClearCacheCommand extends BaseCommand
->setName('clear-cache') ->setName('clear-cache')
->setAliases(array('clearcache')) ->setAliases(array('clearcache'))
->setDescription('Clears composer\'s internal package cache.') ->setDescription('Clears composer\'s internal package cache.')
->setHelp(<<<EOT ->setHelp(
<<<EOT
The <info>clear-cache</info> deletes all cached packages from composer's The <info>clear-cache</info> deletes all cached packages from composer's
cache directory. cache directory.
EOT EOT

View File

@ -75,7 +75,8 @@ class ConfigCommand extends BaseCommand
new InputArgument('setting-key', null, 'Setting key'), new InputArgument('setting-key', null, 'Setting key'),
new InputArgument('setting-value', InputArgument::IS_ARRAY, 'Setting value'), new InputArgument('setting-value', InputArgument::IS_ARRAY, 'Setting value'),
)) ))
->setHelp(<<<EOT ->setHelp(
<<<EOT
This command allows you to edit composer config settings and repositories This command allows you to edit composer config settings and repositories
in either the local composer.json file or the global config.json file. in either the local composer.json file or the global config.json file.
@ -613,7 +614,7 @@ EOT
} }
// handle script // handle script
if (preg_match('/^scripts\.(.+)/', $settingKey, $matches)){ if (preg_match('/^scripts\.(.+)/', $settingKey, $matches)) {
if ($input->getOption('unset')) { if ($input->getOption('unset')) {
return $this->configSource->removeProperty($settingKey); return $this->configSource->removeProperty($settingKey);
} }

View File

@ -80,7 +80,8 @@ class CreateProjectCommand extends BaseCommand
new InputOption('no-install', null, InputOption::VALUE_NONE, 'Whether to skip installation of the package dependencies.'), new InputOption('no-install', null, InputOption::VALUE_NONE, 'Whether to skip installation of the package dependencies.'),
new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'), new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
)) ))
->setHelp(<<<EOT ->setHelp(
<<<EOT
The <info>create-project</info> command creates a new project from a given The <info>create-project</info> command creates a new project from a given
package into a new directory. If executed without params and in a directory package into a new directory. If executed without params and in a directory
with a composer.json file it installs the packages for the current project. with a composer.json file it installs the packages for the current project.

View File

@ -31,7 +31,8 @@ class DependsCommand extends BaseDependencyCommand
->setName('depends') ->setName('depends')
->setAliases(array('why')) ->setAliases(array('why'))
->setDescription('Shows which packages cause the given package to be installed.') ->setDescription('Shows which packages cause the given package to be installed.')
->setHelp(<<<EOT ->setHelp(
<<<EOT
Displays detailed information about where a package is referenced. Displays detailed information about where a package is referenced.
<info>php composer.phar depends composer/composer</info> <info>php composer.phar depends composer/composer</info>

View File

@ -48,7 +48,8 @@ class DiagnoseCommand extends BaseCommand
$this $this
->setName('diagnose') ->setName('diagnose')
->setDescription('Diagnoses the system to identify common errors.') ->setDescription('Diagnoses the system to identify common errors.')
->setHelp(<<<EOT ->setHelp(
<<<EOT
The <info>diagnose</info> command checks common errors to help debugging problems. The <info>diagnose</info> command checks common errors to help debugging problems.
The process exit code will be 1 in case of warnings and 2 for errors. The process exit code will be 1 in case of warnings and 2 for errors.

View File

@ -36,7 +36,8 @@ class DumpAutoloadCommand extends BaseCommand
new InputOption('apcu', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'), new InputOption('apcu', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables autoload-dev rules.'), new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables autoload-dev rules.'),
)) ))
->setHelp(<<<EOT ->setHelp(
<<<EOT
<info>php composer.phar dump-autoload</info> <info>php composer.phar dump-autoload</info>
EOT EOT
) )

View File

@ -53,7 +53,8 @@ class ExecCommand extends BaseCommand
throw new \RuntimeException("No binaries found in composer.json or in bin-dir ($binDir)"); throw new \RuntimeException("No binaries found in composer.json or in bin-dir ($binDir)");
} }
$this->getIO()->write(<<<EOT $this->getIO()->write(
<<<EOT
<comment>Available binaries:</comment> <comment>Available binaries:</comment>
EOT EOT
); );
@ -66,7 +67,8 @@ EOT
$previousBin = $bin; $previousBin = $bin;
$bin = basename($bin); $bin = basename($bin);
$this->getIO()->write(<<<EOT $this->getIO()->write(
<<<EOT
<info>- $bin</info> <info>- $bin</info>
EOT EOT
); );

View File

@ -32,7 +32,8 @@ class GlobalCommand extends BaseCommand
new InputArgument('command-name', InputArgument::REQUIRED, ''), new InputArgument('command-name', InputArgument::REQUIRED, ''),
new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''), new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
)) ))
->setHelp(<<<EOT ->setHelp(
<<<EOT
Use this command as a wrapper to run other Composer commands Use this command as a wrapper to run other Composer commands
within the global context of COMPOSER_HOME. within the global context of COMPOSER_HOME.

View File

@ -42,7 +42,8 @@ class HomeCommand extends BaseCommand
new InputOption('homepage', 'H', InputOption::VALUE_NONE, 'Open the homepage instead of the repository URL.'), new InputOption('homepage', 'H', InputOption::VALUE_NONE, 'Open the homepage instead of the repository URL.'),
new InputOption('show', 's', InputOption::VALUE_NONE, 'Only show the homepage or repository URL.'), new InputOption('show', 's', InputOption::VALUE_NONE, 'Only show the homepage or repository URL.'),
)) ))
->setHelp(<<<EOT ->setHelp(
<<<EOT
The home command opens or shows a package's repository URL or The home command opens or shows a package's repository URL or
homepage in your default browser. homepage in your default browser.

View File

@ -64,7 +64,8 @@ class InitCommand extends BaseCommand
new InputOption('license', 'l', InputOption::VALUE_REQUIRED, 'License of package'), new InputOption('license', 'l', InputOption::VALUE_REQUIRED, 'License of package'),
new InputOption('repository', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Add custom repositories, either by URL or using JSON arrays'), new InputOption('repository', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Add custom repositories, either by URL or using JSON arrays'),
)) ))
->setHelp(<<<EOT ->setHelp(
<<<EOT
The <info>init</info> command creates a basic composer.json file The <info>init</info> command creates a basic composer.json file
in the current directory. in the current directory.
@ -676,7 +677,7 @@ EOT
* @param string|null $requiredVersion * @param string|null $requiredVersion
* @param string $minimumStability * @param string $minimumStability
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array name version * @return array name version
*/ */
private function findBestVersionAndNameForPackage(InputInterface $input, $name, $phpVersion, $preferredStability = 'stable', $requiredVersion = null, $minimumStability = null) private function findBestVersionAndNameForPackage(InputInterface $input, $name, $phpVersion, $preferredStability = 'stable', $requiredVersion = null, $minimumStability = null)
{ {
@ -694,19 +695,26 @@ EOT
// Check whether the PHP version was the problem // Check whether the PHP version was the problem
if ($phpVersion && $versionSelector->findBestCandidate($name, $requiredVersion, null, $preferredStability)) { if ($phpVersion && $versionSelector->findBestCandidate($name, $requiredVersion, null, $preferredStability)) {
throw new \InvalidArgumentException(sprintf( throw new \InvalidArgumentException(sprintf(
'Package %s at version %s has a PHP requirement incompatible with your PHP version (%s)', $name, $requiredVersion, $phpVersion 'Package %s at version %s has a PHP requirement incompatible with your PHP version (%s)',
$name,
$requiredVersion,
$phpVersion
)); ));
} }
// Check whether the required version was the problem // Check whether the required version was the problem
if ($requiredVersion && $versionSelector->findBestCandidate($name, null, $phpVersion, $preferredStability)) { if ($requiredVersion && $versionSelector->findBestCandidate($name, null, $phpVersion, $preferredStability)) {
throw new \InvalidArgumentException(sprintf( throw new \InvalidArgumentException(sprintf(
'Could not find package %s in a version matching %s', $name, $requiredVersion 'Could not find package %s in a version matching %s',
$name,
$requiredVersion
)); ));
} }
// Check whether the PHP version was the problem // Check whether the PHP version was the problem
if ($phpVersion && $versionSelector->findBestCandidate($name)) { if ($phpVersion && $versionSelector->findBestCandidate($name)) {
throw new \InvalidArgumentException(sprintf( throw new \InvalidArgumentException(sprintf(
'Could not find package %s in any version matching your PHP version (%s)', $name, $phpVersion 'Could not find package %s in any version matching your PHP version (%s)',
$name,
$phpVersion
)); ));
} }
@ -738,7 +746,7 @@ EOT
return array( return array(
$package->getPrettyName(), $package->getPrettyName(),
$versionSelector->findRecommendedRequireVersion($package) $versionSelector->findRecommendedRequireVersion($package),
); );
} }

View File

@ -52,7 +52,8 @@ class InstallCommand extends BaseCommand
new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'), new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Should not be provided, use composer require instead to add a given package to composer.json.'), new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Should not be provided, use composer require instead to add a given package to composer.json.'),
)) ))
->setHelp(<<<EOT ->setHelp(
<<<EOT
The <info>install</info> command reads the composer.lock file from The <info>install</info> command reads the composer.lock file from
the current directory, processes it, and downloads and installs all the the current directory, processes it, and downloads and installs all the
libraries and dependencies outlined in that file. If the file does not libraries and dependencies outlined in that file. If the file does not

View File

@ -36,7 +36,8 @@ class LicensesCommand extends BaseCommand
new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'), new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'), new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
)) ))
->setHelp(<<<EOT ->setHelp(
<<<EOT
The license command displays detailed information about the licenses of The license command displays detailed information about the licenses of
the installed dependencies. the installed dependencies.

View File

@ -37,7 +37,8 @@ class OutdatedCommand extends ShowCommand
new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'), new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'), new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
)) ))
->setHelp(<<<EOT ->setHelp(
<<<EOT
The outdated command is just a proxy for `composer show -l` The outdated command is just a proxy for `composer show -l`
The color coding (or signage if you have ANSI colors disabled) for dependency versions is as such: The color coding (or signage if you have ANSI colors disabled) for dependency versions is as such:

View File

@ -31,7 +31,8 @@ class ProhibitsCommand extends BaseDependencyCommand
->setName('prohibits') ->setName('prohibits')
->setAliases(array('why-not')) ->setAliases(array('why-not'))
->setDescription('Shows which packages prevent the given package from being installed.') ->setDescription('Shows which packages prevent the given package from being installed.')
->setHelp(<<<EOT ->setHelp(
<<<EOT
Displays detailed information about why a package cannot be installed. Displays detailed information about why a package cannot be installed.
<info>php composer.phar prohibits composer/composer</info> <info>php composer.phar prohibits composer/composer</info>

View File

@ -48,7 +48,8 @@ class RemoveCommand extends BaseCommand
new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'), new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'), new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
)) ))
->setHelp(<<<EOT ->setHelp(
<<<EOT
The <info>remove</info> command removes a package from the current The <info>remove</info> command removes a package from the current
list of installed packages list of installed packages

View File

@ -57,7 +57,8 @@ class RequireCommand extends InitCommand
new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'), new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'), new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
)) ))
->setHelp(<<<EOT ->setHelp(
<<<EOT
The require command adds required packages to your composer.json and installs them. The require command adds required packages to your composer.json and installs them.
If you do not specify a package, composer will prompt you to search for a package, and given results, provide a list of If you do not specify a package, composer will prompt you to search for a package, and given results, provide a list of

View File

@ -57,7 +57,8 @@ class RunScriptCommand extends BaseCommand
new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'), new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
new InputOption('list', 'l', InputOption::VALUE_NONE, 'List scripts.'), new InputOption('list', 'l', InputOption::VALUE_NONE, 'List scripts.'),
)) ))
->setHelp(<<<EOT ->setHelp(
<<<EOT
The <info>run-script</info> command runs scripts defined in composer.json: The <info>run-script</info> command runs scripts defined in composer.json:
<info>php composer.phar run-script post-update-cmd</info> <info>php composer.phar run-script post-update-cmd</info>

View File

@ -43,7 +43,8 @@ class ScriptAliasCommand extends BaseCommand
new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'), new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''), new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
)) ))
->setHelp(<<<EOT ->setHelp(
<<<EOT
The <info>run-script</info> command runs scripts defined in composer.json: The <info>run-script</info> command runs scripts defined in composer.json:
<info>php composer.phar run-script post-update-cmd</info> <info>php composer.phar run-script post-update-cmd</info>

View File

@ -44,7 +44,8 @@ class SearchCommand extends BaseCommand
new InputOption('type', 't', InputOption::VALUE_REQUIRED, 'Search for a specific package type'), new InputOption('type', 't', InputOption::VALUE_REQUIRED, 'Search for a specific package type'),
new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'), new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'),
)) ))
->setHelp(<<<EOT ->setHelp(
<<<EOT
The search command searches for packages by its name The search command searches for packages by its name
<info>php composer.phar search symfony composer</info> <info>php composer.phar search symfony composer</info>

View File

@ -53,7 +53,8 @@ class SelfUpdateCommand extends BaseCommand
new InputOption('snapshot', null, InputOption::VALUE_NONE, 'Force an update to the snapshot channel'), new InputOption('snapshot', null, InputOption::VALUE_NONE, 'Force an update to the snapshot channel'),
new InputOption('set-channel-only', null, InputOption::VALUE_NONE, 'Only store the channel as the default one and then exit'), new InputOption('set-channel-only', null, InputOption::VALUE_NONE, 'Only store the channel as the default one and then exit'),
)) ))
->setHelp(<<<EOT ->setHelp(
<<<EOT
The <info>self-update</info> command checks getcomposer.org for newer The <info>self-update</info> command checks getcomposer.org for newer
versions of composer and if found, installs the latest. versions of composer and if found, installs the latest.
@ -176,7 +177,9 @@ EOT
$sigFile = 'file://'.$home.'/' . ($updatingToTag ? 'keys.tags.pub' : 'keys.dev.pub'); $sigFile = 'file://'.$home.'/' . ($updatingToTag ? 'keys.tags.pub' : 'keys.dev.pub');
if (!file_exists($sigFile)) { if (!file_exists($sigFile)) {
file_put_contents($home.'/keys.dev.pub', <<<DEVPUBKEY file_put_contents(
$home.'/keys.dev.pub',
<<<DEVPUBKEY
-----BEGIN PUBLIC KEY----- -----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnBDHjZS6e0ZMoK3xTD7f MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnBDHjZS6e0ZMoK3xTD7f
FNCzlXjX/Aie2dit8QXA03pSrOTbaMnxON3hUL47Lz3g1SC6YJEMVHr0zYq4elWi FNCzlXjX/Aie2dit8QXA03pSrOTbaMnxON3hUL47Lz3g1SC6YJEMVHr0zYq4elWi
@ -192,8 +195,11 @@ r/TU7BQQIzsZgAiqOGXvVklIgAMiV0iucgf3rNBLjjeNEwNSTTG9F0CtQ+7JLwaE
wSEuAuRm+pRqi8BRnQ/GKUcCAwEAAQ== wSEuAuRm+pRqi8BRnQ/GKUcCAwEAAQ==
-----END PUBLIC KEY----- -----END PUBLIC KEY-----
DEVPUBKEY DEVPUBKEY
); );
file_put_contents($home.'/keys.tags.pub', <<<TAGSPUBKEY
file_put_contents(
$home.'/keys.tags.pub',
<<<TAGSPUBKEY
-----BEGIN PUBLIC KEY----- -----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0Vi/2K6apCVj76nCnCl2 MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0Vi/2K6apCVj76nCnCl2
MQUPdK+A9eqkYBacXo2wQBYmyVlXm2/n/ZsX6pCLYPQTHyr5jXbkQzBw8SKqPdlh MQUPdK+A9eqkYBacXo2wQBYmyVlXm2/n/ZsX6pCLYPQTHyr5jXbkQzBw8SKqPdlh
@ -209,7 +215,7 @@ TzCFWGk/HM6a4f0IzBWbJ5ot0PIi4amk07IotBXDWwqDiQTwyuGCym5EqWQ2BD95
RGv89BPD+2DLnJysngsvVaUCAwEAAQ== RGv89BPD+2DLnJysngsvVaUCAwEAAQ==
-----END PUBLIC KEY----- -----END PUBLIC KEY-----
TAGSPUBKEY TAGSPUBKEY
); );
} }
$pubkeyid = openssl_pkey_get_public($sigFile); $pubkeyid = openssl_pkey_get_public($sigFile);

View File

@ -79,7 +79,8 @@ class ShowCommand extends BaseCommand
new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'), new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'), new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
)) ))
->setHelp(<<<EOT ->setHelp(
<<<EOT
The show command displays detailed information about a package, or The show command displays detailed information about a package, or
lists all packages available. lists all packages available.

View File

@ -58,8 +58,8 @@ EOT
} }
/** /**
* @param InputInterface $input * @param InputInterface $input
* @param OutputInterface $output * @param OutputInterface $output
* @return int|null * @return int|null
*/ */
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)

View File

@ -31,7 +31,8 @@ class SuggestsCommand extends BaseCommand
new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Exclude suggestions from require-dev packages'), new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Exclude suggestions from require-dev packages'),
new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that you want to list suggestions from.'), new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that you want to list suggestions from.'),
)) ))
->setHelp(<<<EOT ->setHelp(
<<<EOT
The <info>%command.name%</info> command shows a sorted list of suggested packages. The <info>%command.name%</info> command shows a sorted list of suggested packages.

View File

@ -61,7 +61,8 @@ class UpdateCommand extends BaseCommand
new InputOption('interactive', 'i', InputOption::VALUE_NONE, 'Interactive interface with autocompletion to select the packages to update.'), new InputOption('interactive', 'i', InputOption::VALUE_NONE, 'Interactive interface with autocompletion to select the packages to update.'),
new InputOption('root-reqs', null, InputOption::VALUE_NONE, 'Restricts the update to your first degree dependencies.'), new InputOption('root-reqs', null, InputOption::VALUE_NONE, 'Restricts the update to your first degree dependencies.'),
)) ))
->setHelp(<<<EOT ->setHelp(
<<<EOT
The <info>update</info> command reads the composer.json file from the The <info>update</info> command reads the composer.json file from the
current directory, processes it, and updates, removes or installs all the current directory, processes it, and updates, removes or installs all the
dependencies. dependencies.

View File

@ -46,7 +46,8 @@ class ValidateCommand extends BaseCommand
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'), new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file'),
)) ))
->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
Exit codes in case of errors are: Exit codes in case of errors are:

View File

@ -245,9 +245,11 @@ class Config
case 'g': case 'g':
$size *= 1024; $size *= 1024;
// intentional fallthrough // intentional fallthrough
// no break
case 'm': case 'm':
$size *= 1024; $size *= 1024;
// intentional fallthrough // intentional fallthrough
// no break
case 'k': case 'k':
$size *= 1024; $size *= 1024;
break; break;

View File

@ -11,6 +11,7 @@
*/ */
namespace Composer\DependencyResolver; namespace Composer\DependencyResolver;
use Composer\Package\CompletePackageInterface; use Composer\Package\CompletePackageInterface;
/** /**

View File

@ -21,6 +21,7 @@ class SolverBugException extends \RuntimeException
{ {
parent::__construct( parent::__construct(
$message."\nThis exception was most likely caused by a bug in Composer.\n". $message."\nThis exception was most likely caused by a bug in Composer.\n".
"Please report the command you ran, the exact error you received, and your composer.json on https://github.com/composer/composer/issues - thank you!\n"); "Please report the command you ran, the exact error you received, and your composer.json on https://github.com/composer/composer/issues - thank you!\n"
);
} }
} }

View File

@ -161,7 +161,10 @@ class DownloadManager
if ($installationSource !== $downloader->getInstallationSource()) { if ($installationSource !== $downloader->getInstallationSource()) {
throw new \LogicException(sprintf( throw new \LogicException(sprintf(
'Downloader "%s" is a %s type downloader and can not be used to download %s for package %s', 'Downloader "%s" is a %s type downloader and can not be used to download %s for package %s',
get_class($downloader), $downloader->getInstallationSource(), $installationSource, $package get_class($downloader),
$downloader->getInstallationSource(),
$installationSource,
$package
)); ));
} }

View File

@ -28,7 +28,7 @@ class HgDownloader extends VcsDownloader
{ {
$hgUtils = new HgUtils($this->io, $this->config, $this->process); $hgUtils = new HgUtils($this->io, $this->config, $this->process);
$cloneCommand = function($url) use ($path) { $cloneCommand = function ($url) use ($path) {
return sprintf('hg clone %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($path)); return sprintf('hg clone %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($path));
}; };
@ -55,7 +55,7 @@ class HgDownloader extends VcsDownloader
throw new \RuntimeException('The .hg directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information'); throw new \RuntimeException('The .hg directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
} }
$command = function($url) use ($ref) { $command = function ($url) use ($ref) {
return sprintf('hg pull %s && hg up %s', ProcessExecutor::escape($url), ProcessExecutor::escape($ref)); return sprintf('hg pull %s && hg up %s', ProcessExecutor::escape($url), ProcessExecutor::escape($ref));
}; };

View File

@ -43,7 +43,9 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
$realUrl = realpath($url); $realUrl = realpath($url);
if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) { if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
throw new \RuntimeException(sprintf( throw new \RuntimeException(sprintf(
'Source path "%s" is not found for package %s', $url, $package->getName() 'Source path "%s" is not found for package %s',
$url,
$package->getName()
)); ));
} }
@ -54,7 +56,9 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
// for previous attempts that were shut down because they did not work well enough or introduced too many risks. // for previous attempts that were shut down because they did not work well enough or introduced too many risks.
throw new \RuntimeException(sprintf( throw new \RuntimeException(sprintf(
'Package %s cannot install to "%s" inside its source at "%s"', 'Package %s cannot install to "%s" inside its source at "%s"',
$package->getName(), realpath($path), $realUrl $package->getName(),
realpath($path),
$realUrl
)); ));
} }

View File

@ -325,22 +325,37 @@ class EventDispatcher
if (!$event instanceof $expected && $expected === 'Composer\Script\CommandEvent') { if (!$event instanceof $expected && $expected === 'Composer\Script\CommandEvent') {
trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED); trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
$event = new \Composer\Script\CommandEvent( $event = new \Composer\Script\CommandEvent(
$event->getName(), $event->getComposer(), $event->getIO(), $event->isDevMode(), $event->getArguments() $event->getName(),
$event->getComposer(),
$event->getIO(),
$event->isDevMode(),
$event->getArguments()
); );
} }
if (!$event instanceof $expected && $expected === 'Composer\Script\PackageEvent') { if (!$event instanceof $expected && $expected === 'Composer\Script\PackageEvent') {
trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED); trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
$event = new \Composer\Script\PackageEvent( $event = new \Composer\Script\PackageEvent(
$event->getName(), $event->getComposer(), $event->getIO(), $event->isDevMode(), $event->getName(),
$event->getPolicy(), $event->getPool(), $event->getInstalledRepo(), $event->getRequest(), $event->getComposer(),
$event->getOperations(), $event->getOperation() $event->getIO(),
$event->isDevMode(),
$event->getPolicy(),
$event->getPool(),
$event->getInstalledRepo(),
$event->getRequest(),
$event->getOperations(),
$event->getOperation()
); );
} }
if (!$event instanceof $expected && $expected === 'Composer\Script\Event') { if (!$event instanceof $expected && $expected === 'Composer\Script\Event') {
trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED); trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
$event = new \Composer\Script\Event( $event = new \Composer\Script\Event(
$event->getName(), $event->getComposer(), $event->getIO(), $event->isDevMode(), $event->getName(),
$event->getArguments(), $event->getFlags() $event->getComposer(),
$event->getIO(),
$event->isDevMode(),
$event->getArguments(),
$event->getFlags()
); );
} }

View File

@ -521,15 +521,15 @@ class Installer
} }
} }
$this->io->writeError( $this->io->writeError(sprintf(
sprintf("<info>Package operations: %d install%s, %d update%s, %d removal%s</info>", "<info>Package operations: %d install%s, %d update%s, %d removal%s</info>",
count($installs), count($installs),
1 === count($installs) ? '' : 's', 1 === count($installs) ? '' : 's',
count($updates), count($updates),
1 === count($updates) ? '' : 's', 1 === count($updates) ? '' : 's',
count($uninstalls), count($uninstalls),
1 === count($uninstalls) ? '' : 's') 1 === count($uninstalls) ? '' : 's'
); ));
if ($installs) { if ($installs) {
$this->io->writeError("Installs: ".implode(', ', $installs), true, IOInterface::VERBOSE); $this->io->writeError("Installs: ".implode(', ', $installs), true, IOInterface::VERBOSE);
} }

View File

@ -510,8 +510,7 @@ class JsonManipulator
if (PHP_VERSION_ID > 70000) { if (PHP_VERSION_ID > 70000) {
throw new \RuntimeException('Failed to execute regex: PREG_JIT_STACKLIMIT_ERROR', 6); throw new \RuntimeException('Failed to execute regex: PREG_JIT_STACKLIMIT_ERROR', 6);
} }
// fallthrough // no break
default: default:
throw new \RuntimeException('Failed to execute regex: Unknown error'); throw new \RuntimeException('Failed to execute regex: Unknown error');
} }

View File

@ -42,7 +42,8 @@ class GitExcludeFilter extends BaseExcludeFilter
$this->parseLines( $this->parseLines(
file($sourcePath.'/.gitattributes'), file($sourcePath.'/.gitattributes'),
array($this, 'parseGitAttributesLine') array($this, 'parseGitAttributesLine')
)); )
);
} }
} }

View File

@ -76,7 +76,8 @@ class PharArchiver implements ArchiverInterface
return $target; return $target;
} catch (\UnexpectedValueException $e) { } catch (\UnexpectedValueException $e) {
$message = sprintf("Could not create archive '%s' from '%s': %s", $message = sprintf(
"Could not create archive '%s' from '%s': %s",
$target, $target,
$sources, $sources,
$e->getMessage() $e->getMessage()

View File

@ -50,7 +50,8 @@ class ZipArchiver implements ArchiverInterface
return $target; return $target;
} }
} }
$message = sprintf("Could not create archive '%s' from '%s': %s", $message = sprintf(
"Could not create archive '%s' from '%s': %s",
$target, $target,
$sources, $sources,
$zip->getStatusString() $zip->getStatusString()

View File

@ -360,7 +360,8 @@ class Locker
if (!$name || !$version) { if (!$name || !$version) {
throw new \LogicException(sprintf( throw new \LogicException(sprintf(
'Package "%s" has no version or name and can not be locked', $package 'Package "%s" has no version or name and can not be locked',
$package
)); ));
} }

View File

@ -175,13 +175,13 @@ class PathRepository extends ArrayRepository implements ConfigurableRepositoryIn
private function getUrlMatches() private function getUrlMatches()
{ {
$flags = GLOB_MARK | GLOB_ONLYDIR; $flags = GLOB_MARK | GLOB_ONLYDIR;
if (defined('GLOB_BRACE')) { if (defined('GLOB_BRACE')) {
$flags |= GLOB_BRACE; $flags |= GLOB_BRACE;
} elseif (strpos($this->url, '{') !== false || strpos($this->url, '}') !== false) { } elseif (strpos($this->url, '{') !== false || strpos($this->url, '}') !== false) {
throw new \RuntimeException('The operating system does not support GLOB_BRACE which is required for the url '. $this->url); throw new \RuntimeException('The operating system does not support GLOB_BRACE which is required for the url '. $this->url);
} }
// Ensure environment-specific path separators are normalized to URL separators // Ensure environment-specific path separators are normalized to URL separators
return array_map(function ($val) { return array_map(function ($val) {
return rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $val), '/'); return rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $val), '/');

View File

@ -61,7 +61,7 @@ class HgDriver extends VcsDriver
// clean up directory and do a fresh clone into it // clean up directory and do a fresh clone into it
$fs->removeDirectory($this->repoDir); $fs->removeDirectory($this->repoDir);
$command = function($url) { $command = function ($url) {
return sprintf('hg clone --noupdate %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($this->repoDir)); return sprintf('hg clone --noupdate %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($this->repoDir));
}; };

View File

@ -135,7 +135,7 @@ class SvnDriver extends VcsDriver
try { try {
$composer = $this->getBaseComposerInformation($identifier); $composer = $this->getBaseComposerInformation($identifier);
} catch(TransportException $e) { } catch (TransportException $e) {
$message = $e->getMessage(); $message = $e->getMessage();
if (stripos($message, 'path not found') === false && stripos($message, 'svn: warning: W160013') === false) { if (stripos($message, 'path not found') === false && stripos($message, 'svn: warning: W160013') === false) {
throw $e; throw $e;

View File

@ -634,9 +634,11 @@ class Filesystem
if (!is_dir($target)) { if (!is_dir($target)) {
throw new IOException(sprintf('Cannot junction to "%s" as it is not a directory.', $target), 0, null, $target); throw new IOException(sprintf('Cannot junction to "%s" as it is not a directory.', $target), 0, null, $target);
} }
$cmd = sprintf('mklink /J %s %s', $cmd = sprintf(
ProcessExecutor::escape(str_replace('/', DIRECTORY_SEPARATOR, $junction)), 'mklink /J %s %s',
ProcessExecutor::escape(realpath($target))); ProcessExecutor::escape(str_replace('/', DIRECTORY_SEPARATOR, $junction)),
ProcessExecutor::escape(realpath($target))
);
if ($this->getProcess()->execute($cmd, $output) !== 0) { if ($this->getProcess()->execute($cmd, $output) !== 0) {
throw new IOException(sprintf('Failed to create junction to "%s" at "%s".', $target, $junction), 0, null, $target); throw new IOException(sprintf('Failed to create junction to "%s" at "%s".', $target, $junction), 0, null, $target);
} }

View File

@ -20,7 +20,6 @@ use Composer\IO\IOInterface;
*/ */
class Hg class Hg
{ {
/** /**
* @var \Composer\IO\IOInterface * @var \Composer\IO\IOInterface
*/ */
@ -43,20 +42,21 @@ class Hg
$this->process = $process; $this->process = $process;
} }
public function runCommand($commandCallable, $url, $cwd) { public function runCommand($commandCallable, $url, $cwd)
{
$this->config->prohibitUrlByConfig($url, $this->io); $this->config->prohibitUrlByConfig($url, $this->io);
// Try as is // Try as is
$command = call_user_func($commandCallable, $url); $command = call_user_func($commandCallable, $url);
if (0 === $this->process->execute($command, $ignoredOutput, $cwd)){ if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
return; return;
} }
// Try with the authentication informations available // Try with the authentication informations available
if (preg_match('{^(https?)://((.+)(?:\:(.+))?@)?([^/]+)(/.*)?}mi', $url, $match) && $this->io->hasAuthentication($match[5])) { if (preg_match('{^(https?)://((.+)(?:\:(.+))?@)?([^/]+)(/.*)?}mi', $url, $match) && $this->io->hasAuthentication($match[5])) {
$auth = $this->io->getAuthentication($match[5]); $auth = $this->io->getAuthentication($match[5]);
$authenticatedUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[5] . (!empty($match[6])? $match[6]: null); $authenticatedUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[5] . (!empty($match[6]) ? $match[6] : null);
$command = call_user_func($commandCallable, $authenticatedUrl); $command = call_user_func($commandCallable, $authenticatedUrl);
@ -69,10 +69,7 @@ class Hg
$error = 'The given URL (' . $url . ') does not match the required format (http(s)://(username:password@)example.com/path-to-repository)'; $error = 'The given URL (' . $url . ') does not match the required format (http(s)://(username:password@)example.com/path-to-repository)';
} }
$this->throwException('Failed to clone ' . $url . ', ' . "\n\n" . $error, $url); $this->throwException('Failed to clone ' . $url . ', ' . "\n\n" . $error, $url);
} }
public static function sanitizeUrl($message) public static function sanitizeUrl($message)

View File

@ -66,7 +66,7 @@ class Svn
/** /**
* @var string|null * @var string|null
*/ */
static private $version; private static $version;
/** /**
* @param string $url * @param string $url
@ -223,7 +223,8 @@ class Svn
*/ */
protected function getCommand($cmd, $url, $path = null) protected function getCommand($cmd, $url, $path = null)
{ {
$cmd = sprintf('%s %s%s %s', $cmd = sprintf(
'%s %s%s %s',
$cmd, $cmd,
'--non-interactive ', '--non-interactive ',
$this->getCredentialString(), $this->getCredentialString(),

View File

@ -362,7 +362,7 @@ class AutoloadGeneratorTest extends TestCase
$package = new Package('a', '1.0', '1.0'); $package = new Package('a', '1.0', '1.0');
$package->setRequires(array( $package->setRequires(array(
new Link('a', 'a/a'), new Link('a', 'a/a'),
new Link('a', 'b/b') new Link('a', 'b/b'),
)); ));
$packages = array(); $packages = array();
@ -445,7 +445,7 @@ class AutoloadGeneratorTest extends TestCase
$package = new Package('a', '1.0', '1.0'); $package = new Package('a', '1.0', '1.0');
$package->setRequires(array( $package->setRequires(array(
new Link('a', 'a/a'), new Link('a', 'a/a'),
new Link('a', 'b/b') new Link('a', 'b/b'),
)); ));
$packages = array(); $packages = array();
@ -484,7 +484,7 @@ class AutoloadGeneratorTest extends TestCase
$package = new Package('a', '1.0', '1.0'); $package = new Package('a', '1.0', '1.0');
$package->setRequires(array( $package->setRequires(array(
new Link('a', 'a/a'), new Link('a', 'a/a'),
new Link('a', 'b/b') new Link('a', 'b/b'),
)); ));
$packages = array(); $packages = array();
@ -524,7 +524,7 @@ class AutoloadGeneratorTest extends TestCase
$package->setRequires(array( $package->setRequires(array(
new Link('a', 'a/a'), new Link('a', 'a/a'),
new Link('a', 'b/b'), new Link('a', 'b/b'),
new Link('a', 'c/c') new Link('a', 'c/c'),
)); ));
$packages = array(); $packages = array();
@ -568,7 +568,7 @@ class AutoloadGeneratorTest extends TestCase
$package->setRequires(array( $package->setRequires(array(
new Link('a', 'a/a'), new Link('a', 'a/a'),
new Link('a', 'b/b'), new Link('a', 'b/b'),
new Link('a', 'c/c') new Link('a', 'c/c'),
)); ));
$packages = array(); $packages = array();
@ -617,7 +617,7 @@ class AutoloadGeneratorTest extends TestCase
$package->setRequires(array( $package->setRequires(array(
new Link('a', 'a/a'), new Link('a', 'a/a'),
new Link('a', 'b/b'), new Link('a', 'b/b'),
new Link('a', 'c/c') new Link('a', 'c/c'),
)); ));
$packages = array(); $packages = array();
@ -667,7 +667,7 @@ class AutoloadGeneratorTest extends TestCase
$requires = array( $requires = array(
new Link('a', 'a/a'), new Link('a', 'a/a'),
new Link('a', 'b/b'), new Link('a', 'b/b'),
new Link('a', 'c/c') new Link('a', 'c/c'),
); );
$autoloadPackage->setRequires($requires); $autoloadPackage->setRequires($requires);
$notAutoloadPackage->setRequires($requires); $notAutoloadPackage->setRequires($requires);
@ -739,7 +739,7 @@ class AutoloadGeneratorTest extends TestCase
new Link('a', 'z/foo'), new Link('a', 'z/foo'),
new Link('a', 'b/bar'), new Link('a', 'b/bar'),
new Link('a', 'd/d'), new Link('a', 'd/d'),
new Link('a', 'e/e') new Link('a', 'e/e'),
)); ));
$packages = array(); $packages = array();
@ -809,7 +809,7 @@ class AutoloadGeneratorTest extends TestCase
)); ));
$mainPackage->setRequires(array( $mainPackage->setRequires(array(
new Link('z', 'a/a'), new Link('z', 'a/a'),
new Link('z', 'b/b') new Link('z', 'b/b'),
)); ));
$packages = array(); $packages = array();
@ -1068,7 +1068,7 @@ EOF;
'files' => array('test.php'), 'files' => array('test.php'),
)); ));
$package->setRequires(array( $package->setRequires(array(
new Link('a', 'b/b') new Link('a', 'b/b'),
)); ));
$vendorPackage = new Package('b/b', '1.0', '1.0'); $vendorPackage = new Package('b/b', '1.0', '1.0');

View File

@ -59,7 +59,8 @@ class InitCommandTest extends TestCase
{ {
$command = new InitCommand; $command = new InitCommand;
$author = $command->parseAuthorString( $author = $command->parseAuthorString(
'Johnathon "Johnny" Smith <john@example.com>'); 'Johnathon "Johnny" Smith <john@example.com>'
);
$this->assertEquals('Johnathon "Johnny" Smith', $author['name']); $this->assertEquals('Johnathon "Johnny" Smith', $author['name']);
$this->assertEquals('john@example.com', $author['email']); $this->assertEquals('john@example.com', $author['email']);
} }
@ -72,7 +73,8 @@ class InitCommandTest extends TestCase
{ {
$command = new InitCommand; $command = new InitCommand;
$author = $command->parseAuthorString( $author = $command->parseAuthorString(
'Johnathon (Johnny) Smith <john@example.com>'); 'Johnathon (Johnny) Smith <john@example.com>'
);
$this->assertEquals('Johnathon (Johnny) Smith', $author['name']); $this->assertEquals('Johnathon (Johnny) Smith', $author['name']);
$this->assertEquals('john@example.com', $author['email']); $this->assertEquals('john@example.com', $author['email']);
} }

View File

@ -40,7 +40,8 @@ class RequestTest extends TestCase
array('cmd' => 'install', 'packageName' => 'bar', 'constraint' => null, 'fixed' => true), array('cmd' => 'install', 'packageName' => 'bar', 'constraint' => null, 'fixed' => true),
array('cmd' => 'remove', 'packageName' => 'foobar', 'constraint' => null, 'fixed' => false), array('cmd' => 'remove', 'packageName' => 'foobar', 'constraint' => null, 'fixed' => false),
), ),
$request->getJobs()); $request->getJobs()
);
} }
public function testRequestInstallSamePackageFromDifferentRepositories() public function testRequestInstallSamePackageFromDifferentRepositories()
@ -73,6 +74,7 @@ class RequestTest extends TestCase
$this->assertEquals( $this->assertEquals(
array(array('cmd' => 'update-all')), array(array('cmd' => 'update-all')),
$request->getJobs()); $request->getJobs()
);
} }
} }

View File

@ -241,7 +241,6 @@ class ConsoleIOTest extends TestCase
$this->isInstanceOf('Symfony\Component\Console\Question\Question') $this->isInstanceOf('Symfony\Component\Console\Question\Question')
) )
->will($this->returnValue(array('item2'))); ->will($this->returnValue(array('item2')));
;
$setMock $setMock
->expects($this->once()) ->expects($this->once())

View File

@ -86,7 +86,8 @@ class InstallationManagerTest extends TestCase
$installOperation = new InstallOperation($this->createPackageMock()); $installOperation = new InstallOperation($this->createPackageMock());
$removeOperation = new UninstallOperation($this->createPackageMock()); $removeOperation = new UninstallOperation($this->createPackageMock());
$updateOperation = new UpdateOperation( $updateOperation = new UpdateOperation(
$this->createPackageMock(), $this->createPackageMock() $this->createPackageMock(),
$this->createPackageMock()
); );
$manager $manager

View File

@ -185,7 +185,8 @@ class ArchivableFilesFinderTest extends TestCase
$this->finder = new ArchivableFilesFinder($this->sources, array()); $this->finder = new ArchivableFilesFinder($this->sources, array());
$this->assertArchivableFiles($this->getArchivedFiles('git init && '. $this->assertArchivableFiles($this->getArchivedFiles(
'git init && '.
'git config user.email "you@example.com" && '. 'git config user.email "you@example.com" && '.
'git config user.name "Your Name" && '. 'git config user.name "Your Name" && '.
'git add .git* && '. 'git add .git* && '.
@ -222,7 +223,8 @@ class ArchivableFilesFinderTest extends TestCase
$this->finder = new ArchivableFilesFinder($this->sources, array()); $this->finder = new ArchivableFilesFinder($this->sources, array());
$expectedFiles = $this->getArchivedFiles('hg init && '. $expectedFiles = $this->getArchivedFiles(
'hg init && '.
'hg add && '. 'hg add && '.
'hg commit -m "init" && '. 'hg commit -m "init" && '.
'hg archive archive.zip' 'hg archive archive.zip'

View File

@ -21,8 +21,13 @@ class LockerTest extends TestCase
public function testIsLocked() public function testIsLocked()
{ {
$json = $this->createJsonFileMock(); $json = $this->createJsonFileMock();
$locker = new Locker(new NullIO, $json, $this->createRepositoryManagerMock(), $this->createInstallationManagerMock(), $locker = new Locker(
$this->getJsonContent()); new NullIO,
$json,
$this->createRepositoryManagerMock(),
$this->createInstallationManagerMock(),
$this->getJsonContent()
);
$json $json
->expects($this->any()) ->expects($this->any())

View File

@ -48,7 +48,8 @@ class PearRepositoryTest extends TestCase
foreach ($expectedPackages as $expectedPackage) { foreach ($expectedPackages as $expectedPackage) {
$package = $this->repository->findPackage($expectedPackage['name'], $expectedPackage['version']); $package = $this->repository->findPackage($expectedPackage['name'], $expectedPackage['version']);
$this->assertInstanceOf('Composer\Package\PackageInterface', $this->assertInstanceOf(
'Composer\Package\PackageInterface',
$package, $package,
'Expected package ' . $expectedPackage['name'] . ', version ' . $expectedPackage['version'] . 'Expected package ' . $expectedPackage['name'] . ', version ' . $expectedPackage['version'] .
' not found in pear channel ' . $url ' not found in pear channel ' . $url
@ -74,7 +75,8 @@ class PearRepositoryTest extends TestCase
$this->createRepository($repoConfig); $this->createRepository($repoConfig);
foreach ($expectedPackages as $expectedPackage) { foreach ($expectedPackages as $expectedPackage) {
$this->assertInstanceOf('Composer\Package\PackageInterface', $this->assertInstanceOf(
'Composer\Package\PackageInterface',
$this->repository->findPackage($expectedPackage['name'], $expectedPackage['version']), $this->repository->findPackage($expectedPackage['name'], $expectedPackage['version']),
'Expected package ' . $expectedPackage['name'] . ', version ' . $expectedPackage['version'] . 'Expected package ' . $expectedPackage['name'] . ', version ' . $expectedPackage['version'] .
' not found in pear channel ' . $url ' not found in pear channel ' . $url

View File

@ -55,7 +55,7 @@ class UrlTest extends TestCase
// gitlab enterprise // gitlab enterprise
array('https://mygitlab.com/api/v4/projects/foo%2Fbar/repository/archive.tar.gz?sha=abcd', 'https://mygitlab.com/api/v4/projects/foo%2Fbar/repository/archive.tar.gz?sha=newref', array('gitlab-domains' => array('mygitlab.com'))), array('https://mygitlab.com/api/v4/projects/foo%2Fbar/repository/archive.tar.gz?sha=abcd', 'https://mygitlab.com/api/v4/projects/foo%2Fbar/repository/archive.tar.gz?sha=newref', array('gitlab-domains' => array('mygitlab.com'))),
array('https://mygitlab.com/api/v3/projects/foo%2Fbar/repository/archive.tar.bz2?sha=abcd', 'https://mygitlab.com/api/v3/projects/foo%2Fbar/repository/archive.tar.bz2?sha=newref', array('gitlab-domains' => array('mygitlab.com'))), array('https://mygitlab.com/api/v3/projects/foo%2Fbar/repository/archive.tar.bz2?sha=abcd', 'https://mygitlab.com/api/v3/projects/foo%2Fbar/repository/archive.tar.bz2?sha=newref', array('gitlab-domains' => array('mygitlab.com'))),
array('https://mygitlab.com/api/v3/projects/foo%2Fbar/repository/archive.tar.bz2?sha=abcd', 'https://mygitlab.com/api/v3/projects/foo%2Fbar/repository/archive.tar.bz2?sha=65', array('gitlab-domains' => array('mygitlab.com')), '65'), array('https://mygitlab.com/api/v3/projects/foo%2Fbar/repository/archive.tar.bz2?sha=abcd', 'https://mygitlab.com/api/v3/projects/foo%2Fbar/repository/archive.tar.bz2?sha=65', array('gitlab-domains' => array('mygitlab.com')), '65'),
); );
} }
} }