CS fixes
parent
64d653ad92
commit
1818b95149
|
@ -332,11 +332,11 @@ EOT
|
|||
'disable-tls' => array($booleanValidator, $booleanNormalizer),
|
||||
'cafile' => array(
|
||||
function ($val) { return file_exists($val) && is_readable($val); },
|
||||
function ($val) { return $val === 'null' ? null : $val; }
|
||||
function ($val) { return $val === 'null' ? null : $val; },
|
||||
),
|
||||
'capath' => array(
|
||||
function ($val) { return is_dir($val) && is_readable($val); },
|
||||
function ($val) { return $val === 'null' ? null : $val; }
|
||||
function ($val) { return $val === 'null' ? null : $val; },
|
||||
),
|
||||
'github-expose-hostname' => array($booleanValidator, $booleanNormalizer),
|
||||
);
|
||||
|
|
|
@ -36,7 +36,6 @@ use Symfony\Component\Finder\Finder;
|
|||
use Composer\Json\JsonFile;
|
||||
use Composer\Config\JsonConfigSource;
|
||||
use Composer\Util\Filesystem;
|
||||
use Composer\Util\RemoteFilesystem;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
|
||||
/**
|
||||
|
|
|
@ -132,7 +132,7 @@ EOT
|
|||
} else {
|
||||
$matchText = '';
|
||||
if ($input->getOption('match-constraint') !== '*') {
|
||||
$matchText = ' in versions '.($matchInvert ? 'not ':'').'matching ' . $input->getOption('match-constraint');
|
||||
$matchText = ' in versions '.($matchInvert ? 'not ' : '').'matching ' . $input->getOption('match-constraint');
|
||||
}
|
||||
$io->writeError('<info>There is no installed package depending on "'.$needle.'"'.$matchText.'.</info>');
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ use Composer\Config;
|
|||
use Composer\Util\Filesystem;
|
||||
use Composer\Util\Keys;
|
||||
use Composer\IO\IOInterface;
|
||||
use Composer\Util\RemoteFilesystem;
|
||||
use Composer\Downloader\FilesystemException;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
@ -232,6 +231,7 @@ TAGSPUBKEY
|
|||
if (!preg_match('{^-----BEGIN PUBLIC KEY-----$}', trim($value))) {
|
||||
throw new \UnexpectedValueException('Invalid input');
|
||||
}
|
||||
|
||||
return trim($value)."\n";
|
||||
};
|
||||
|
||||
|
|
|
@ -458,7 +458,7 @@ EOT
|
|||
/**
|
||||
* Init styles for tree
|
||||
*
|
||||
* @param OutputInterface $output
|
||||
* @param OutputInterface $output
|
||||
*/
|
||||
protected function initStyles(OutputInterface $output)
|
||||
{
|
||||
|
@ -479,10 +479,10 @@ EOT
|
|||
/**
|
||||
* Display the tree
|
||||
*
|
||||
* @param PackageInterface|string $package
|
||||
* @param RepositoryInterface $installedRepo
|
||||
* @param RepositoryInterface $distantRepos
|
||||
* @param OutputInterface $output
|
||||
* @param PackageInterface|string $package
|
||||
* @param RepositoryInterface $installedRepo
|
||||
* @param RepositoryInterface $distantRepos
|
||||
* @param OutputInterface $output
|
||||
*/
|
||||
protected function displayPackageTree(PackageInterface $package, RepositoryInterface $installedRepo, RepositoryInterface $distantRepos, OutputInterface $output)
|
||||
{
|
||||
|
@ -524,14 +524,14 @@ EOT
|
|||
/**
|
||||
* Display a package tree
|
||||
*
|
||||
* @param string $name
|
||||
* @param PackageInterface|string $package
|
||||
* @param RepositoryInterface $installedRepo
|
||||
* @param RepositoryInterface $distantRepos
|
||||
* @param array $packagesInTree
|
||||
* @param OutputInterface $output
|
||||
* @param string $previousTreeBar
|
||||
* @param integer $level
|
||||
* @param string $name
|
||||
* @param PackageInterface|string $package
|
||||
* @param RepositoryInterface $installedRepo
|
||||
* @param RepositoryInterface $distantRepos
|
||||
* @param array $packagesInTree
|
||||
* @param OutputInterface $output
|
||||
* @param string $previousTreeBar
|
||||
* @param int $level
|
||||
*/
|
||||
protected function displayTree($name, $package, RepositoryInterface $installedRepo, RepositoryInterface $distantRepos, array $packagesInTree, OutputInterface $output, $previousTreeBar = '├', $level = 1)
|
||||
{
|
||||
|
|
|
@ -16,7 +16,6 @@ use Composer\Util\Silencer;
|
|||
use Symfony\Component\Console\Application as BaseApplication;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\ConsoleOutputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
use Symfony\Component\Console\Formatter\OutputFormatter;
|
||||
|
|
|
@ -82,7 +82,7 @@ class SolverProblemsException extends \RuntimeException
|
|||
private function hasExtensionProblems(array $reasonSets)
|
||||
{
|
||||
foreach ($reasonSets as $reasonSet) {
|
||||
foreach($reasonSet as $reason) {
|
||||
foreach ($reasonSet as $reason) {
|
||||
if (isset($reason["rule"]) && 0 === strpos($reason["rule"]->getRequiredPackage(), 'ext-')) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -41,8 +41,8 @@ use Seld\JsonLint\JsonParser;
|
|||
class Factory
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
* @throws \RuntimeException
|
||||
* @return string
|
||||
*/
|
||||
protected static function getHomeDir()
|
||||
{
|
||||
|
@ -115,7 +115,7 @@ class Factory
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $home
|
||||
* @param string $home
|
||||
* @return string
|
||||
*/
|
||||
protected static function getDataDir($home)
|
||||
|
@ -140,7 +140,7 @@ class Factory
|
|||
}
|
||||
|
||||
/**
|
||||
* @param IOInterface|null $io
|
||||
* @param IOInterface|null $io
|
||||
* @return Config
|
||||
*/
|
||||
public static function createConfig(IOInterface $io = null, $cwd = null)
|
||||
|
@ -569,9 +569,9 @@ class Factory
|
|||
}
|
||||
|
||||
/**
|
||||
* @param IOInterface $io IO instance
|
||||
* @param Config $config Config instance
|
||||
* @param array $options Array of options passed directly to RemoteFilesystem constructor
|
||||
* @param IOInterface $io IO instance
|
||||
* @param Config $config Config instance
|
||||
* @param array $options Array of options passed directly to RemoteFilesystem constructor
|
||||
* @return RemoteFilesystem
|
||||
*/
|
||||
public static function createRemoteFilesystem(IOInterface $io, Config $config = null, $options = array())
|
||||
|
@ -616,7 +616,7 @@ class Factory
|
|||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
private static function useXdg()
|
||||
{
|
||||
|
@ -630,8 +630,8 @@ class Factory
|
|||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws \RuntimeException
|
||||
* @return string
|
||||
*/
|
||||
private static function getUserDir()
|
||||
{
|
||||
|
|
|
@ -165,7 +165,7 @@ class AliasPackage extends BasePackage implements CompletePackageInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @param Link[] $links
|
||||
* @param Link[] $links
|
||||
* @param string $linkType
|
||||
*
|
||||
* @return Link[]
|
||||
|
|
|
@ -127,6 +127,7 @@ class PluginManager
|
|||
$this->io->writeError('<warning>The "' . $package->getName() . '" plugin requires composer-plugin-api 1.0.0, this *WILL* break in the future and it should be fixed ASAP (require ^1.0 for example).</warning>');
|
||||
} elseif (!$requiresComposer->matches($currentPluginApiConstraint)) {
|
||||
$this->io->writeError('<warning>The "' . $package->getName() . '" plugin was skipped because it requires a Plugin API version ("' . $requiresComposer->getPrettyString() . '") that does not match your Composer installation ("' . $currentPluginApiVersion . '"). You may need to run composer update with the "--no-plugins" option.</warning>');
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -304,10 +305,10 @@ class PluginManager
|
|||
}
|
||||
|
||||
/**
|
||||
* @param PluginInterface $plugin
|
||||
* @param string $capability
|
||||
* @return null|string The fully qualified class of the implementation or null if Plugin is not of Capable type or does not provide it
|
||||
* @param PluginInterface $plugin
|
||||
* @param string $capability
|
||||
* @throws \RuntimeException On empty or non-string implementation class name value
|
||||
* @return null|string The fully qualified class of the implementation or null if Plugin is not of Capable type or does not provide it
|
||||
*/
|
||||
protected function getCapabilityImplementationClassName(PluginInterface $plugin, $capability)
|
||||
{
|
||||
|
@ -330,11 +331,11 @@ class PluginManager
|
|||
}
|
||||
|
||||
/**
|
||||
* @param PluginInterface $plugin
|
||||
* @param string $capabilityClassName The fully qualified name of the API interface which the plugin may provide
|
||||
* an implementation of.
|
||||
* @param array $ctorArgs Arguments passed to Capability's constructor.
|
||||
* Keeping it an array will allow future values to be passed w\o changing the signature.
|
||||
* @param PluginInterface $plugin
|
||||
* @param string $capabilityClassName The fully qualified name of the API interface which the plugin may provide
|
||||
* an implementation of.
|
||||
* @param array $ctorArgs Arguments passed to Capability's constructor.
|
||||
* Keeping it an array will allow future values to be passed w\o changing the signature.
|
||||
* @return null|Capability
|
||||
*/
|
||||
public function getPluginCapability(PluginInterface $plugin, $capabilityClassName, array $ctorArgs = array())
|
||||
|
|
|
@ -747,6 +747,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
|||
$this->io->writeError('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
|
||||
}
|
||||
$this->degradedMode = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ class PathRepository extends ArrayRepository implements ConfigurableRepositoryIn
|
|||
private function getUrlMatches()
|
||||
{
|
||||
// Ensure environment-specific path separators are normalized to URL separators
|
||||
return array_map(function($val) {
|
||||
return array_map(function ($val) {
|
||||
return str_replace(DIRECTORY_SEPARATOR, '/', $val);
|
||||
}, glob($this->url, GLOB_MARK | GLOB_ONLYDIR));
|
||||
}
|
||||
|
|
|
@ -203,6 +203,7 @@ class PlatformRepository extends ArrayRepository
|
|||
if (isset($this->overrides[strtolower($package->getName())])) {
|
||||
$overrider = $this->findPackage($package->getName(), '*');
|
||||
$overrider->setDescription($overrider->getDescription().' (actual: '.$package->getPrettyVersion().')');
|
||||
|
||||
return;
|
||||
}
|
||||
parent::addPackage($package);
|
||||
|
|
|
@ -105,7 +105,6 @@ class RepositoryManager
|
|||
|
||||
$class = $this->repositoryClasses[$type];
|
||||
|
||||
|
||||
$reflMethod = new \ReflectionMethod($class, '__construct');
|
||||
$params = $reflMethod->getParameters();
|
||||
if (isset($params[4]) && $params[4]->getClass() && $params[4]->getClass()->getName() === 'Composer\Util\RemoteFilesystem') {
|
||||
|
|
|
@ -19,7 +19,6 @@ use Composer\Json\JsonValidationException;
|
|||
use Composer\IO\IOInterface;
|
||||
use Composer\Json\JsonFile;
|
||||
use Composer\Spdx\SpdxLicenses;
|
||||
use Composer\Factory;
|
||||
|
||||
/**
|
||||
* Validates a composer configuration.
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
|
||||
namespace Composer\Util;
|
||||
|
||||
use Composer\Config;
|
||||
|
||||
/**
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
*/
|
||||
|
@ -23,7 +21,7 @@ class Keys
|
|||
{
|
||||
$hash = strtoupper(hash('sha256', preg_replace('{\s}', '', file_get_contents($path))));
|
||||
|
||||
return implode(' ', [
|
||||
return implode(' ', array(
|
||||
substr($hash, 0, 8),
|
||||
substr($hash, 8, 8),
|
||||
substr($hash, 16, 8),
|
||||
|
@ -33,6 +31,6 @@ class Keys
|
|||
substr($hash, 40, 8),
|
||||
substr($hash, 48, 8),
|
||||
substr($hash, 56, 8),
|
||||
]);
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,8 +134,8 @@ class RemoteFilesystem
|
|||
}
|
||||
|
||||
/**
|
||||
* @param array $headers array of returned headers like from getLastHeaders()
|
||||
* @param string $name header name (case insensitive)
|
||||
* @param array $headers array of returned headers like from getLastHeaders()
|
||||
* @param string $name header name (case insensitive)
|
||||
* @return string|null
|
||||
*/
|
||||
public function findHeaderValue(array $headers, $name)
|
||||
|
@ -155,7 +155,7 @@ class RemoteFilesystem
|
|||
}
|
||||
|
||||
/**
|
||||
* @param array $headers array of returned headers like from getLastHeaders()
|
||||
* @param array $headers array of returned headers like from getLastHeaders()
|
||||
* @return int|null
|
||||
*/
|
||||
public function findStatusCode(array $headers)
|
||||
|
@ -752,7 +752,7 @@ class RemoteFilesystem
|
|||
'!DES',
|
||||
'!3DES',
|
||||
'!MD5',
|
||||
'!PSK'
|
||||
'!PSK',
|
||||
));
|
||||
|
||||
/**
|
||||
|
@ -768,7 +768,7 @@ class RemoteFilesystem
|
|||
'verify_depth' => 7,
|
||||
'SNI_enabled' => true,
|
||||
'capture_peer_cert' => true,
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
if (isset($options['ssl'])) {
|
||||
|
@ -969,7 +969,7 @@ class RemoteFilesystem
|
|||
'ssl' => array(
|
||||
'capture_peer_cert' => true,
|
||||
'verify_peer' => false, // Yes this is fucking insane! But PHP is lame.
|
||||
))
|
||||
), ),
|
||||
));
|
||||
|
||||
// Ideally this would just use stream_socket_client() to avoid sending a
|
||||
|
|
|
@ -26,16 +26,18 @@ class Silencer
|
|||
/**
|
||||
* Suppresses given mask or errors.
|
||||
*
|
||||
* @param int|null $mask Error levels to suppress, default value NULL indicates all warnings and below.
|
||||
* @return int The old error reporting level.
|
||||
* @param int|null $mask Error levels to suppress, default value NULL indicates all warnings and below.
|
||||
* @return int The old error reporting level.
|
||||
*/
|
||||
public static function suppress($mask = null)
|
||||
{
|
||||
if (!isset($mask)) {
|
||||
$mask = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT;
|
||||
}
|
||||
array_push(self::$stack, $old = error_reporting());
|
||||
$old = error_reporting();
|
||||
array_push(self::$stack, $old);
|
||||
error_reporting($old & ~$mask);
|
||||
|
||||
return $old;
|
||||
}
|
||||
|
||||
|
@ -44,8 +46,9 @@ class Silencer
|
|||
*/
|
||||
public static function restore()
|
||||
{
|
||||
if (!empty(self::$stack))
|
||||
if (!empty(self::$stack)) {
|
||||
error_reporting(array_pop(self::$stack));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,9 +56,9 @@ class Silencer
|
|||
*
|
||||
* Future improvement: when PHP requirements are raised add Callable type hint (5.4) and variadic parameters (5.6)
|
||||
*
|
||||
* @param callable $callable Function to execute.
|
||||
* @return mixed Return value of the callback.
|
||||
* @param callable $callable Function to execute.
|
||||
* @throws \Exception Any exceptions from the callback are rethrown.
|
||||
* @return mixed Return value of the callback.
|
||||
*/
|
||||
public static function call($callable /*, ...$parameters */)
|
||||
{
|
||||
|
@ -63,11 +66,12 @@ class Silencer
|
|||
self::suppress();
|
||||
$result = call_user_func_array($callable, array_slice(func_get_args(), 1));
|
||||
self::restore();
|
||||
|
||||
return $result;
|
||||
} catch(\Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
// Use a finally block for this when requirements are raised to PHP 5.5
|
||||
self::restore();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,9 +24,9 @@ final class TlsHelper
|
|||
/**
|
||||
* Match hostname against a certificate.
|
||||
*
|
||||
* @param mixed $certificate X.509 certificate
|
||||
* @param string $hostname Hostname in the URL
|
||||
* @param string $cn Set to the common name of the certificate iff match found
|
||||
* @param mixed $certificate X.509 certificate
|
||||
* @param string $hostname Hostname in the URL
|
||||
* @param string $cn Set to the common name of the certificate iff match found
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -46,6 +46,7 @@ final class TlsHelper
|
|||
|
||||
if ($matcher && $matcher($hostname)) {
|
||||
$cn = $names['cn'];
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +54,6 @@ final class TlsHelper
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Extract DNS names out of an X.509 certificate.
|
||||
*
|
||||
|
|
|
@ -62,9 +62,9 @@ class JsonConfigSourceTest extends TestCase
|
|||
'url' => 'https://example.tld',
|
||||
'options' => array(
|
||||
'ssl' => array(
|
||||
'local_cert' => '/home/composer/.ssl/composer.pem'
|
||||
)
|
||||
)
|
||||
'local_cert' => '/home/composer/.ssl/composer.pem',
|
||||
),
|
||||
),
|
||||
));
|
||||
|
||||
$this->assertFileEquals($this->fixturePath('config/config-with-exampletld-repository-and-options.json'), $config);
|
||||
|
|
|
@ -24,5 +24,4 @@ class DefaultConfigTest extends \PHPUnit_Framework_TestCase
|
|||
$config = new Config;
|
||||
$this->assertFalse($config->get('disable-tls'));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ use Composer\Util\Filesystem;
|
|||
|
||||
class ZipDownloaderTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
|
|
@ -315,7 +315,7 @@ class PluginInstallerTest extends TestCase
|
|||
|
||||
$plugin->expects($this->once())
|
||||
->method('getCapabilities')
|
||||
->will($this->returnCallback(function() use ($capabilityImplementation, $capabilityApi) {
|
||||
->will($this->returnCallback(function () use ($capabilityImplementation, $capabilityApi) {
|
||||
return array($capabilityApi => $capabilityImplementation);
|
||||
}));
|
||||
|
||||
|
@ -361,7 +361,7 @@ class PluginInstallerTest extends TestCase
|
|||
|
||||
$plugin->expects($this->once())
|
||||
->method('getCapabilities')
|
||||
->will($this->returnCallback(function() use ($invalidImplementationClassNames, $capabilityApi) {
|
||||
->will($this->returnCallback(function () use ($invalidImplementationClassNames, $capabilityApi) {
|
||||
return array($capabilityApi => $invalidImplementationClassNames);
|
||||
}));
|
||||
|
||||
|
@ -377,7 +377,7 @@ class PluginInstallerTest extends TestCase
|
|||
|
||||
$plugin->expects($this->once())
|
||||
->method('getCapabilities')
|
||||
->will($this->returnCallback(function() {
|
||||
->will($this->returnCallback(function () {
|
||||
return array();
|
||||
}));
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class GitLabDriverTest extends TestCase
|
|||
$this->config->merge(array(
|
||||
'config' => array(
|
||||
'home' => $this->home,
|
||||
'gitlab-domains' => array('mycompany.com/gitlab', 'gitlab.com')
|
||||
'gitlab-domains' => array('mycompany.com/gitlab', 'gitlab.com'),
|
||||
),
|
||||
));
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ class RemoteFilesystemTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$io = $this->getMock('Composer\IO\IOInterface');
|
||||
|
||||
$res = $this->callGetOptionsForUrl($io, array('example.org', array('ssl'=>array('cafile'=>'/some/path/file.crt'))), array(), 'http://www.example.org');
|
||||
$res = $this->callGetOptionsForUrl($io, array('example.org', array('ssl' => array('cafile' => '/some/path/file.crt'))), array(), 'http://www.example.org');
|
||||
|
||||
$this->assertTrue(isset($res['ssl']['ciphers']));
|
||||
$this->assertRegExp("|!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK|", $res['ssl']['ciphers']);
|
||||
|
|
|
@ -33,8 +33,9 @@ class SilencerTest extends \PHPUnit_Framework_TestCase
|
|||
Silencer::restore();
|
||||
|
||||
// Check all parameters and return values are passed correctly in a silenced call.
|
||||
$result = Silencer::call(function($a, $b, $c) {
|
||||
$result = Silencer::call(function ($a, $b, $c) {
|
||||
@trigger_error('Test', E_USER_WARNING);
|
||||
|
||||
return $a * $b * $c;
|
||||
}, 2, 3, 4);
|
||||
$this->assertEquals(24, $result);
|
||||
|
@ -50,7 +51,7 @@ class SilencerTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$verification = microtime();
|
||||
$this->setExpectedException('\RuntimeException', $verification);
|
||||
Silencer::call(function() use ($verification) {
|
||||
Silencer::call(function () use ($verification) {
|
||||
throw new \RuntimeException($verification);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue