main
Jordi Boggiano 9 years ago
parent 4d36622ada
commit 6a64041055

@ -290,8 +290,8 @@ EOT
// handler Ctrl+C for unix-like systems // handler Ctrl+C for unix-like systems
if (function_exists('pcntl_signal')) { if (function_exists('pcntl_signal')) {
declare(ticks = 100); declare (ticks = 100);
pcntl_signal(SIGINT, function() use ($directory) { pcntl_signal(SIGINT, function () use ($directory) {
$fs = new Filesystem(); $fs = new Filesystem();
$fs->removeDirectory($directory); $fs->removeDirectory($directory);
exit(130); exit(130);

@ -295,7 +295,7 @@ EOT
private function checkDiskSpace($config) private function checkDiskSpace($config)
{ {
$minSpaceFree = 1024*1024; $minSpaceFree = 1024 * 1024;
if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree) if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
|| (($df = @disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree) || (($df = @disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
) { ) {

@ -181,7 +181,7 @@ class Application extends BaseApplication
if ($composer) { if ($composer) {
$config = $composer->getConfig(); $config = $composer->getConfig();
$minSpaceFree = 1024*1024; $minSpaceFree = 1024 * 1024;
if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree) if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
|| (($df = @disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree) || (($df = @disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
|| (($df = @disk_free_space($dir = sys_get_temp_dir())) !== false && $df < $minSpaceFree) || (($df = @disk_free_space($dir = sys_get_temp_dir())) !== false && $df < $minSpaceFree)

@ -60,6 +60,7 @@ class HtmlOutputFormatter extends OutputFormatter
$formatted = parent::format($message); $formatted = parent::format($message);
$clearEscapeCodes = '(?:39|49|0|22|24|25|27|28)'; $clearEscapeCodes = '(?:39|49|0|22|24|25|27|28)';
return preg_replace_callback("{\033\[([0-9;]+)m(.*?)\033\[(?:".$clearEscapeCodes.";)*?".$clearEscapeCodes."m}s", array($this, 'formatHtml'), $formatted); return preg_replace_callback("{\033\[([0-9;]+)m(.*?)\033\[(?:".$clearEscapeCodes.";)*?".$clearEscapeCodes."m}s", array($this, 'formatHtml'), $formatted);
} }

@ -32,7 +32,7 @@ class SolverProblemsException extends \RuntimeException
{ {
$text = "\n"; $text = "\n";
foreach ($this->problems as $i => $problem) { foreach ($this->problems as $i => $problem) {
$text .= " Problem ".($i+1).$problem->getPrettyString($this->installedMap)."\n"; $text .= " Problem ".($i + 1).$problem->getPrettyString($this->installedMap)."\n";
} }
if (strpos($text, 'could not be found') || strpos($text, 'no matching package found')) { if (strpos($text, 'could not be found') || strpos($text, 'no matching package found')) {

@ -115,7 +115,7 @@ abstract class ArchiveDownloader extends FileDownloader
// update api archives to the proper reference // update api archives to the proper reference
$url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $package->getDistReference(); $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $package->getDistReference();
} }
} else if ($package->getDistReference() && strpos($url, 'bitbucket.org')) { } elseif ($package->getDistReference() && strpos($url, 'bitbucket.org')) {
if (preg_match('{^https?://(?:www\.)?bitbucket\.org/([^/]+)/([^/]+)/get/(.+)\.(zip|tar\.gz|tar\.bz2)$}i', $url, $match)) { if (preg_match('{^https?://(?:www\.)?bitbucket\.org/([^/]+)/([^/]+)/get/(.+)\.(zip|tar\.gz|tar\.bz2)$}i', $url, $match)) {
// update Bitbucket archives to the proper reference // update Bitbucket archives to the proper reference
$url = 'https://bitbucket.org/' . $match[1] . '/'. $match[2] . '/get/' . $package->getDistReference() . '.' . $match[4]; $url = 'https://bitbucket.org/' . $match[1] . '/'. $match[2] . '/get/' . $package->getDistReference() . '.' . $match[4];

@ -141,10 +141,10 @@ class VersionParser
if ('stable' === $matches[$index]) { if ('stable' === $matches[$index]) {
return $version; return $version;
} }
$version .= '-' . $this->expandStability($matches[$index]) . (!empty($matches[$index+1]) ? $matches[$index+1] : ''); $version .= '-' . $this->expandStability($matches[$index]) . (!empty($matches[$index + 1]) ? $matches[$index + 1] : '');
} }
if (!empty($matches[$index+2])) { if (!empty($matches[$index + 2])) {
$version .= '-dev'; $version .= '-dev';
} }
@ -530,8 +530,8 @@ class VersionParser
for ($i = 0, $count = count($pairs); $i < $count; $i++) { for ($i = 0, $count = count($pairs); $i < $count; $i++) {
$pair = preg_replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i])); $pair = preg_replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i]));
if (false === strpos($pair, ' ') && isset($pairs[$i+1]) && false === strpos($pairs[$i+1], '/')) { if (false === strpos($pair, ' ') && isset($pairs[$i + 1]) && false === strpos($pairs[$i + 1], '/')) {
$pair .= ' '.$pairs[$i+1]; $pair .= ' '.$pairs[$i + 1];
$i++; $i++;
} }

@ -58,6 +58,7 @@ class ErrorHandler
if (isset($a['line'], $a['file'])) { if (isset($a['line'], $a['file'])) {
return '<warning> '.$a['file'].':'.$a['line'].'</warning>'; return '<warning> '.$a['file'].':'.$a['line'].'</warning>';
} }
return null; return null;
}, array_slice(debug_backtrace(), 2)))); }, array_slice(debug_backtrace(), 2))));
} }

@ -94,6 +94,7 @@ class GitHub
if (!$token) { if (!$token) {
$this->io->writeError('<warning>No token given, aborting.</warning>'); $this->io->writeError('<warning>No token given, aborting.</warning>');
$this->io->writeError('You can also add it manually later by using "composer config github-oauth.github.com <token>"'); $this->io->writeError('You can also add it manually later by using "composer config github-oauth.github.com <token>"');
return false; return false;
} }

@ -13,7 +13,6 @@
namespace Composer\Test\EventDispatcher; namespace Composer\Test\EventDispatcher;
use Composer\EventDispatcher\Event; use Composer\EventDispatcher\Event;
use Composer\EventDispatcher\EventDispatcher;
use Composer\Installer\InstallerEvents; use Composer\Installer\InstallerEvents;
use Composer\TestCase; use Composer\TestCase;
use Composer\Script\ScriptEvents; use Composer\Script\ScriptEvents;

@ -14,7 +14,6 @@ namespace Composer\Test;
use Composer\Installer; use Composer\Installer;
use Composer\Console\Application; use Composer\Console\Application;
use Composer\Config;
use Composer\Json\JsonFile; use Composer\Json\JsonFile;
use Composer\Repository\ArrayRepository; use Composer\Repository\ArrayRepository;
use Composer\Repository\RepositoryManager; use Composer\Repository\RepositoryManager;

@ -12,8 +12,6 @@
namespace Composer\Test\Package; namespace Composer\Test\Package;
use Composer\Package\BasePackage;
class BasePackageTest extends \PHPUnit_Framework_TestCase class BasePackageTest extends \PHPUnit_Framework_TestCase
{ {
public function testSetSameRepository() public function testSetSameRepository()

@ -16,7 +16,6 @@ use Composer\Config;
use Composer\Package\Loader\RootPackageLoader; use Composer\Package\Loader\RootPackageLoader;
use Composer\Package\BasePackage; use Composer\Package\BasePackage;
use Composer\Test\Mock\ProcessExecutorMock; use Composer\Test\Mock\ProcessExecutorMock;
use Composer\Repository\RepositoryManager;
class RootPackageLoaderTest extends \PHPUnit_Framework_TestCase class RootPackageLoaderTest extends \PHPUnit_Framework_TestCase
{ {

@ -12,7 +12,6 @@
namespace Composer\Test\Package\Loader; namespace Composer\Test\Package\Loader;
use Composer\Package;
use Composer\Package\Loader\ValidatingArrayLoader; use Composer\Package\Loader\ValidatingArrayLoader;
use Composer\Package\Loader\InvalidPackageException; use Composer\Package\Loader\InvalidPackageException;

@ -242,7 +242,7 @@ class PluginInstallerTest extends TestCase
$this->repository $this->repository
->expects($this->any()) ->expects($this->any())
->method('getPackages') ->method('getPackages')
->will($this->returnCallback(function() use($plugApiInternalPackage, $plugins) { ->will($this->returnCallback(function () use ($plugApiInternalPackage, $plugins) {
return array_merge(array($plugApiInternalPackage), $plugins); return array_merge(array($plugApiInternalPackage), $plugins);
})); }));

@ -12,7 +12,6 @@
namespace Composer\Test\Repository; namespace Composer\Test\Repository;
use Composer\Repository\ComposerRepository;
use Composer\IO\NullIO; use Composer\IO\NullIO;
use Composer\Test\Mock\FactoryMock; use Composer\Test\Mock\FactoryMock;
use Composer\TestCase; use Composer\TestCase;

@ -13,7 +13,6 @@
namespace Composer\Test\Util; namespace Composer\Test\Util;
use Composer\Util\RemoteFilesystem; use Composer\Util\RemoteFilesystem;
use Installer\Exception;
class RemoteFilesystemTest extends \PHPUnit_Framework_TestCase class RemoteFilesystemTest extends \PHPUnit_Framework_TestCase
{ {

@ -13,7 +13,6 @@
namespace Composer; namespace Composer;
use Composer\Package\Version\VersionParser; use Composer\Package\Version\VersionParser;
use Composer\Package\Package;
use Composer\Package\AliasPackage; use Composer\Package\AliasPackage;
use Composer\Package\LinkConstraint\VersionConstraint; use Composer\Package\LinkConstraint\VersionConstraint;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;

Loading…
Cancel
Save