CS fixes
parent
6f6228fb1d
commit
8d0b7f278e
|
@ -66,6 +66,7 @@ class Cache
|
||||||
if ($this->io->isDebug()) {
|
if ($this->io->isDebug()) {
|
||||||
$this->io->write('Reading '.$this->root . $file.' from cache');
|
$this->io->write('Reading '.$this->root . $file.' from cache');
|
||||||
}
|
}
|
||||||
|
|
||||||
return file_get_contents($this->root . $file);
|
return file_get_contents($this->root . $file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,6 +81,7 @@ class Cache
|
||||||
if ($this->io->isDebug()) {
|
if ($this->io->isDebug()) {
|
||||||
$this->io->write('Writing '.$this->root . $file.' into cache');
|
$this->io->write('Writing '.$this->root . $file.' into cache');
|
||||||
}
|
}
|
||||||
|
|
||||||
return file_put_contents($this->root . $file, $contents);
|
return file_put_contents($this->root . $file, $contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,6 +100,7 @@ class Cache
|
||||||
if ($this->io->isDebug()) {
|
if ($this->io->isDebug()) {
|
||||||
$this->io->write('Writing '.$this->root . $file.' into cache');
|
$this->io->write('Writing '.$this->root . $file.' into cache');
|
||||||
}
|
}
|
||||||
|
|
||||||
return copy($source, $this->root . $file);
|
return copy($source, $this->root . $file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,6 +119,7 @@ class Cache
|
||||||
if ($this->io->isDebug()) {
|
if ($this->io->isDebug()) {
|
||||||
$this->io->write('Reading '.$this->root . $file.' from cache');
|
$this->io->write('Reading '.$this->root . $file.' from cache');
|
||||||
}
|
}
|
||||||
|
|
||||||
return copy($this->root . $file, $target);
|
return copy($this->root . $file, $target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,6 +115,7 @@ EOT
|
||||||
$io->write('<info>Found an exact match '.$package->getPrettyString().'.</info>');
|
$io->write('<info>Found an exact match '.$package->getPrettyString().'.</info>');
|
||||||
} else {
|
} else {
|
||||||
$io->write('<error>Could not find a package matching '.$packageName.'.</error>');
|
$io->write('<error>Could not find a package matching '.$packageName.'.</error>');
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -284,6 +284,7 @@ EOT
|
||||||
if ('stash' === $val) {
|
if ('stash' === $val) {
|
||||||
return 'stash';
|
return 'stash';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $val !== 'false' && (bool) $val;
|
return $val !== 'false' && (bool) $val;
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
|
|
@ -14,9 +14,7 @@ namespace Composer\Command;
|
||||||
|
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Composer\Repository\CompositeRepository;
|
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Composer\Autoload\AutoloadGenerator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
|
|
@ -19,8 +19,6 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Composer\Repository\CompositeRepository;
|
use Composer\Repository\CompositeRepository;
|
||||||
use Composer\Repository\PlatformRepository;
|
use Composer\Repository\PlatformRepository;
|
||||||
use Composer\Repository\RepositoryInterface;
|
use Composer\Repository\RepositoryInterface;
|
||||||
use Composer\Package\CompletePackageInterface;
|
|
||||||
use Composer\Package\AliasPackage;
|
|
||||||
use Composer\Factory;
|
use Composer\Factory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -17,7 +17,6 @@ use Composer\DependencyResolver\Pool;
|
||||||
use Composer\DependencyResolver\DefaultPolicy;
|
use Composer\DependencyResolver\DefaultPolicy;
|
||||||
use Composer\Factory;
|
use Composer\Factory;
|
||||||
use Composer\Package\CompletePackageInterface;
|
use Composer\Package\CompletePackageInterface;
|
||||||
use Composer\Package\LinkConstraint\VersionConstraint;
|
|
||||||
use Composer\Package\Version\VersionParser;
|
use Composer\Package\Version\VersionParser;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
|
|
|
@ -742,7 +742,8 @@ class Installer
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function extractPlatformRequirements($links) {
|
private function extractPlatformRequirements($links)
|
||||||
|
{
|
||||||
$platformReqs = array();
|
$platformReqs = array();
|
||||||
foreach ($links as $link) {
|
foreach ($links as $link) {
|
||||||
if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
|
if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
|
||||||
|
|
|
@ -15,7 +15,6 @@ namespace Composer\Installer;
|
||||||
use Composer\Composer;
|
use Composer\Composer;
|
||||||
use Composer\Package\Package;
|
use Composer\Package\Package;
|
||||||
use Composer\IO\IOInterface;
|
use Composer\IO\IOInterface;
|
||||||
use Composer\Autoload\AutoloadGenerator;
|
|
||||||
use Composer\Repository\InstalledRepositoryInterface;
|
use Composer\Repository\InstalledRepositoryInterface;
|
||||||
use Composer\Package\PackageInterface;
|
use Composer\Package\PackageInterface;
|
||||||
|
|
||||||
|
|
|
@ -140,12 +140,14 @@ class LibraryInstaller implements InstallerInterface
|
||||||
public function getInstallPath(PackageInterface $package)
|
public function getInstallPath(PackageInterface $package)
|
||||||
{
|
{
|
||||||
$targetDir = $package->getTargetDir();
|
$targetDir = $package->getTargetDir();
|
||||||
|
|
||||||
return $this->getPackageBasePath($package) . ($targetDir ? '/'.$targetDir : '');
|
return $this->getPackageBasePath($package) . ($targetDir ? '/'.$targetDir : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getPackageBasePath(PackageInterface $package)
|
protected function getPackageBasePath(PackageInterface $package)
|
||||||
{
|
{
|
||||||
$this->initializeVendorDir();
|
$this->initializeVendorDir();
|
||||||
|
|
||||||
return ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
|
return ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
|
|
||||||
namespace Composer\Package\Archiver;
|
namespace Composer\Package\Archiver;
|
||||||
|
|
||||||
use Composer\Package\BasePackage;
|
|
||||||
use Composer\Package\PackageInterface;
|
|
||||||
use Composer\Util\Filesystem;
|
use Composer\Util\Filesystem;
|
||||||
|
|
||||||
use Symfony\Component\Finder;
|
use Symfony\Component\Finder;
|
||||||
|
@ -64,6 +62,7 @@ class ArchivableFilesFinder extends \FilterIterator
|
||||||
foreach ($filters as $filter) {
|
foreach ($filters as $filter) {
|
||||||
$exclude = $filter->filter($relativePath, $exclude);
|
$exclude = $filter->filter($relativePath, $exclude);
|
||||||
}
|
}
|
||||||
|
|
||||||
return !$exclude;
|
return !$exclude;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
namespace Composer\Package\Archiver;
|
namespace Composer\Package\Archiver;
|
||||||
|
|
||||||
use Composer\Downloader\DownloadManager;
|
use Composer\Downloader\DownloadManager;
|
||||||
use Composer\Factory;
|
|
||||||
use Composer\IO\NullIO;
|
|
||||||
use Composer\Package\PackageInterface;
|
use Composer\Package\PackageInterface;
|
||||||
use Composer\Package\RootPackage;
|
use Composer\Package\RootPackage;
|
||||||
use Composer\Util\Filesystem;
|
use Composer\Util\Filesystem;
|
||||||
|
@ -60,6 +58,7 @@ class ArchiveManager
|
||||||
public function setOverwriteFiles($overwriteFiles)
|
public function setOverwriteFiles($overwriteFiles)
|
||||||
{
|
{
|
||||||
$this->overwriteFiles = $overwriteFiles;
|
$this->overwriteFiles = $overwriteFiles;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
|
|
||||||
namespace Composer\Package\Archiver;
|
namespace Composer\Package\Archiver;
|
||||||
|
|
||||||
use Composer\Package\PackageInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Till Klampaeckel <till@php.net>
|
* @author Till Klampaeckel <till@php.net>
|
||||||
* @author Matthieu Moquet <matthieu@moquet.net>
|
* @author Matthieu Moquet <matthieu@moquet.net>
|
||||||
|
|
|
@ -63,6 +63,7 @@ abstract class BaseExcludeFilter
|
||||||
$exclude = !$negate;
|
$exclude = !$negate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $exclude;
|
return $exclude;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,6 +90,7 @@ abstract class BaseExcludeFilter
|
||||||
if ($line) {
|
if ($line) {
|
||||||
return call_user_func($lineParser, $line);
|
return call_user_func($lineParser, $line);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}, $lines),
|
}, $lines),
|
||||||
function ($pattern) {
|
function ($pattern) {
|
||||||
|
@ -110,6 +112,7 @@ abstract class BaseExcludeFilter
|
||||||
foreach ($rules as $rule) {
|
foreach ($rules as $rule) {
|
||||||
$patterns[] = $this->generatePattern($rule);
|
$patterns[] = $this->generatePattern($rule);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $patterns;
|
return $patterns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,6 +141,7 @@ abstract class BaseExcludeFilter
|
||||||
}
|
}
|
||||||
|
|
||||||
$pattern .= substr(Finder\Glob::toRegex($rule), 2, -2);
|
$pattern .= substr(Finder\Glob::toRegex($rule), 2, -2);
|
||||||
|
|
||||||
return array($pattern . '#', $negate, false);
|
return array($pattern . '#', $negate, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,7 @@ class HgExcludeFilter extends BaseExcludeFilter
|
||||||
} else {
|
} else {
|
||||||
$this->patternMode = self::HG_IGNORE_REGEX;
|
$this->patternMode = self::HG_IGNORE_REGEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,6 +86,7 @@ class HgExcludeFilter extends BaseExcludeFilter
|
||||||
{
|
{
|
||||||
$pattern = '#'.substr(Finder\Glob::toRegex($line), 2, -1).'#';
|
$pattern = '#'.substr(Finder\Glob::toRegex($line), 2, -1).'#';
|
||||||
$pattern = str_replace('[^/]*', '.*', $pattern);
|
$pattern = str_replace('[^/]*', '.*', $pattern);
|
||||||
|
|
||||||
return array($pattern, false, true);
|
return array($pattern, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,6 +101,7 @@ class HgExcludeFilter extends BaseExcludeFilter
|
||||||
{
|
{
|
||||||
// WTF need to escape the delimiter safely
|
// WTF need to escape the delimiter safely
|
||||||
$pattern = '#'.preg_replace('/((?:\\\\\\\\)*)(\\\\?)#/', '\1\2\2\\#', $line).'#';
|
$pattern = '#'.preg_replace('/((?:\\\\\\\\)*)(\\\\?)#/', '\1\2\2\\#', $line).'#';
|
||||||
|
|
||||||
return array($pattern, false, true);
|
return array($pattern, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,6 @@
|
||||||
|
|
||||||
namespace Composer\Package\Archiver;
|
namespace Composer\Package\Archiver;
|
||||||
|
|
||||||
use Composer\Package\BasePackage;
|
|
||||||
use Composer\Package\PackageInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Till Klampaeckel <till@php.net>
|
* @author Till Klampaeckel <till@php.net>
|
||||||
* @author Nils Adermann <naderman@naderman.de>
|
* @author Nils Adermann <naderman@naderman.de>
|
||||||
|
@ -43,6 +40,7 @@ class PharArchiver implements ArchiverInterface
|
||||||
$phar = new \PharData($target, null, null, static::$formats[$format]);
|
$phar = new \PharData($target, null, null, static::$formats[$format]);
|
||||||
$files = new ArchivableFilesFinder($sources, $excludes);
|
$files = new ArchivableFilesFinder($sources, $excludes);
|
||||||
$phar->buildFromIterator($files, $sources);
|
$phar->buildFromIterator($files, $sources);
|
||||||
|
|
||||||
return $target;
|
return $target;
|
||||||
} catch (\UnexpectedValueException $e) {
|
} catch (\UnexpectedValueException $e) {
|
||||||
$message = sprintf("Could not create archive '%s' from '%s': %s",
|
$message = sprintf("Could not create archive '%s' from '%s': %s",
|
||||||
|
|
|
@ -12,9 +12,6 @@
|
||||||
|
|
||||||
namespace Composer\Package;
|
namespace Composer\Package;
|
||||||
|
|
||||||
use Composer\Package\LinkConstraint\VersionConstraint;
|
|
||||||
use Composer\Package\Version\VersionParser;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -326,4 +326,3 @@ class SvnDriver extends VcsDriver
|
||||||
return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision;
|
return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
|
|
||||||
namespace Composer\Script;
|
namespace Composer\Script;
|
||||||
|
|
||||||
use Composer\Autoload\AutoloadGenerator;
|
|
||||||
use Composer\IO\IOInterface;
|
use Composer\IO\IOInterface;
|
||||||
use Composer\Composer;
|
use Composer\Composer;
|
||||||
use Composer\DependencyResolver\Operation\OperationInterface;
|
use Composer\DependencyResolver\Operation\OperationInterface;
|
||||||
|
|
|
@ -71,7 +71,7 @@ class GitHub
|
||||||
* @param string $originUrl The host this GitHub instance is located at
|
* @param string $originUrl The host this GitHub instance is located at
|
||||||
* @param string $message The reason this authorization is required
|
* @param string $message The reason this authorization is required
|
||||||
* @throws \RuntimeException
|
* @throws \RuntimeException
|
||||||
* @throws \Composer\Downloader\TransportException|\Exception
|
* @throws TransportException|\Exception
|
||||||
* @return bool true on success
|
* @return bool true on success
|
||||||
*/
|
*/
|
||||||
public function authorizeOAuthInteractively($originUrl, $message = null)
|
public function authorizeOAuthInteractively($originUrl, $message = null)
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
function includeIfExists($file)
|
function includeIfExists($file)
|
||||||
{
|
{
|
||||||
return file_exists($file)===true ? include $file : false;
|
return file_exists($file) ? include $file : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
|
if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
|
||||||
|
|
|
@ -67,6 +67,7 @@ class AutoloadGeneratorTest extends TestCase
|
||||||
->method('getInstallPath')
|
->method('getInstallPath')
|
||||||
->will($this->returnCallback(function ($package) use ($that) {
|
->will($this->returnCallback(function ($package) use ($that) {
|
||||||
$targetDir = $package->getTargetDir();
|
$targetDir = $package->getTargetDir();
|
||||||
|
|
||||||
return $that->vendorDir.'/'.$package->getName() . ($targetDir ? '/'.$targetDir : '');
|
return $that->vendorDir.'/'.$package->getName() . ($targetDir ? '/'.$targetDir : '');
|
||||||
}));
|
}));
|
||||||
$this->repository = $this->getMock('Composer\Repository\InstalledRepositoryInterface');
|
$this->repository = $this->getMock('Composer\Repository\InstalledRepositoryInterface');
|
||||||
|
@ -697,6 +698,7 @@ EOF;
|
||||||
->method('getInstallPath')
|
->method('getInstallPath')
|
||||||
->will($this->returnCallback(function ($package) use ($vendorDir) {
|
->will($this->returnCallback(function ($package) use ($vendorDir) {
|
||||||
$targetDir = $package->getTargetDir();
|
$targetDir = $package->getTargetDir();
|
||||||
|
|
||||||
return $vendorDir.'/'.$package->getName() . ($targetDir ? '/'.$targetDir : '');
|
return $vendorDir.'/'.$package->getName() . ($targetDir ? '/'.$targetDir : '');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ use Composer\Test\TestCase;
|
||||||
|
|
||||||
class InitCommandTest extends TestCase
|
class InitCommandTest extends TestCase
|
||||||
{
|
{
|
||||||
function testParseValidAuthorString()
|
public function testParseValidAuthorString()
|
||||||
{
|
{
|
||||||
$command = new InitCommand;
|
$command = new InitCommand;
|
||||||
$author = $command->parseAuthorString('John Smith <john@example.com>');
|
$author = $command->parseAuthorString('John Smith <john@example.com>');
|
||||||
|
@ -25,14 +25,14 @@ class InitCommandTest extends TestCase
|
||||||
$this->assertEquals('john@example.com', $author['email']);
|
$this->assertEquals('john@example.com', $author['email']);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testParseEmptyAuthorString()
|
public function testParseEmptyAuthorString()
|
||||||
{
|
{
|
||||||
$command = new InitCommand;
|
$command = new InitCommand;
|
||||||
$this->setExpectedException('InvalidArgumentException');
|
$this->setExpectedException('InvalidArgumentException');
|
||||||
$command->parseAuthorString('');
|
$command->parseAuthorString('');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testParseAuthorStringWithInvalidEmail()
|
public function testParseAuthorStringWithInvalidEmail()
|
||||||
{
|
{
|
||||||
$command = new InitCommand;
|
$command = new InitCommand;
|
||||||
$this->setExpectedException('InvalidArgumentException');
|
$this->setExpectedException('InvalidArgumentException');
|
||||||
|
|
|
@ -13,9 +13,7 @@
|
||||||
namespace Composer\Test\Package\Archiver;
|
namespace Composer\Test\Package\Archiver;
|
||||||
|
|
||||||
use Composer\Factory;
|
use Composer\Factory;
|
||||||
use Composer\IO\NullIO;
|
|
||||||
use Composer\Package\Archiver;
|
use Composer\Package\Archiver;
|
||||||
use Composer\Package\Archiver\ArchiveManager;
|
|
||||||
use Composer\Package\PackageInterface;
|
use Composer\Package\PackageInterface;
|
||||||
|
|
||||||
class ArchiveManagerTest extends ArchiverTest
|
class ArchiveManagerTest extends ArchiverTest
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
namespace Composer\Test\Package;
|
namespace Composer\Test\Package;
|
||||||
|
|
||||||
use Composer\Package\Locker;
|
use Composer\Package\Locker;
|
||||||
use Composer\Package\CompletePackage;
|
|
||||||
|
|
||||||
class LockerTest extends \PHPUnit_Framework_TestCase
|
class LockerTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue