CS fixes
parent
f31b820b09
commit
c8aea719b1
4
.php_cs
4
.php_cs
|
@ -12,10 +12,10 @@ EOF;
|
||||||
|
|
||||||
$finder = PhpCsFixer\Finder::create()
|
$finder = PhpCsFixer\Finder::create()
|
||||||
->files()
|
->files()
|
||||||
->name('*.php')
|
|
||||||
->exclude('Fixtures')
|
|
||||||
->in(__DIR__.'/src')
|
->in(__DIR__.'/src')
|
||||||
->in(__DIR__.'/tests')
|
->in(__DIR__.'/tests')
|
||||||
|
->name('*.php')
|
||||||
|
->notPath('Fixtures')
|
||||||
;
|
;
|
||||||
|
|
||||||
return PhpCsFixer\Config::create()
|
return PhpCsFixer\Config::create()
|
||||||
|
|
|
@ -1,11 +1,20 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Composer.
|
||||||
|
*
|
||||||
|
* (c) Nils Adermann <naderman@naderman.de>
|
||||||
|
* Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
namespace Composer\Command;
|
namespace Composer\Command;
|
||||||
|
|
||||||
use Composer\Package\Link;
|
use Composer\Package\Link;
|
||||||
use Composer\Package\PackageInterface;
|
use Composer\Package\PackageInterface;
|
||||||
use Composer\Semver\Constraint\Constraint;
|
use Composer\Semver\Constraint\Constraint;
|
||||||
use Composer\Semver\Constraint\MultiConstraint;
|
|
||||||
use Symfony\Component\Console\Helper\Table;
|
use Symfony\Component\Console\Helper\Table;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
@ -125,7 +134,7 @@ EOT
|
||||||
$platformPackage,
|
$platformPackage,
|
||||||
$version,
|
$version,
|
||||||
$link ? sprintf('%s %s %s (%s)', $link->getSource(), $link->getDescription(), $link->getTarget(), $link->getPrettyConstraint()) : '',
|
$link ? sprintf('%s %s %s (%s)', $link->getSource(), $link->getDescription(), $link->getTarget(), $link->getPrettyConstraint()) : '',
|
||||||
$status
|
$status,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$table = array_merge($rows, $table);
|
$table = array_merge($rows, $table);
|
||||||
|
|
|
@ -191,7 +191,7 @@ EOT
|
||||||
$name = basename($cwd);
|
$name = basename($cwd);
|
||||||
$name = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
|
$name = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
|
||||||
$name = strtolower($name);
|
$name = strtolower($name);
|
||||||
if ( !empty($_SERVER['COMPOSER_DEFAULT_VENDOR']) ) {
|
if (!empty($_SERVER['COMPOSER_DEFAULT_VENDOR'])) {
|
||||||
$name = $_SERVER['COMPOSER_DEFAULT_VENDOR'] . '/' . $name;
|
$name = $_SERVER['COMPOSER_DEFAULT_VENDOR'] . '/' . $name;
|
||||||
} elseif (isset($git['github.user'])) {
|
} elseif (isset($git['github.user'])) {
|
||||||
$name = $git['github.user'] . '/' . $name;
|
$name = $git['github.user'] . '/' . $name;
|
||||||
|
@ -242,15 +242,15 @@ EOT
|
||||||
$input->setOption('description', $description);
|
$input->setOption('description', $description);
|
||||||
|
|
||||||
if (null === $author = $input->getOption('author')) {
|
if (null === $author = $input->getOption('author')) {
|
||||||
if ( !empty($_SERVER['COMPOSER_DEFAULT_AUTHOR']) ) {
|
if (!empty($_SERVER['COMPOSER_DEFAULT_AUTHOR'])) {
|
||||||
$author_name = $_SERVER['COMPOSER_DEFAULT_AUTHOR'];
|
$author_name = $_SERVER['COMPOSER_DEFAULT_AUTHOR'];
|
||||||
} elseif ( isset($git['user.name']) ) {
|
} elseif (isset($git['user.name'])) {
|
||||||
$author_name = $git['user.name'];
|
$author_name = $git['user.name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty($_SERVER['COMPOSER_DEFAULT_EMAIL']) ) {
|
if (!empty($_SERVER['COMPOSER_DEFAULT_EMAIL'])) {
|
||||||
$author_email = $_SERVER['COMPOSER_DEFAULT_EMAIL'];
|
$author_email = $_SERVER['COMPOSER_DEFAULT_EMAIL'];
|
||||||
} elseif ( isset($git['user.email']) ) {
|
} elseif (isset($git['user.email'])) {
|
||||||
$author_email = $git['user.email'];
|
$author_email = $git['user.email'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ EOT
|
||||||
$input->setOption('type', $type);
|
$input->setOption('type', $type);
|
||||||
|
|
||||||
if (null === $license = $input->getOption('license')) {
|
if (null === $license = $input->getOption('license')) {
|
||||||
if ( !empty($_SERVER['COMPOSER_DEFAULT_LICENSE']) ) {
|
if (!empty($_SERVER['COMPOSER_DEFAULT_LICENSE'])) {
|
||||||
$license = $_SERVER['COMPOSER_DEFAULT_LICENSE'];
|
$license = $_SERVER['COMPOSER_DEFAULT_LICENSE'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -423,7 +423,7 @@ EOT
|
||||||
$abandoned = sprintf('<warning>Abandoned. %s.</warning>', $replacement);
|
$abandoned = sprintf('<warning>Abandoned. %s.</warning>', $replacement);
|
||||||
}
|
}
|
||||||
|
|
||||||
$choices[] = sprintf(' <info>%5s</info> %s %s',"[$position]", $foundPackage['name'], $abandoned);
|
$choices[] = sprintf(' <info>%5s</info> %s %s', "[$position]", $foundPackage['name'], $abandoned);
|
||||||
if ($foundPackage['name'] === $package) {
|
if ($foundPackage['name'] === $package) {
|
||||||
$exactMatch = true;
|
$exactMatch = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -767,7 +767,7 @@ class Installer
|
||||||
// is this a plugin or a dependency of a plugin?
|
// is this a plugin or a dependency of a plugin?
|
||||||
if ($isPlugin || count(array_intersect($package->getNames(), $pluginRequires))) {
|
if ($isPlugin || count(array_intersect($package->getNames(), $pluginRequires))) {
|
||||||
// get the package's requires, but filter out any platform requirements or 'composer-plugin-api'
|
// get the package's requires, but filter out any platform requirements or 'composer-plugin-api'
|
||||||
$requires = array_filter(array_keys($package->getRequires()), function($req) {
|
$requires = array_filter(array_keys($package->getRequires()), function ($req) {
|
||||||
return $req !== 'composer-plugin-api' && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req);
|
return $req !== 'composer-plugin-api' && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1207,7 +1207,7 @@ class Installer
|
||||||
if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com)/}i', $package->getDistUrl())) {
|
if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com)/}i', $package->getDistUrl())) {
|
||||||
$package->setDistReference($reference);
|
$package->setDistReference($reference);
|
||||||
$package->setDistUrl(preg_replace('{(?<=/)[a-f0-9]{40}(?=/|$)}i', $reference, $package->getDistUrl()));
|
$package->setDistUrl(preg_replace('{(?<=/)[a-f0-9]{40}(?=/|$)}i', $reference, $package->getDistUrl()));
|
||||||
} else if ($package->getDistReference()) { // update the dist reference if there was one, but if none was provided ignore it
|
} elseif ($package->getDistReference()) { // update the dist reference if there was one, but if none was provided ignore it
|
||||||
$package->setDistReference($reference);
|
$package->setDistReference($reference);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ class FilesystemRepository extends WritableArrayRepository
|
||||||
$data[] = $dumper->dump($package);
|
$data[] = $dumper->dump($package);
|
||||||
}
|
}
|
||||||
|
|
||||||
usort($data, function($a, $b) {
|
usort($data, function ($a, $b) {
|
||||||
return strcmp($a['name'], $b['name']);
|
return strcmp($a['name'], $b['name']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -216,6 +216,7 @@ class GitDriver extends VcsDriver
|
||||||
}
|
}
|
||||||
|
|
||||||
$process = new ProcessExecutor($io);
|
$process = new ProcessExecutor($io);
|
||||||
|
|
||||||
return $process->execute('git ls-remote --heads ' . ProcessExecutor::escape($url), $output) === 0;
|
return $process->execute('git ls-remote --heads ' . ProcessExecutor::escape($url), $output) === 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -261,6 +261,7 @@ class GitLabDriver extends VcsDriver
|
||||||
{
|
{
|
||||||
$domainName = $this->originUrl;
|
$domainName = $this->originUrl;
|
||||||
$portNumber = (true === is_numeric($this->portNumber)) ? sprintf(':%s', $this->portNumber) : '';
|
$portNumber = (true === is_numeric($this->portNumber)) ? sprintf(':%s', $this->portNumber) : '';
|
||||||
|
|
||||||
return $this->scheme.'://'.$domainName.$portNumber.'/api/v4/projects/'.$this->urlEncodeAll($this->namespace).'%2F'.$this->urlEncodeAll($this->repository);
|
return $this->scheme.'://'.$domainName.$portNumber.'/api/v4/projects/'.$this->urlEncodeAll($this->namespace).'%2F'.$this->urlEncodeAll($this->repository);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,7 +450,6 @@ class GitLabDriver extends VcsDriver
|
||||||
*/
|
*/
|
||||||
public static function supports(IOInterface $io, Config $config, $url, $deep = false)
|
public static function supports(IOInterface $io, Config $config, $url, $deep = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!preg_match(self::URL_REGEX, $url, $match)) {
|
if (!preg_match(self::URL_REGEX, $url, $match)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -264,7 +264,8 @@ class Filesystem
|
||||||
* @param $target
|
* @param $target
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function copy($source, $target) {
|
public function copy($source, $target)
|
||||||
|
{
|
||||||
if (!is_dir($source)) {
|
if (!is_dir($source)) {
|
||||||
return copy($source, $target);
|
return copy($source, $target);
|
||||||
}
|
}
|
||||||
|
@ -273,7 +274,7 @@ class Filesystem
|
||||||
$ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
|
$ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
|
||||||
$this->ensureDirectoryExists($target);
|
$this->ensureDirectoryExists($target);
|
||||||
|
|
||||||
$result=true;
|
$result = true;
|
||||||
foreach ($ri as $file) {
|
foreach ($ri as $file) {
|
||||||
$targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathName();
|
$targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathName();
|
||||||
if ($file->isDir()) {
|
if ($file->isDir()) {
|
||||||
|
|
|
@ -117,6 +117,7 @@ class Perforce
|
||||||
protected function executeCommand($command)
|
protected function executeCommand($command)
|
||||||
{
|
{
|
||||||
$this->commandResult = '';
|
$this->commandResult = '';
|
||||||
|
|
||||||
return $this->process->execute($command, $this->commandResult);
|
return $this->process->execute($command, $this->commandResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,6 +134,7 @@ class ProcessExecutor
|
||||||
if (method_exists('Symfony\Component\Process\ProcessUtils', 'escapeArgument')) {
|
if (method_exists('Symfony\Component\Process\ProcessUtils', 'escapeArgument')) {
|
||||||
return ProcessUtils::escapeArgument($argument);
|
return ProcessUtils::escapeArgument($argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::escapeArgument($argument);
|
return self::escapeArgument($argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1013,6 +1013,7 @@ class RemoteFilesystem
|
||||||
// Path for a public download follows this pattern /{user}/{repo}/downloads/{whatever}
|
// Path for a public download follows this pattern /{user}/{repo}/downloads/{whatever}
|
||||||
// {@link https://blog.bitbucket.org/2009/04/12/new-feature-downloads/}
|
// {@link https://blog.bitbucket.org/2009/04/12/new-feature-downloads/}
|
||||||
$pathParts = explode('/', $path);
|
$pathParts = explode('/', $path);
|
||||||
|
|
||||||
return count($pathParts) >= 4 && $pathParts[3] == 'downloads';
|
return count($pathParts) >= 4 && $pathParts[3] == 'downloads';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,6 @@ class JsonManipulatorTest extends TestCase
|
||||||
',
|
',
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'{
|
'{
|
||||||
"require":
|
"require":
|
||||||
|
@ -2360,6 +2359,5 @@ class JsonManipulatorTest extends TestCase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
', $manipulator->getContents());
|
', $manipulator->getContents());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -308,7 +308,8 @@ JSON;
|
||||||
$this->assertEquals($expected, $driver->getTags(), 'Tags are cached');
|
$this->assertEquals($expected, $driver->getTags(), 'Tags are cached');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetPaginatedRefs() {
|
public function testGetPaginatedRefs()
|
||||||
|
{
|
||||||
$driver = $this->testInitialize('https://gitlab.com/mygroup/myproject', 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject');
|
$driver = $this->testInitialize('https://gitlab.com/mygroup/myproject', 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject');
|
||||||
|
|
||||||
$apiUrl = 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject/repository/branches?per_page=100';
|
$apiUrl = 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject/repository/branches?per_page=100';
|
||||||
|
@ -319,15 +320,15 @@ JSON;
|
||||||
"name" => "mymaster",
|
"name" => "mymaster",
|
||||||
"commit" => array(
|
"commit" => array(
|
||||||
"id" => "97eda36b5c1dd953a3792865c222d4e85e5f302e",
|
"id" => "97eda36b5c1dd953a3792865c222d4e85e5f302e",
|
||||||
"committed_date" => "2013-01-03T21:04:07.000+01:00"
|
"committed_date" => "2013-01-03T21:04:07.000+01:00",
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
"name" => "staging",
|
"name" => "staging",
|
||||||
"commit" => array(
|
"commit" => array(
|
||||||
"id" => "502cffe49f136443f2059803f2e7192d1ac066cd",
|
"id" => "502cffe49f136443f2059803f2e7192d1ac066cd",
|
||||||
"committed_date" => "2013-03-09T16:35:23.000+01:00"
|
"committed_date" => "2013-03-09T16:35:23.000+01:00",
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -336,8 +337,8 @@ JSON;
|
||||||
"name" => "stagingdupe",
|
"name" => "stagingdupe",
|
||||||
"commit" => array(
|
"commit" => array(
|
||||||
"id" => "502cffe49f136443f2059803f2e7192d1ac066cd",
|
"id" => "502cffe49f136443f2059803f2e7192d1ac066cd",
|
||||||
"committed_date" => "2013-03-09T16:35:23.000+01:00"
|
"committed_date" => "2013-03-09T16:35:23.000+01:00",
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,8 +373,8 @@ JSON;
|
||||||
|
|
||||||
$this->assertEquals($expected, $driver->getBranches());
|
$this->assertEquals($expected, $driver->getBranches());
|
||||||
$this->assertEquals($expected, $driver->getBranches(), 'Branches are cached');
|
$this->assertEquals($expected, $driver->getBranches(), 'Branches are cached');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetBranches()
|
public function testGetBranches()
|
||||||
{
|
{
|
||||||
$driver = $this->testInitialize('https://gitlab.com/mygroup/myproject', 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject');
|
$driver = $this->testInitialize('https://gitlab.com/mygroup/myproject', 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject');
|
||||||
|
|
|
@ -324,7 +324,7 @@ class FilesystemTest extends TestCase
|
||||||
$fs = new Filesystem();
|
$fs = new Filesystem();
|
||||||
|
|
||||||
$result1 = $fs->copy($this->workingDir . '/foo', $this->workingDir . '/foop');
|
$result1 = $fs->copy($this->workingDir . '/foo', $this->workingDir . '/foop');
|
||||||
$this->assertTrue($result1,'Copying directory failed.');
|
$this->assertTrue($result1, 'Copying directory failed.');
|
||||||
$this->assertTrue(is_dir($this->workingDir . '/foop'), 'Not a directory: ' . $this->workingDir . '/foop');
|
$this->assertTrue(is_dir($this->workingDir . '/foop'), 'Not a directory: ' . $this->workingDir . '/foop');
|
||||||
$this->assertTrue(is_dir($this->workingDir . '/foop/bar'), 'Not a directory: ' . $this->workingDir . '/foop/bar');
|
$this->assertTrue(is_dir($this->workingDir . '/foop/bar'), 'Not a directory: ' . $this->workingDir . '/foop/bar');
|
||||||
$this->assertTrue(is_dir($this->workingDir . '/foop/baz'), 'Not a directory: ' . $this->workingDir . '/foop/baz');
|
$this->assertTrue(is_dir($this->workingDir . '/foop/baz'), 'Not a directory: ' . $this->workingDir . '/foop/baz');
|
||||||
|
|
|
@ -252,7 +252,7 @@ class RemoteFilesystemTest extends TestCase
|
||||||
$io
|
$io
|
||||||
->expects($this->any())
|
->expects($this->any())
|
||||||
->method('hasAuthentication')
|
->method('hasAuthentication')
|
||||||
->will($this->returnCallback(function($arg) use (&$domains) {
|
->will($this->returnCallback(function ($arg) use (&$domains) {
|
||||||
$domains[] = $arg;
|
$domains[] = $arg;
|
||||||
// first time is called with bitbucket.org, then it redirects to bbuseruploads.s3.amazonaws.com so next time we have no auth configured
|
// first time is called with bitbucket.org, then it redirects to bbuseruploads.s3.amazonaws.com so next time we have no auth configured
|
||||||
return $arg === 'bitbucket.org';
|
return $arg === 'bitbucket.org';
|
||||||
|
|
Loading…
Reference in New Issue