mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
CS fixes
This commit is contained in:
parent
d036b2390e
commit
ac497feaba
53 changed files with 166 additions and 156 deletions
|
@ -205,7 +205,8 @@ class ClassLoader
|
|||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param array|string $paths The PSR-4 base directories
|
||||
*/
|
||||
public function setPsr4($prefix, $paths) {
|
||||
public function setPsr4($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr4 = (array) $paths;
|
||||
} else {
|
||||
|
|
|
@ -144,8 +144,7 @@ class Cache
|
|||
|
||||
public function gc($ttl, $maxSize)
|
||||
{
|
||||
if ($this->enabled)
|
||||
{
|
||||
if ($this->enabled) {
|
||||
$expire = new \DateTime();
|
||||
$expire->modify('-'.$ttl.' seconds');
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ EOT
|
|||
if (0 === $returnCode) {
|
||||
$this->getComposer()->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ARCHIVE_CMD);
|
||||
}
|
||||
|
||||
return $returnCode;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ use Composer\Installer\ProjectInstaller;
|
|||
use Composer\Installer\InstallationManager;
|
||||
use Composer\IO\IOInterface;
|
||||
use Composer\Package\BasePackage;
|
||||
use Composer\Package\LinkConstraint\VersionConstraint;
|
||||
use Composer\DependencyResolver\Pool;
|
||||
use Composer\DependencyResolver\Operation\InstallOperation;
|
||||
use Composer\Repository\ComposerRepository;
|
||||
|
|
|
@ -64,6 +64,7 @@ EOT
|
|||
{
|
||||
if ($args = $input->getArgument('packages')) {
|
||||
$output->writeln('<error>Invalid argument '.implode(' ', $args).'. Use "composer require '.implode(' ', $args).'" instead to add packages to your composer.json.</error>');
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -187,6 +187,7 @@ class JsonConfigSource implements ConfigSourceInterface
|
|||
{
|
||||
$return = array_unshift($array, '');
|
||||
$array[0] =& $value;
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
namespace Composer\DependencyResolver;
|
||||
|
||||
use Composer\Package\AliasPackage;
|
||||
use Composer\DependencyResolver\Operation;
|
||||
|
||||
/**
|
||||
* @author Nils Adermann <naderman@naderman.de>
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
namespace Composer\Downloader;
|
||||
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Downloader\DownloaderInterface;
|
||||
use Composer\IO\IOInterface;
|
||||
use Composer\Util\Filesystem;
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ use Composer\Plugin\PluginEvents;
|
|||
use Composer\Plugin\PreFileDownloadEvent;
|
||||
use Composer\EventDispatcher\EventDispatcher;
|
||||
use Composer\Util\Filesystem;
|
||||
use Composer\Util\GitHub;
|
||||
use Composer\Util\RemoteFilesystem;
|
||||
|
||||
/**
|
||||
|
@ -60,7 +59,6 @@ class FileDownloader implements DownloaderInterface
|
|||
$this->filesystem = $filesystem ?: new Filesystem();
|
||||
$this->cache = $cache;
|
||||
|
||||
|
||||
if ($this->cache && $this->cache->gcIsNecessary()) {
|
||||
$this->cache->gc($config->get('cache-files-ttl'), $config->get('cache-files-maxsize'));
|
||||
}
|
||||
|
|
|
@ -68,4 +68,3 @@ class GzipDownloader extends ArchiveDownloader
|
|||
return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,10 +44,10 @@ class PerforceDownloader extends VcsDownloader
|
|||
private function getLabelFromSourceReference($ref)
|
||||
{
|
||||
$pos = strpos($ref,'@');
|
||||
if (false !== $pos)
|
||||
{
|
||||
if (false !== $pos) {
|
||||
return substr($ref, $pos + 1);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -55,6 +55,7 @@ class PerforceDownloader extends VcsDownloader
|
|||
{
|
||||
if (!empty($this->perforce)) {
|
||||
$this->perforce->initializePath($path);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ use Composer\DependencyResolver\SolverProblemsException;
|
|||
use Composer\Downloader\DownloadManager;
|
||||
use Composer\EventDispatcher\EventDispatcher;
|
||||
use Composer\Installer\InstallationManager;
|
||||
use Composer\Config;
|
||||
use Composer\Installer\NoopInstaller;
|
||||
use Composer\IO\IOInterface;
|
||||
use Composer\Json\JsonFile;
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
namespace Composer\Json;
|
||||
|
||||
use JsonSchema\Validator;
|
||||
use JsonSchema\Uri\UriRetriever;
|
||||
use Seld\JsonLint\JsonParser;
|
||||
use Seld\JsonLint\ParsingException;
|
||||
use Composer\Util\RemoteFilesystem;
|
||||
|
|
|
@ -76,6 +76,7 @@ class JsonFormatter
|
|||
'UCS-2BE'
|
||||
);
|
||||
}
|
||||
|
||||
return $match[0];
|
||||
}, $buffer);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
namespace Composer\Package;
|
||||
|
||||
use Composer\Package\LinkConstraint\LinkConstraintInterface;
|
||||
use Composer\Package\PackageInterface;
|
||||
|
||||
/**
|
||||
* Represents a link between two packages, represented by their names
|
||||
|
|
|
@ -320,6 +320,7 @@ class RootPackageLoader extends ArrayLoader
|
|||
if ('9999999-dev' === $version) {
|
||||
$version = 'dev-'.$matches[3];
|
||||
}
|
||||
|
||||
return $version;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ use Composer\Json\JsonFile;
|
|||
use Composer\Installer\InstallationManager;
|
||||
use Composer\Repository\RepositoryManager;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
use Composer\Package\AliasPackage;
|
||||
use Composer\Repository\ArrayRepository;
|
||||
use Composer\Package\Dumper\ArrayDumper;
|
||||
use Composer\Package\Loader\ArrayLoader;
|
||||
|
|
|
@ -81,7 +81,8 @@ class ArtifactRepository extends ArrayRepository
|
|||
* @param $filename
|
||||
* @return bool|int
|
||||
*/
|
||||
private function locateFile(\ZipArchive $zip, $filename) {
|
||||
private function locateFile(\ZipArchive $zip, $filename)
|
||||
{
|
||||
$indexOfShortestMatch = false;
|
||||
$lengthOfShortestMatch = -1;
|
||||
|
||||
|
|
|
@ -275,6 +275,7 @@ class ComposerRepository extends ArrayRepository implements StreamableRepository
|
|||
foreach ($package->getDistUrls() as $url) {
|
||||
if (strpos($url, $this->baseUrl) === 0) {
|
||||
$package->setTransportOptions($this->options);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,7 +161,6 @@ class PlatformRepository extends ArrayRepository
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private function buildPackageName($name)
|
||||
{
|
||||
return 'ext-' . str_replace(' ', '-', $name);
|
||||
|
|
|
@ -54,6 +54,7 @@ class GitHubDriver extends VcsDriver
|
|||
|
||||
if (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api']) {
|
||||
$this->setupGitDriver($this->url);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -140,6 +140,7 @@ class PerforceDriver extends VcsDriver
|
|||
{
|
||||
$this->composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier);
|
||||
$this->composerInfoIdentifier = $identifier;
|
||||
|
||||
return !empty($this->composerInfo);
|
||||
}
|
||||
|
||||
|
|
|
@ -53,12 +53,14 @@ class Perforce
|
|||
{
|
||||
$isWindows = defined('PHP_WINDOWS_VERSION_BUILD');
|
||||
$perforce = new Perforce($repoConfig, $port, $path, $process, $isWindows, $io);
|
||||
|
||||
return $perforce;
|
||||
}
|
||||
|
||||
public static function checkServerExists($url, ProcessExecutor $processExecutor)
|
||||
{
|
||||
$output = null;
|
||||
|
||||
return 0 === $processExecutor->execute('p4 -p ' . $url . ' info -s', $output);
|
||||
}
|
||||
|
||||
|
@ -119,6 +121,7 @@ class Perforce
|
|||
{
|
||||
$this->commandResult = "";
|
||||
$exit_code = $this->process->execute($command, $this->commandResult);
|
||||
|
||||
return $exit_code;
|
||||
}
|
||||
|
||||
|
@ -248,6 +251,7 @@ class Perforce
|
|||
$command = 'echo $' . $name;
|
||||
$this->executeCommand($command);
|
||||
$result = trim($this->commandResult);
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
@ -295,6 +299,7 @@ class Perforce
|
|||
}
|
||||
throw new \Exception('Invalid user name: ' . $this->getUser() );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -471,6 +476,7 @@ class Perforce
|
|||
$lastCommitNum = $lastCommitArr[1];
|
||||
|
||||
$branches = array('master' => $possibleBranches[$this->p4Branch] . '@'. $lastCommitNum);
|
||||
|
||||
return $branches;
|
||||
}
|
||||
|
||||
|
@ -488,6 +494,7 @@ class Perforce
|
|||
$tags[$fields[1]] = $this->getStream() . '@' . $fields[1];
|
||||
}
|
||||
}
|
||||
|
||||
return $tags;
|
||||
}
|
||||
|
||||
|
@ -552,14 +559,13 @@ class Perforce
|
|||
|
||||
public function getFilesystem()
|
||||
{
|
||||
if (empty($this->filesystem))
|
||||
{
|
||||
if (empty($this->filesystem)) {
|
||||
$this->filesystem = new Filesystem($this->process);
|
||||
}
|
||||
|
||||
return $this->filesystem;
|
||||
}
|
||||
|
||||
|
||||
public function setFilesystem(Filesystem $fs)
|
||||
{
|
||||
$this->filesystem = $fs;
|
||||
|
|
|
@ -65,6 +65,7 @@ class PerforceDownloaderTest extends \PHPUnit_Framework_TestCase
|
|||
$config = new Config();
|
||||
$settings = array('config' => array('home' => $this->testPath));
|
||||
$config->merge($settings);
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
|
@ -77,6 +78,7 @@ class PerforceDownloaderTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$package = $this->getMock('Composer\Package\PackageInterface');
|
||||
$package->expects($this->any())->method('getRepository')->will($this->returnValue($repository));
|
||||
|
||||
return $package;
|
||||
}
|
||||
|
||||
|
@ -92,6 +94,7 @@ class PerforceDownloaderTest extends \PHPUnit_Framework_TestCase
|
|||
$args = array($repoConfig, $io, $config);
|
||||
$repository = $this->getMock($class, $methods, $args);
|
||||
$repository->expects($this->any())->method('getRepoConfig')->will($this->returnValue($repoConfig));
|
||||
|
||||
return $repository;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ class JsonFormatterTest extends \PHPUnit_Framework_TestCase
|
|||
for ($i = 0; $i < strlen($string); $i++) {
|
||||
$codes[] = ord($string[$i]);
|
||||
}
|
||||
|
||||
return implode('+', $codes);
|
||||
}
|
||||
|
||||
|
|
|
@ -198,6 +198,7 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
if (!$mustCheck) {
|
||||
$this->assertTrue(true);
|
||||
|
||||
return;
|
||||
}
|
||||
$internalLoader = $this->getMock('Composer\Package\Loader\LoaderInterface');
|
||||
|
|
|
@ -83,4 +83,3 @@ class ArtifactRepositoryTest extends TestCase
|
|||
//
|
||||
// $zipFile->close();
|
||||
//}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
namespace Composer\Repository;
|
||||
|
||||
use Composer\Repository\FilesystemRepository;
|
||||
use Composer\TestCase;
|
||||
|
||||
class FilesystemRepositoryTest extends TestCase
|
||||
|
|
|
@ -74,6 +74,7 @@ class PerforceDriverTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$config = new Config();
|
||||
$config->merge(array('config'=>array('home'=>$testPath)));
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
|
@ -104,6 +105,7 @@ class PerforceDriverTest extends \PHPUnit_Framework_TestCase
|
|||
protected function getMockPerforce()
|
||||
{
|
||||
$methods = array('p4login', 'checkStream', 'writeP4ClientSpec', 'connectClient', 'getComposerInformation', 'cleanupClientSpec');
|
||||
|
||||
return $this->getMockBuilder('Composer\Util\Perforce', $methods)->disableOriginalConstructor()->getMock();
|
||||
}
|
||||
|
||||
|
|
|
@ -139,9 +139,9 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
|
|||
$this->createNewPerforceWithWindowsFlag(true);
|
||||
$this->perforce->setUser(null);
|
||||
$expectedCommand = 'p4 set';
|
||||
$callback = function($command, &$output)
|
||||
{
|
||||
$callback = function ($command, &$output) {
|
||||
$output = 'P4USER=TEST_P4VARIABLE_USER' . PHP_EOL;
|
||||
|
||||
return true;
|
||||
};
|
||||
$this->processExecutor->expects($this->at(0))
|
||||
|
@ -157,9 +157,9 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
|
|||
$this->createNewPerforceWithWindowsFlag(false);
|
||||
$this->perforce->setUser(null);
|
||||
$expectedCommand = 'echo $P4USER';
|
||||
$callback = function($command, &$output)
|
||||
{
|
||||
$callback = function ($command, &$output) {
|
||||
$output = 'TEST_P4VARIABLE_USER' . PHP_EOL;
|
||||
|
||||
return true;
|
||||
};
|
||||
$this->processExecutor->expects($this->at(0))
|
||||
|
@ -233,9 +233,9 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$this->createNewPerforceWithWindowsFlag(true);
|
||||
$expectedCommand = 'p4 set';
|
||||
$callback = function($command, &$output)
|
||||
{
|
||||
$callback = function ($command, &$output) {
|
||||
$output = 'P4PASSWD=TEST_P4VARIABLE_PASSWORD' . PHP_EOL;
|
||||
|
||||
return true;
|
||||
};
|
||||
$this->processExecutor->expects($this->at(0))
|
||||
|
@ -250,9 +250,9 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$this->createNewPerforceWithWindowsFlag(false);
|
||||
$expectedCommand = 'echo $P4PASSWD';
|
||||
$callback = function($command, &$output)
|
||||
{
|
||||
$callback = function ($command, &$output) {
|
||||
$output = 'TEST_P4VARIABLE_PASSWORD' . PHP_EOL;
|
||||
|
||||
return true;
|
||||
};
|
||||
$this->processExecutor->expects($this->at(0))
|
||||
|
@ -357,9 +357,9 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
|
|||
)
|
||||
);
|
||||
$expectedCommand2 = 'p4 -u user -p port changes //depot/branch/...';
|
||||
$expectedCallback = function($command, &$output)
|
||||
{
|
||||
$expectedCallback = function ($command, &$output) {
|
||||
$output = 'Change 1234 on 2014/03/19 by Clark.Stuth@Clark.Stuth_test_client \'test changelist\'';
|
||||
|
||||
return true;
|
||||
};
|
||||
$this->processExecutor->expects($this->at(1))
|
||||
|
@ -374,9 +374,9 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
|
|||
public function testGetBranchesWithoutStream()
|
||||
{
|
||||
$expectedCommand = 'p4 -u user -p port changes //depot/...';
|
||||
$expectedCallback = function($command, &$output)
|
||||
{
|
||||
$expectedCallback = function ($command, &$output) {
|
||||
$output = 'Change 5678 on 2014/03/19 by Clark.Stuth@Clark.Stuth_test_client \'test changelist\'';
|
||||
|
||||
return true;
|
||||
};
|
||||
$this->processExecutor->expects($this->once())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue