main
Jordi Boggiano 6 years ago
parent 02d56da414
commit ff59bbdab0

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

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

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

@ -48,7 +48,8 @@ class ArchiveCommand extends BaseCommand
.' Note that the format will be appended.'),
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
containing the files and directories of the Composer project or the specified
package in the specified version and writes it to the specified directory.

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

@ -26,7 +26,8 @@ class CheckPlatformReqsCommand extends BaseCommand
{
$this->setName('check-platform-reqs')
->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.
<info>php composer.phar check-platform-reqs</info>

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

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

@ -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('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
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.

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

@ -48,7 +48,8 @@ class DiagnoseCommand extends BaseCommand
$this
->setName('diagnose')
->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 process exit code will be 1 in case of warnings and 2 for errors.

@ -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('no-dev', null, InputOption::VALUE_NONE, 'Disables autoload-dev rules.'),
))
->setHelp(<<<EOT
->setHelp(
<<<EOT
<info>php composer.phar dump-autoload</info>
EOT
)

@ -53,7 +53,8 @@ class ExecCommand extends BaseCommand
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>
EOT
);
@ -66,7 +67,8 @@ EOT
$previousBin = $bin;
$bin = basename($bin);
$this->getIO()->write(<<<EOT
$this->getIO()->write(
<<<EOT
<info>- $bin</info>
EOT
);

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

@ -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('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
homepage in your default browser.

@ -64,7 +64,8 @@ class InitCommand extends BaseCommand
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'),
))
->setHelp(<<<EOT
->setHelp(
<<<EOT
The <info>init</info> command creates a basic composer.json file
in the current directory.
@ -676,7 +677,7 @@ EOT
* @param string|null $requiredVersion
* @param string $minimumStability
* @throws \InvalidArgumentException
* @return array name version
* @return array name version
*/
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
if ($phpVersion && $versionSelector->findBestCandidate($name, $requiredVersion, null, $preferredStability)) {
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
if ($requiredVersion && $versionSelector->findBestCandidate($name, null, $phpVersion, $preferredStability)) {
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
if ($phpVersion && $versionSelector->findBestCandidate($name)) {
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(
$package->getPrettyName(),
$versionSelector->findRecommendedRequireVersion($package)
$versionSelector->findRecommendedRequireVersion($package),
);
}

@ -52,7 +52,8 @@ class InstallCommand extends BaseCommand
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.'),
))
->setHelp(<<<EOT
->setHelp(
<<<EOT
The <info>install</info> command reads the composer.lock file from
the current directory, processes it, and downloads and installs all the
libraries and dependencies outlined in that file. If the file does not

@ -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('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 installed dependencies.

@ -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('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 color coding (or signage if you have ANSI colors disabled) for dependency versions is as such:

@ -31,7 +31,8 @@ class ProhibitsCommand extends BaseDependencyCommand
->setName('prohibits')
->setAliases(array('why-not'))
->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.
<info>php composer.phar prohibits composer/composer</info>

@ -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('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
list of installed packages

@ -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('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.
If you do not specify a package, composer will prompt you to search for a package, and given results, provide a list of

@ -57,7 +57,8 @@ class RunScriptCommand extends BaseCommand
new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
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:
<info>php composer.phar run-script post-update-cmd</info>

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

@ -44,7 +44,8 @@ class SearchCommand extends BaseCommand
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'),
))
->setHelp(<<<EOT
->setHelp(
<<<EOT
The search command searches for packages by its name
<info>php composer.phar search symfony composer</info>

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

@ -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('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
lists all packages available.

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

@ -31,7 +31,8 @@ class SuggestsCommand extends BaseCommand
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.'),
))
->setHelp(<<<EOT
->setHelp(
<<<EOT
The <info>%command.name%</info> command shows a sorted list of suggested packages.

@ -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('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
current directory, processes it, and updates, removes or installs all the
dependencies.

@ -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 InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file'),
))
->setHelp(<<<EOT
->setHelp(
<<<EOT
The validate command validates a given composer.json and composer.lock
Exit codes in case of errors are:

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

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

@ -21,6 +21,7 @@ class SolverBugException extends \RuntimeException
{
parent::__construct(
$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"
);
}
}

@ -161,7 +161,10 @@ class DownloadManager
if ($installationSource !== $downloader->getInstallationSource()) {
throw new \LogicException(sprintf(
'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
));
}

@ -28,7 +28,7 @@ class HgDownloader extends VcsDownloader
{
$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));
};
@ -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');
}
$command = function($url) use ($ref) {
$command = function ($url) use ($ref) {
return sprintf('hg pull %s && hg up %s', ProcessExecutor::escape($url), ProcessExecutor::escape($ref));
};

@ -43,7 +43,9 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
$realUrl = realpath($url);
if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
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.
throw new \RuntimeException(sprintf(
'Package %s cannot install to "%s" inside its source at "%s"',
$package->getName(), realpath($path), $realUrl
$package->getName(),
realpath($path),
$realUrl
));
}

@ -325,22 +325,37 @@ class EventDispatcher
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);
$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') {
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->getName(), $event->getComposer(), $event->getIO(), $event->isDevMode(),
$event->getPolicy(), $event->getPool(), $event->getInstalledRepo(), $event->getRequest(),
$event->getOperations(), $event->getOperation()
$event->getName(),
$event->getComposer(),
$event->getIO(),
$event->isDevMode(),
$event->getPolicy(),
$event->getPool(),
$event->getInstalledRepo(),
$event->getRequest(),
$event->getOperations(),
$event->getOperation()
);
}
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);
$event = new \Composer\Script\Event(
$event->getName(), $event->getComposer(), $event->getIO(), $event->isDevMode(),
$event->getArguments(), $event->getFlags()
$event->getName(),
$event->getComposer(),
$event->getIO(),
$event->isDevMode(),
$event->getArguments(),
$event->getFlags()
);
}

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

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

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

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

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

@ -360,7 +360,8 @@ class Locker
if (!$name || !$version) {
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
));
}

