Skip to content

Fix typos #631

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Command/UnpackCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Composer\Json\JsonFile;
use Composer\Package\Locker;
use Composer\Package\Version\VersionParser;
use Composer\Plugin\PluginInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand All @@ -28,6 +29,8 @@

class UnpackCommand extends BaseCommand
{
private $resolver;

public function __construct(PackageResolver $resolver)
{
$this->resolver = $resolver;
Expand Down
2 changes: 1 addition & 1 deletion src/Configurator/ContainerConfigurator.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private function addParameters(array $parameters)
$lines = [];
foreach (file($target) as $i => $line) {
$lines[] = $line;
if (!$isParameters && !preg_match('/^parameters\:/', $line)) {
if (!$isParameters && !preg_match('/^parameters:/', $line)) {
continue;
}
if (!$isParameters) {
Expand Down
3 changes: 2 additions & 1 deletion src/Downloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function getRecipes(array $operations): array
if ($this->rfs instanceof HttpDownloader) {
$jobs = [];
foreach ($paths as $path) {
$this->rfs->add($this->endpoint.$path[0]);
$jobs[] = $this->rfs->add($this->endpoint.$path[0]);
}
$this->rfs->wait();
$bodies = [];
Expand All @@ -150,6 +150,7 @@ public function getRecipes(array $operations): array
$this->io->writeError('<warning>Failed to download recipes: '.$e->getMessage().'</>');
});
} else {
$bodies = [];
$this->rfs->download($paths, function ($path) use (&$bodies) {
if ($body = $this->get($path, [], false)->getBody()) {
$bodies[] = $body;
Expand Down
8 changes: 5 additions & 3 deletions src/Flex.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class_exists(__NAMESPACE__.str_replace('/', '\\', substr($file, \strlen(__DIR__)
$this->filter = new PackageFilter($io, $symfonyRequire, $this->downloader);
}

$setRepositories = function () {};
$setRepositories = null;
} else {
$rfs = Factory::createRemoteFilesystem($this->io, $this->config);
$this->rfs = new ParallelDownloader($this->io, $this->config, $rfs->getOptions(), $rfs->isTlsDisabled());
Expand Down Expand Up @@ -222,7 +222,9 @@ class_exists(__NAMESPACE__.str_replace('/', '\\', substr($file, \strlen(__DIR__)
$this->displayThanksReminder = 1;
} elseif ('outdated' === $command) {
$symfonyRequire = null;
$setRepositories($manager);
if ($setRepositories) {
$setRepositories($manager);
}
}

if (isset(self::$aliasResolveCommands[$command])) {
Expand Down Expand Up @@ -845,7 +847,7 @@ private function getFlexId()
private function formatOrigin(string $origin): string
{
// symfony/translation:[email protected]/symfony/recipes:master
if (!preg_match('/^([^\:]+?)\:([^\@]+)@(.+)$/', $origin, $matches)) {
if (!preg_match('/^([^:]++):([^@]++)@(.+)$/', $origin, $matches)) {
return $origin;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Recipe.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function getURL(): string
}

// symfony/translation:[email protected]/symfony/recipes:master
if (!preg_match('/^([^\:]+?)\:([^\@]+)@([^\:]+)\:(.+)$/', $this->data['origin'], $matches)) {
if (!preg_match('/^([^:]++):([^@]++)@([^:]++):(.+)$/', $this->data['origin'], $matches)) {
// that excludes auto-generated recipes, which is what we want
return '';
}
Expand Down
2 changes: 1 addition & 1 deletion src/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private function parseHeaders(array $headers): array
{
$values = [];
foreach (array_reverse($headers) as $header) {
if (preg_match('{^([^\:]+):\s*(.+?)\s*$}i', $header, $match)) {
if (preg_match('{^([^:]++):\s*(.+?)\s*$}i', $header, $match)) {
$values[strtolower($match[1])][] = $match[2];
} elseif (preg_match('{^HTTP/}i', $header)) {
break;
Expand Down
3 changes: 2 additions & 1 deletion src/ScriptExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Composer\EventDispatcher\ScriptExecutionException;
use Composer\IO\IOInterface;
use Composer\Semver\Constraint\EmptyConstraint;
use Composer\Semver\Constraint\MatchAllConstraint;
use Composer\Util\ProcessExecutor;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\StreamOutput;
Expand Down Expand Up @@ -93,7 +94,7 @@ private function expandCmd(string $type, string $cmd)
private function expandSymfonyCmd(string $cmd)
{
$repo = $this->composer->getRepositoryManager()->getLocalRepository();
if (!$repo->findPackage('symfony/console', new EmptyConstraint())) {
if (!$repo->findPackage('symfony/console', class_exists(MatchAllConstraint::class) ? new MatchAllConstraint() : new EmptyConstraint())) {
$this->io->writeError(sprintf('<warning>Skipping "%s" (needs symfony/console to run).</>', $cmd));

return null;
Expand Down