1
0
Fork 0
pull/9730/head
Jordi Boggiano 2021-02-25 13:46:52 +01:00
parent 52967c32cf
commit 40800df6bd
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
22 changed files with 72 additions and 79 deletions

View File

@ -33,7 +33,7 @@ class FundCommand extends BaseCommand
$this->setName('fund')
->setDescription('Discover how to help fund the maintenance of your dependencies.')
->setDefinition(array(
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'),
))
;
}

View File

@ -467,7 +467,6 @@ class PoolBuilder
*/
private function unlockPackage(Request $request, $name)
{
if (
// if we unfixed a replaced package name, we also need to unfix the replacer itself
$this->skippedLoad[$name] !== $name

View File

@ -138,7 +138,8 @@ abstract class ArchiveDownloader extends FileDownloader
}
$promise = $filesystem->removeDirectoryAsync($temporaryDir);
return $promise->then(function() use ($self, $package, $path, $temporaryDir) {
return $promise->then(function () use ($self, $package, $path, $temporaryDir) {
$self->removeCleanupPath($package, $temporaryDir);
$self->removeCleanupPath($package, $path);
});

View File

@ -56,8 +56,8 @@ interface DownloaderInterface
/**
* Installs specific package into specific folder.
*
* @param PackageInterface $package package instance
* @param string $path download path
* @param PackageInterface $package package instance
* @param string $path download path
* @return PromiseInterface|null
*/
public function install(PackageInterface $package, $path);
@ -65,9 +65,9 @@ interface DownloaderInterface
/**
* Updates specific package in specific folder from initial to target version.
*
* @param PackageInterface $initial initial package
* @param PackageInterface $target updated package
* @param string $path download path
* @param PackageInterface $initial initial package
* @param PackageInterface $target updated package
* @param string $path download path
* @return PromiseInterface|null
*/
public function update(PackageInterface $initial, PackageInterface $target, $path);
@ -75,8 +75,8 @@ interface DownloaderInterface
/**
* Removes specific package from specific folder.
*
* @param PackageInterface $package package instance
* @param string $path download path
* @param PackageInterface $package package instance
* @param string $path download path
* @return PromiseInterface|null
*/
public function remove(PackageInterface $package, $path);

View File

@ -381,7 +381,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
}
$promise = $this->filesystem->removeDirectoryAsync($path);
return $promise->then(function($result) use ($path) {
return $promise->then(function ($result) use ($path) {
if (!$result) {
throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
}

View File

@ -375,7 +375,7 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
case '?':
default:
help:
help :
$this->io->writeError(array(
' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',

View File

@ -218,6 +218,7 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
if (Platform::isWindows()) {
return ': Junctioning from '.$package->getDistUrl();
}
return ': Symlinking from '.$package->getDistUrl();
}

View File

@ -218,7 +218,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
$promise = $this->filesystem->removeDirectoryAsync($path);
return $promise->then(function($result) use ($path) {
return $promise->then(function ($result) use ($path) {
if (!$result) {
throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
}

View File

@ -39,7 +39,6 @@ class InstalledVersions
$packages[] = array_keys($installed['versions']);
}
if (1 === \count($packages)) {
return $packages[0];
}

View File

@ -50,7 +50,6 @@ use Composer\Package\RootPackageInterface;
use Composer\Repository\InstalledArrayRepository;
use Composer\Repository\InstalledRepositoryInterface;
use Composer\Repository\InstalledRepository;
use Composer\Repository\FilterRepository;
use Composer\Repository\RootPackageRepository;
use Composer\Repository\PlatformRepository;
use Composer\Repository\RepositoryInterface;

View File

@ -199,6 +199,7 @@ class BinaryInstaller
$proxyCode = "#!/usr/bin/env php";
}
$binPathExported = var_export($binPath, true);
return $proxyCode . "\n" . <<<PROXY
<?php

View File

@ -17,7 +17,6 @@ use Composer\IO\IOInterface;
use Composer\Repository\InstalledRepositoryInterface;
use Composer\Package\PackageInterface;
use Composer\Util\Filesystem;
use Composer\Installer\InstallationManager;
use React\Promise\PromiseInterface;
/**

View File

@ -94,7 +94,7 @@ class JsonFile
$realpathInfo = '';
$realpath = realpath($this->path);
if (false !== $realpath && $realpath !== $this->path) {
$realpathInfo = ' (' . $realpath . ')';
$realpathInfo = ' (' . $realpath . ')';
}
$this->io->writeError('Reading ' . $this->path . $realpathInfo);
}

View File

@ -138,7 +138,7 @@ abstract class BaseExcludeFilter
}
$rule = trim($rule, '/');
// remove delimiters as well as caret (^) and dollar sign ($) from the regex
$rule = substr(Finder\Glob::toRegex($rule), 2, -2);

View File

@ -375,7 +375,6 @@ class ArrayLoader implements LoaderInterface
}
}
if (
isset($config['default-branch'])
&& $config['default-branch'] === true

View File

@ -17,13 +17,11 @@ use Composer\EventDispatcher\EventSubscriberInterface;
use Composer\IO\IOInterface;
use Composer\Package\CompletePackage;
use Composer\Package\Package;
use Composer\Package\RootPackage;
use Composer\Package\Version\VersionParser;
use Composer\Repository\RepositoryInterface;
use Composer\Repository\InstalledRepository;
use Composer\Repository\RootPackageRepository;
use Composer\Package\PackageInterface;
use Composer\Package\RootPackageInterface;
use Composer\Package\Link;
use Composer\Semver\Constraint\Constraint;
use Composer\Plugin\Capability\Capability;

View File

@ -123,7 +123,6 @@ class FilesystemRepository extends WritableArrayRepository
$this->file->write($data);
if ($this->dumpVersions) {
$versions = $this->generateInstalledVersions($installationManager, $devMode);

View File

@ -146,6 +146,7 @@ class Filesystem
$promise = $this->getProcess()->executeAsync($cmd);
$self = $this;
return $promise->then(function ($process) use ($directory, $self) {
// clear stat cache because external processes aren't tracked by the php stat cache
clearstatcache();
@ -165,7 +166,8 @@ class Filesystem
*
* @return bool|null Returns null, when no edge case was hit. Otherwise a bool whether removal was successfull
*/
private function removeEdgeCases($directory) {
private function removeEdgeCases($directory)
{
if ($this->isSymlinkedDirectory($directory)) {
return $this->unlinkSymlinkedDirectory($directory);
}

View File

@ -81,12 +81,11 @@ class HttpDownloader
/**
* Download a file synchronously
*
* @param string $url URL to download
* @param array $options Stream context options e.g. https://www.php.net/manual/en/context.http.php
* although not all options are supported when using the default curl downloader
* @return Response
*
* @param string $url URL to download
* @param array $options Stream context options e.g. https://www.php.net/manual/en/context.http.php
* although not all options are supported when using the default curl downloader
* @throws TransportException
* @return Response
*/
public function get($url, $options = array())
{
@ -119,12 +118,11 @@ class HttpDownloader
/**
* Create an async download operation
*
* @param string $url URL to download
* @param array $options Stream context options e.g. https://www.php.net/manual/en/context.http.php
* although not all options are supported when using the default curl downloader
* @return Promise
*
* @param string $url URL to download
* @param array $options Stream context options e.g. https://www.php.net/manual/en/context.http.php
* although not all options are supported when using the default curl downloader
* @throws TransportException
* @return Promise
*/
public function add($url, $options = array())
{
@ -136,13 +134,12 @@ class HttpDownloader
/**
* Copy a file synchronously
*
* @param string $url URL to download
* @param string $to Path to copy to
* @param array $options Stream context options e.g. https://www.php.net/manual/en/context.http.php
* although not all options are supported when using the default curl downloader
* @return Response
*
* @param string $url URL to download
* @param string $to Path to copy to
* @param array $options Stream context options e.g. https://www.php.net/manual/en/context.http.php
* although not all options are supported when using the default curl downloader
* @throws TransportException
* @return Response
*/
public function copy($url, $to, $options = array())
{
@ -155,13 +152,12 @@ class HttpDownloader
/**
* Create an async copy operation
*
* @param string $url URL to download
* @param string $to Path to copy to
* @param array $options Stream context options e.g. https://www.php.net/manual/en/context.http.php
* although not all options are supported when using the default curl downloader
* @return Promise
*
* @param string $url URL to download
* @param string $to Path to copy to
* @param array $options Stream context options e.g. https://www.php.net/manual/en/context.http.php
* although not all options are supported when using the default curl downloader
* @throws TransportException
* @return Promise
*/
public function addCopy($url, $to, $options = array())
{

View File

@ -123,7 +123,7 @@ class AllFunctionalTest extends TestCase
$expected = $testData['EXPECT'];
$line = 1;
for ($i = 0, $j = 0; $i < strlen($expected); ) {
for ($i = 0, $j = 0; $i < strlen($expected);) {
if ($expected[$i] === "\n") {
$line++;
}
@ -138,7 +138,7 @@ class AllFunctionalTest extends TestCase
} else {
$this->fail(
'Failed to match pattern '.$regex.' at line '.$line.' / abs offset '.$i.': '
.substr($output, $j, min(strpos($output, "\n", $j)-$j, 100)).PHP_EOL.PHP_EOL.
.substr($output, $j, min(strpos($output, "\n", $j) - $j, 100)).PHP_EOL.PHP_EOL.
'Output:'.PHP_EOL.$output
);
}
@ -146,8 +146,8 @@ class AllFunctionalTest extends TestCase
if ($expected[$i] !== $output[$j]) {
$this->fail(
'Output does not match expectation at line '.$line.' / abs offset '.$i.': '.PHP_EOL
.'-'.substr($expected, $i, min(strpos($expected, "\n", $i)-$i, 100)).PHP_EOL
.'+'.substr($output, $j, min(strpos($output, "\n", $j)-$j, 100)).PHP_EOL.PHP_EOL
.'-'.substr($expected, $i, min(strpos($expected, "\n", $i) - $i, 100)).PHP_EOL
.'+'.substr($output, $j, min(strpos($output, "\n", $j) - $j, 100)).PHP_EOL.PHP_EOL
.'Output:'.PHP_EOL.$output
);
}

View File

@ -47,14 +47,14 @@ class ZipArchiverTest extends ArchiverTest
if (empty($files)) {
$files = array(
'file.txt' => NULL,
'foo/bar/baz' => NULL,
'x/baz' => NULL,
'x/includeme' => NULL,
'file.txt' => null,
'foo/bar/baz' => null,
'x/baz' => null,
'x/includeme' => null,
);
if (!Platform::isWindows()) {
$files['foo' . getcwd() . '/file.txt'] = NULL;
$files['foo' . getcwd() . '/file.txt'] = null;
}
}
// Set up repository
@ -86,7 +86,7 @@ class ZipArchiverTest extends ArchiverTest
$currentWorkDir = getcwd();
chdir($this->testDir);
foreach ($files as $path => $content) {
if ($files[$path] === NULL) {
if ($files[$path] === null) {
$files[$path] = 'content';
}
$this->writeFile($path, $files[$path], $currentWorkDir);

View File

@ -33,14 +33,14 @@ class NoProxyPatternTest extends TestCase
// noproxy, url, expected
return array(
'match as foobar.com' => array($noproxy, 'foobar.com', true),
'match foobar.com' => array($noproxy, 'www.foobar.com', true),
'no match foobar.com' => array($noproxy, 'foofoobar.com', false),
'match .barbaz.net 1' => array($noproxy, 'barbaz.net', true),
'match .barbaz.net 2' => array($noproxy, 'www.barbaz.net', true),
'no match .barbaz.net' => array($noproxy, 'barbarbaz.net', false),
'no match wrong domain' => array($noproxy, 'barbaz.com', false),
'no match FQDN' => array($noproxy, 'foobar.com.', false),
'match as foobar.com' => array($noproxy, 'foobar.com', true),
'match foobar.com' => array($noproxy, 'www.foobar.com', true),
'no match foobar.com' => array($noproxy, 'foofoobar.com', false),
'match .barbaz.net 1' => array($noproxy, 'barbaz.net', true),
'match .barbaz.net 2' => array($noproxy, 'www.barbaz.net', true),
'no match .barbaz.net' => array($noproxy, 'barbarbaz.net', false),
'no match wrong domain' => array($noproxy, 'barbaz.com', false),
'no match FQDN' => array($noproxy, 'foobar.com.', false),
);
}
@ -60,12 +60,12 @@ class NoProxyPatternTest extends TestCase
// noproxy, url, expected
return array(
'match exact IPv4' => array($noproxy, '192.168.1.1', true),
'no match IPv4' => array($noproxy, '192.168.1.4', false),
'match exact IPv6' => array($noproxy, '[2001:db8:0:0:0:52:0:1]', true),
'no match IPv6' => array($noproxy, '[2001:db8:0:0:0:52:0:2]', false),
'match mapped IPv4' => array($noproxy, '[::FFFF:C0A8:0101]', true),
'no match mapped IPv4' => array($noproxy, '[::FFFF:C0A8:0104]', false),
'match exact IPv4' => array($noproxy, '192.168.1.1', true),
'no match IPv4' => array($noproxy, '192.168.1.4', false),
'match exact IPv6' => array($noproxy, '[2001:db8:0:0:0:52:0:1]', true),
'no match IPv6' => array($noproxy, '[2001:db8:0:0:0:52:0:2]', false),
'match mapped IPv4' => array($noproxy, '[::FFFF:C0A8:0101]', true),
'no match mapped IPv4' => array($noproxy, '[::FFFF:C0A8:0104]', false),
);
}
@ -85,12 +85,12 @@ class NoProxyPatternTest extends TestCase
// noproxy, url, expected
return array(
'match IPv4/CIDR' => array($noproxy, '10.0.0.2', true),
'no match IPv4/CIDR' => array($noproxy, '10.0.0.4', false),
'match IPv6/CIDR' => array($noproxy, '[2002:db8:a:0:0:0:0:7f]', true),
'no match IPv6' => array($noproxy, '[2002:db8:a:0:0:0:0:ff]', false),
'match mapped IPv4' => array($noproxy, '[::FFFF:0A00:0002]', true),
'no match mapped IPv4' => array($noproxy, '[::FFFF:0A00:0004]', false),
'match IPv4/CIDR' => array($noproxy, '10.0.0.2', true),
'no match IPv4/CIDR' => array($noproxy, '10.0.0.4', false),
'match IPv6/CIDR' => array($noproxy, '[2002:db8:a:0:0:0:0:7f]', true),
'no match IPv6' => array($noproxy, '[2002:db8:a:0:0:0:0:ff]', false),
'match mapped IPv4' => array($noproxy, '[::FFFF:0A00:0002]', true),
'no match mapped IPv4' => array($noproxy, '[::FFFF:0A00:0004]', false),
);
}
@ -110,10 +110,10 @@ class NoProxyPatternTest extends TestCase
// noproxy, url, expected
return array(
'match IPv4 port' => array($noproxy, '192.168.1.3', true),
'no match IPv4 port' => array($noproxy, '192.168.1.2', false),
'match IPv6 port' => array($noproxy, '[2001:db8::52:0:3]', true),
'no match IPv6 port' => array($noproxy, '[2001:db8::52:0:2]', false),
'match IPv4 port' => array($noproxy, '192.168.1.3', true),
'no match IPv4 port' => array($noproxy, '192.168.1.2', false),
'match IPv6 port' => array($noproxy, '[2001:db8::52:0:3]', true),
'no match IPv6 port' => array($noproxy, '[2001:db8::52:0:2]', false),
);
}