@ -175,13 +175,13 @@ class PathRepository extends ArrayRepository implements ConfigurableRepositoryIn
private function getUrlMatches()
{
$flags = GLOB_MARK | GLOB_ONLYDIR;
if (defined('GLOB_BRACE')) {
$flags |= GLOB_BRACE;
} 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);
}
// Ensure environment-specific path separators are normalized to URL separators
return array_map(function ($val) {
return rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $val), '/');

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

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

@ -634,9 +634,11 @@ class Filesystem
if (!is_dir($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',
ProcessExecutor::escape(str_replace('/', DIRECTORY_SEPARATOR, $junction)),
ProcessExecutor::escape(realpath($target)));
$cmd = sprintf(
'mklink /J %s %s',
ProcessExecutor::escape(str_replace('/', DIRECTORY_SEPARATOR, $junction)),
ProcessExecutor::escape(realpath($target))
);
if ($this->getProcess()->execute($cmd, $output) !== 0) {
throw new IOException(sprintf('Failed to create junction to "%s" at "%s".', $target, $junction), 0, null, $target);
}

@ -20,7 +20,6 @@ use Composer\IO\IOInterface;
*/
class Hg
{
/**
* @var \Composer\IO\IOInterface
*/
@ -43,20 +42,21 @@ class Hg
$this->process = $process;
}
public function runCommand($commandCallable, $url, $cwd) {
public function runCommand($commandCallable, $url, $cwd)
{
$this->config->prohibitUrlByConfig($url, $this->io);
// Try as is
$command = call_user_func($commandCallable, $url);
if (0 === $this->process->execute($command, $ignoredOutput, $cwd)){
if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
return;
}
// Try with the authentication informations available
if (preg_match('{^(https?)://((.+)(?:\:(.+))?@)?([^/]+)(/.*)?}mi', $url, $match) && $this->io->hasAuthentication($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);
@ -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)';
}
$this->throwException('Failed to clone ' . $url . ', ' . "\n\n" . $error, $url);
}
public static function sanitizeUrl($message)

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

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

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

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

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

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

@ -185,7 +185,8 @@ class ArchivableFilesFinderTest extends TestCase
$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.name "Your Name" && '.
'git add .git* && '.
@ -222,7 +223,8 @@ class ArchivableFilesFinderTest extends TestCase
$this->finder = new ArchivableFilesFinder($this->sources, array());
$expectedFiles = $this->getArchivedFiles('hg init && '.
$expectedFiles = $this->getArchivedFiles(
'hg init && '.
'hg add && '.
'hg commit -m "init" && '.
'hg archive archive.zip'

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

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

@ -55,7 +55,7 @@ class UrlTest extends TestCase
// 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/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'),
);
}
}

Loading…
Cancel
Save