diff --git a/src/Composer/Command/FundCommand.php b/src/Composer/Command/FundCommand.php index 788d60f21..edba9e806 100644 --- a/src/Composer/Command/FundCommand.php +++ b/src/Composer/Command/FundCommand.php @@ -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'), )) ; } diff --git a/src/Composer/DependencyResolver/PoolBuilder.php b/src/Composer/DependencyResolver/PoolBuilder.php index 885763d8d..74434a5cb 100644 --- a/src/Composer/DependencyResolver/PoolBuilder.php +++ b/src/Composer/DependencyResolver/PoolBuilder.php @@ -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 diff --git a/src/Composer/Downloader/ArchiveDownloader.php b/src/Composer/Downloader/ArchiveDownloader.php index 53dd43b4d..ab711ac66 100644 --- a/src/Composer/Downloader/ArchiveDownloader.php +++ b/src/Composer/Downloader/ArchiveDownloader.php @@ -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); }); diff --git a/src/Composer/Downloader/DownloaderInterface.php b/src/Composer/Downloader/DownloaderInterface.php index 8c4a7595e..ef2357958 100644 --- a/src/Composer/Downloader/DownloaderInterface.php +++ b/src/Composer/Downloader/DownloaderInterface.php @@ -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); diff --git a/src/Composer/Downloader/FileDownloader.php b/src/Composer/Downloader/FileDownloader.php index 894429c97..7ee10bbb7 100644 --- a/src/Composer/Downloader/FileDownloader.php +++ b/src/Composer/Downloader/FileDownloader.php @@ -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.'); } diff --git a/src/Composer/Downloader/GitDownloader.php b/src/Composer/Downloader/GitDownloader.php index b5bd73db6..d45684ef9 100644 --- a/src/Composer/Downloader/GitDownloader.php +++ b/src/Composer/Downloader/GitDownloader.php @@ -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', diff --git a/src/Composer/Downloader/PathDownloader.php b/src/Composer/Downloader/PathDownloader.php index 0a0461a4a..94fe8e0dc 100644 --- a/src/Composer/Downloader/PathDownloader.php +++ b/src/Composer/Downloader/PathDownloader.php @@ -218,6 +218,7 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter if (Platform::isWindows()) { return ': Junctioning from '.$package->getDistUrl(); } + return ': Symlinking from '.$package->getDistUrl(); } diff --git a/src/Composer/Downloader/VcsDownloader.php b/src/Composer/Downloader/VcsDownloader.php index 15095854e..59bd097ea 100644 --- a/src/Composer/Downloader/VcsDownloader.php +++ b/src/Composer/Downloader/VcsDownloader.php @@ -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.'); } diff --git a/src/Composer/InstalledVersions.php b/src/Composer/InstalledVersions.php index 96d85a7c5..eb8ea3763 100644 --- a/src/Composer/InstalledVersions.php +++ b/src/Composer/InstalledVersions.php @@ -39,7 +39,6 @@ class InstalledVersions $packages[] = array_keys($installed['versions']); } - if (1 === \count($packages)) { return $packages[0]; } diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index ea3a6151a..53ea964d9 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -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; diff --git a/src/Composer/Installer/BinaryInstaller.php b/src/Composer/Installer/BinaryInstaller.php index 3ffbb50b3..ef935c308 100644 --- a/src/Composer/Installer/BinaryInstaller.php +++ b/src/Composer/Installer/BinaryInstaller.php @@ -199,6 +199,7 @@ class BinaryInstaller $proxyCode = "#!/usr/bin/env php"; } $binPathExported = var_export($binPath, true); + return $proxyCode . "\n" . <<path); if (false !== $realpath && $realpath !== $this->path) { - $realpathInfo = ' (' . $realpath . ')'; + $realpathInfo = ' (' . $realpath . ')'; } $this->io->writeError('Reading ' . $this->path . $realpathInfo); } diff --git a/src/Composer/Package/Archiver/BaseExcludeFilter.php b/src/Composer/Package/Archiver/BaseExcludeFilter.php index 29ed0ff1b..a67ad272a 100644 --- a/src/Composer/Package/Archiver/BaseExcludeFilter.php +++ b/src/Composer/Package/Archiver/BaseExcludeFilter.php @@ -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); diff --git a/src/Composer/Package/Loader/ArrayLoader.php b/src/Composer/Package/Loader/ArrayLoader.php index 90efb784f..7f6263a65 100644 --- a/src/Composer/Package/Loader/ArrayLoader.php +++ b/src/Composer/Package/Loader/ArrayLoader.php @@ -375,7 +375,6 @@ class ArrayLoader implements LoaderInterface } } - if ( isset($config['default-branch']) && $config['default-branch'] === true diff --git a/src/Composer/Plugin/PluginManager.php b/src/Composer/Plugin/PluginManager.php index 1505d2e3d..961d8368e 100644 --- a/src/Composer/Plugin/PluginManager.php +++ b/src/Composer/Plugin/PluginManager.php @@ -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; diff --git a/src/Composer/Repository/FilesystemRepository.php b/src/Composer/Repository/FilesystemRepository.php index 878e9981d..42f119ee6 100644 --- a/src/Composer/Repository/FilesystemRepository.php +++ b/src/Composer/Repository/FilesystemRepository.php @@ -123,7 +123,6 @@ class FilesystemRepository extends WritableArrayRepository $this->file->write($data); - if ($this->dumpVersions) { $versions = $this->generateInstalledVersions($installationManager, $devMode); diff --git a/src/Composer/Util/Filesystem.php b/src/Composer/Util/Filesystem.php index a3bb16fb6..23d747095 100644 --- a/src/Composer/Util/Filesystem.php +++ b/src/Composer/Util/Filesystem.php @@ -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); } diff --git a/src/Composer/Util/HttpDownloader.php b/src/Composer/Util/HttpDownloader.php index ba7a49798..4610a29b2 100644 --- a/src/Composer/Util/HttpDownloader.php +++ b/src/Composer/Util/HttpDownloader.php @@ -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()) { diff --git a/tests/Composer/Test/AllFunctionalTest.php b/tests/Composer/Test/AllFunctionalTest.php index c29b4f279..a901617f9 100644 --- a/tests/Composer/Test/AllFunctionalTest.php +++ b/tests/Composer/Test/AllFunctionalTest.php @@ -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 ); } diff --git a/tests/Composer/Test/Package/Archiver/ZipArchiverTest.php b/tests/Composer/Test/Package/Archiver/ZipArchiverTest.php index ca179b21c..a51ec2a2d 100644 --- a/tests/Composer/Test/Package/Archiver/ZipArchiverTest.php +++ b/tests/Composer/Test/Package/Archiver/ZipArchiverTest.php @@ -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); diff --git a/tests/Composer/Test/Util/NoProxyPatternTest.php b/tests/Composer/Test/Util/NoProxyPatternTest.php index 5295dc6b0..d8edb462c 100644 --- a/tests/Composer/Test/Util/NoProxyPatternTest.php +++ b/tests/Composer/Test/Util/NoProxyPatternTest.php @@ -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), ); }