1
0
Fork 0

Run cs fixer and update config to latest master

pull/5202/merge
Jordi Boggiano 2016-04-11 15:06:57 +01:00
parent b9ce06f46b
commit 3b0a1c6f70
25 changed files with 76 additions and 69 deletions

View File

@ -10,7 +10,7 @@ For the full copyright and license information, please view the LICENSE
file that was distributed with this source code. file that was distributed with this source code.
EOF; EOF;
$finder = Symfony\CS\Finder::create() $finder = PhpCsFixer\Finder::create()
->files() ->files()
->name('*.php') ->name('*.php')
->exclude('Fixtures') ->exclude('Fixtures')
@ -18,7 +18,7 @@ $finder = Symfony\CS\Finder::create()
->in(__DIR__.'/tests') ->in(__DIR__.'/tests')
; ;
return Symfony\CS\Config::create() return PhpCsFixer\Config::create()
->setUsingCache(true) ->setUsingCache(true)
//->setUsingLinter(false) //->setUsingLinter(false)
->setRiskyAllowed(true) ->setRiskyAllowed(true)
@ -26,6 +26,7 @@ return Symfony\CS\Config::create()
'@PSR2' => true, '@PSR2' => true,
'binary_operator_spaces' => true, 'binary_operator_spaces' => true,
'blank_line_before_return' => true, 'blank_line_before_return' => true,
'cast_spaces' => true,
'header_comment' => array('header' => $header), 'header_comment' => array('header' => $header),
'include' => true, 'include' => true,
'long_array_syntax' => true, 'long_array_syntax' => true,
@ -39,6 +40,7 @@ return Symfony\CS\Config::create()
'no_leading_namespace_whitespace' => true, 'no_leading_namespace_whitespace' => true,
'no_trailing_comma_in_singleline_array' => true, 'no_trailing_comma_in_singleline_array' => true,
'no_unused_imports' => true, 'no_unused_imports' => true,
'no_whitespace_in_blank_lines' => true,
'object_operator_without_whitespace' => true, 'object_operator_without_whitespace' => true,
'phpdoc_align' => true, 'phpdoc_align' => true,
'phpdoc_indent' => true, 'phpdoc_indent' => true,
@ -50,11 +52,9 @@ return Symfony\CS\Config::create()
'phpdoc_type_to_var' => true, 'phpdoc_type_to_var' => true,
'psr0' => true, 'psr0' => true,
'single_blank_line_before_namespace' => true, 'single_blank_line_before_namespace' => true,
'spaces_cast' => true,
'standardize_not_equals' => true, 'standardize_not_equals' => true,
'ternary_operator_spaces' => true, 'ternary_operator_spaces' => true,
'trailing_comma_in_multiline_array' => true, 'trailing_comma_in_multiline_array' => true,
'whitespacy_lines' => true,
)) ))
->finder($finder) ->finder($finder)
; ;

View File

@ -112,9 +112,9 @@ EOT
/** /**
* Find package requires and child requires * Find package requires and child requires
* *
* @param RepositoryInterface $repo * @param RepositoryInterface $repo
* @param PackageInterface $package * @param PackageInterface $package
* @param array $bucket * @param array $bucket
* @return array * @return array
*/ */
private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array()) private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array())

View File

@ -117,7 +117,7 @@ EOT
->setClassMapAuthoritative($authoritative) ->setClassMapAuthoritative($authoritative)
->setUpdate(true) ->setUpdate(true)
->setUpdateWhitelist($packages) ->setUpdateWhitelist($packages)
->setWhitelistDependencies( ! $input->getOption('no-update-with-dependencies')) ->setWhitelistDependencies(!$input->getOption('no-update-with-dependencies'))
->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs')) ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
; ;

View File

@ -302,11 +302,11 @@ TAGSPUBKEY
} }
/** /**
* @param string $localFilename * @param string $localFilename
* @param string $newFilename * @param string $newFilename
* @param string $backupTarget * @param string $backupTarget
* @return \UnexpectedValueException|\PharException|null
* @throws \Exception * @throws \Exception
* @return \UnexpectedValueException|\PharException|null
*/ */
protected function setLocalPhar($localFilename, $newFilename, $backupTarget = null) protected function setLocalPhar($localFilename, $newFilename, $backupTarget = null)
{ {
@ -325,6 +325,7 @@ TAGSPUBKEY
} }
rename($newFilename, $localFilename); rename($newFilename, $localFilename);
return null; return null;
} catch (\Exception $e) { } catch (\Exception $e) {
if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) { if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {

View File

@ -80,8 +80,8 @@ class Config
private $useEnvironment; private $useEnvironment;
/** /**
* @param bool $useEnvironment Use COMPOSER_ environment variables to replace config settings * @param bool $useEnvironment Use COMPOSER_ environment variables to replace config settings
* @param string $baseDir Optional base directory of the config * @param string $baseDir Optional base directory of the config
*/ */
public function __construct($useEnvironment = true, $baseDir = null) public function __construct($useEnvironment = true, $baseDir = null)
{ {

View File

@ -46,8 +46,8 @@ class Request
* *
* These jobs will not be tempered with by the solver * These jobs will not be tempered with by the solver
* *
* @param string $packageName * @param string $packageName
* @param ConstraintInterface|null $constraint * @param ConstraintInterface|null $constraint
*/ */
public function fix($packageName, ConstraintInterface $constraint = null) public function fix($packageName, ConstraintInterface $constraint = null)
{ {

View File

@ -80,11 +80,11 @@ class PathDownloader extends FileDownloader
$this->io->writeError(sprintf(' Junctioned from %s', $url)); $this->io->writeError(sprintf(' Junctioned from %s', $url));
} else { } else {
$absolutePath = $path; $absolutePath = $path;
if ( ! $this->filesystem->isAbsolutePath($absolutePath)) { if (!$this->filesystem->isAbsolutePath($absolutePath)) {
$absolutePath = getcwd() . DIRECTORY_SEPARATOR . $path; $absolutePath = getcwd() . DIRECTORY_SEPARATOR . $path;
} }
$shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl); $shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl);
$path = rtrim($path,"/"); $path = rtrim($path, "/");
$fileSystem->symlink($shortestPath, $path); $fileSystem->symlink($shortestPath, $path);
$this->io->writeError(sprintf(' Symlinked from %s', $url)); $this->io->writeError(sprintf(' Symlinked from %s', $url));
} }

View File

@ -136,10 +136,10 @@ class EventDispatcher
/** /**
* Triggers the listeners of an event. * Triggers the listeners of an event.
* *
* @param Event $event The event object to pass to the event handlers/listeners. * @param Event $event The event object to pass to the event handlers/listeners.
* @return int return code of the executed script if any, for php scripts a false return
* value is changed to 1, anything else to 0
* @throws \RuntimeException|\Exception * @throws \RuntimeException|\Exception
* @return int return code of the executed script if any, for php scripts a false return
* value is changed to 1, anything else to 0
*/ */
protected function doDispatch(Event $event) protected function doDispatch(Event $event)
{ {

View File

@ -1488,7 +1488,7 @@ class Installer
} }
/** /**
* @param SuggestedPackagesReporter $suggestedPackagesReporter * @param SuggestedPackagesReporter $suggestedPackagesReporter
* @return Installer * @return Installer
*/ */
public function setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter) public function setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter)

View File

@ -35,9 +35,9 @@ class BinaryInstaller
/** /**
* @param IOInterface $io * @param IOInterface $io
* @param string $binDir * @param string $binDir
* @param string $binCompat * @param string $binCompat
* @param Filesystem $filesystem * @param Filesystem $filesystem
*/ */
public function __construct(IOInterface $io, $binDir, $binCompat, Filesystem $filesystem = null) public function __construct(IOInterface $io, $binDir, $binCompat, Filesystem $filesystem = null)
{ {

View File

@ -40,11 +40,11 @@ class LibraryInstaller implements InstallerInterface
/** /**
* Initializes library installer. * Initializes library installer.
* *
* @param IOInterface $io * @param IOInterface $io
* @param Composer $composer * @param Composer $composer
* @param string $type * @param string $type
* @param Filesystem $filesystem * @param Filesystem $filesystem
* @param BinaryInstaller $binaryInstaller * @param BinaryInstaller $binaryInstaller
*/ */
public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null, BinaryInstaller $binaryInstaller = null) public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null, BinaryInstaller $binaryInstaller = null)
{ {

View File

@ -61,7 +61,7 @@ class PluginInstaller extends LibraryInstaller
parent::install($repo, $package); parent::install($repo, $package);
try { try {
$this->composer->getPluginManager()->registerPackage($package, true); $this->composer->getPluginManager()->registerPackage($package, true);
} catch(\Exception $e) { } catch (\Exception $e) {
// Rollback installation // Rollback installation
$this->io->writeError('Plugin installation failed, rolling back'); $this->io->writeError('Plugin installation failed, rolling back');
parent::uninstall($repo, $package); parent::uninstall($repo, $package);

View File

@ -52,9 +52,9 @@ class SuggestedPackagesReporter
* Could be used to add suggested packages both from the installer * Could be used to add suggested packages both from the installer
* or from CreateProjectCommand. * or from CreateProjectCommand.
* *
* @param string $source Source package which made the suggestion * @param string $source Source package which made the suggestion
* @param string $target Target package to be suggested * @param string $target Target package to be suggested
* @param string $reason Reason the target package to be suggested * @param string $reason Reason the target package to be suggested
* @return SuggestedPackagesReporter * @return SuggestedPackagesReporter
*/ */
public function addPackage($source, $target, $reason) public function addPackage($source, $target, $reason)
@ -71,7 +71,7 @@ class SuggestedPackagesReporter
/** /**
* Add all suggestions from a package. * Add all suggestions from a package.
* *
* @param PackageInterface $package * @param PackageInterface $package
* @return SuggestedPackagesReporter * @return SuggestedPackagesReporter
*/ */
public function addSuggestionsFromPackage(PackageInterface $package) public function addSuggestionsFromPackage(PackageInterface $package)
@ -92,7 +92,7 @@ class SuggestedPackagesReporter
* Output suggested packages. * Output suggested packages.
* Do not list the ones already installed if installed repository provided. * Do not list the ones already installed if installed repository provided.
* *
* @param RepositoryInterface $installedRepo Installed packages * @param RepositoryInterface $installedRepo Installed packages
* @return SuggestedPackagesReporter * @return SuggestedPackagesReporter
*/ */
public function output(RepositoryInterface $installedRepo = null) public function output(RepositoryInterface $installedRepo = null)

View File

@ -104,8 +104,8 @@ class JsonFile
/** /**
* Writes json file. * Writes json file.
* *
* @param array $hash writes hash into json file * @param array $hash writes hash into json file
* @param int $options json_encode options (defaults to JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) * @param int $options json_encode options (defaults to JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)
* @throws \UnexpectedValueException|\Exception * @throws \UnexpectedValueException|\Exception
*/ */
public function write(array $hash, $options = 448) public function write(array $hash, $options = 448)

View File

@ -94,6 +94,7 @@ class ArchivableFilesFinder extends \FilterIterator
} }
$iterator = new FilesystemIterator($current, FilesystemIterator::SKIP_DOTS); $iterator = new FilesystemIterator($current, FilesystemIterator::SKIP_DOTS);
return !$iterator->valid(); return !$iterator->valid();
} }
} }

View File

@ -72,6 +72,7 @@ class GitExcludeFilter extends BaseExcludeFilter
if (count($parts) == 2 && $parts[1] === 'export-ignore') { if (count($parts) == 2 && $parts[1] === 'export-ignore') {
return $this->generatePattern($parts[0]); return $this->generatePattern($parts[0]);
} }
return null; return null;
} }
} }

View File

@ -56,9 +56,9 @@ class RootPackageLoader extends ArrayLoader
} }
/** /**
* @param array $config package data * @param array $config package data
* @param string $class FQCN to be instantiated * @param string $class FQCN to be instantiated
* @param string $cwd cwd of the root package to be used to guess the version if it is not provided * @param string $cwd cwd of the root package to be used to guess the version if it is not provided
* @return RootPackageInterface * @return RootPackageInterface
*/ */
public function load(array $config, $class = 'Composer\Package\RootPackage', $cwd = null) public function load(array $config, $class = 'Composer\Package\RootPackage', $cwd = null)

View File

@ -56,6 +56,7 @@ class ArrayRepository extends BaseRepository
} }
} }
} }
return null; return null;
} }

View File

@ -269,9 +269,9 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
} }
/** /**
* @param Pool $pool * @param Pool $pool
* @param string $name package name * @param string $name package name
* @param bool $bypassFilters If set to true, this bypasses the stability filtering, and forces a recompute without cache * @param bool $bypassFilters If set to true, this bypasses the stability filtering, and forces a recompute without cache
* @return array|mixed * @return array|mixed
*/ */
public function whatProvides(Pool $pool, $name, $bypassFilters = false) public function whatProvides(Pool $pool, $name, $bypassFilters = false)

View File

@ -25,10 +25,10 @@ use Composer\Json\JsonFile;
class RepositoryFactory class RepositoryFactory
{ {
/** /**
* @param IOInterface $io * @param IOInterface $io
* @param Config $config * @param Config $config
* @param string $repository * @param string $repository
* @param bool $allowFilesystem * @param bool $allowFilesystem
* @return array|mixed * @return array|mixed
*/ */
public static function configFromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false) public static function configFromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
@ -56,10 +56,10 @@ class RepositoryFactory
} }
/** /**
* @param IOInterface $io * @param IOInterface $io
* @param Config $config * @param Config $config
* @param string $repository * @param string $repository
* @param bool $allowFilesystem * @param bool $allowFilesystem
* @return RepositoryInterface * @return RepositoryInterface
*/ */
public static function fromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false) public static function fromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
@ -70,9 +70,9 @@ class RepositoryFactory
} }
/** /**
* @param IOInterface $io * @param IOInterface $io
* @param Config $config * @param Config $config
* @param array $repoConfig * @param array $repoConfig
* @return RepositoryInterface * @return RepositoryInterface
*/ */
public static function createRepo(IOInterface $io, Config $config, array $repoConfig) public static function createRepo(IOInterface $io, Config $config, array $repoConfig)
@ -84,9 +84,9 @@ class RepositoryFactory
} }
/** /**
* @param IOInterface|null $io * @param IOInterface|null $io
* @param Config|null $config * @param Config|null $config
* @param RepositoryManager|null $rm * @param RepositoryManager|null $rm
* @return RepositoryInterface[] * @return RepositoryInterface[]
*/ */
public static function defaultRepos(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null) public static function defaultRepos(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)

View File

@ -58,6 +58,7 @@ class RepositoryManager
return $package; return $package;
} }
} }
return null; return null;
} }

View File

@ -75,7 +75,7 @@ class Bitbucket
} }
/** /**
* @param string $originUrl * @param string $originUrl
* @return bool * @return bool
*/ */
private function requestAccessToken($originUrl) private function requestAccessToken($originUrl)
@ -88,7 +88,7 @@ class Bitbucket
'http' => array( 'http' => array(
'method' => 'POST', 'method' => 'POST',
'content' => 'grant_type=client_credentials', 'content' => 'grant_type=client_credentials',
) ),
)); ));
$this->token = json_decode($json, true); $this->token = json_decode($json, true);
@ -150,7 +150,7 @@ class Bitbucket
$consumer = array( $consumer = array(
"consumer-key" => $consumerKey, "consumer-key" => $consumerKey,
"consumer-secret" => $consumerSecret "consumer-secret" => $consumerSecret,
); );
$this->config->getAuthConfigSource()->addConfigSetting('bitbucket-oauth.'.$originUrl, $consumer); $this->config->getAuthConfigSource()->addConfigSetting('bitbucket-oauth.'.$originUrl, $consumer);
@ -162,9 +162,9 @@ class Bitbucket
/** /**
* Retrieves an access token from Bitbucket. * Retrieves an access token from Bitbucket.
* *
* @param string $originUrl * @param string $originUrl
* @param string $consumerKey * @param string $consumerKey
* @param string $consumerSecret * @param string $consumerSecret
* @return array * @return array
*/ */
public function requestToken($originUrl, $consumerKey, $consumerSecret) public function requestToken($originUrl, $consumerKey, $consumerSecret)

View File

@ -127,7 +127,7 @@ class Git
$auth = $this->io->getAuthentication($match[1]); $auth = $this->io->getAuthentication($match[1]);
//We already have an access_token from a previous request. //We already have an access_token from a previous request.
if($auth['username'] !== 'x-token-auth') { if ($auth['username'] !== 'x-token-auth') {
$token = $bitbucketUtil->requestToken($match[1], $auth['username'], $auth['password']); $token = $bitbucketUtil->requestToken($match[1], $auth['username'], $auth['password']);
$this->io->setAuthentication($match[1], 'x-token-auth', $token['access_token']); $this->io->setAuthentication($match[1], 'x-token-auth', $token['access_token']);
} }

View File

@ -82,6 +82,7 @@ final class TlsHelper
if (0 === strpos($name, 'DNS:')) { if (0 === strpos($name, 'DNS:')) {
return strtolower(ltrim(substr($name, 4))); return strtolower(ltrim(substr($name, 4)));
} }
return null; return null;
}, $subjectAltNames)); }, $subjectAltNames));
$subjectAltNames = array_values($subjectAltNames); $subjectAltNames = array_values($subjectAltNames);

View File

@ -13,7 +13,6 @@
namespace Composer\Test; namespace Composer\Test;
use Composer\Config; use Composer\Config;
use Composer\Downloader\TransportException;
class ConfigTest extends \PHPUnit_Framework_TestCase class ConfigTest extends \PHPUnit_Framework_TestCase
{ {
@ -252,7 +251,8 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
'file://myserver.localhost/mygit.git', 'file://myserver.localhost/mygit.git',
'file://example.org/mygit.git', 'file://example.org/mygit.git',
); );
return array_combine($urls, array_map(function($e) { return array($e); }, $urls));
return array_combine($urls, array_map(function ($e) { return array($e); }, $urls));
} }
/** /**
@ -270,9 +270,10 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
'svn://1.2.3.4/trunk', 'svn://1.2.3.4/trunk',
'git://5.6.7.8/git.git', 'git://5.6.7.8/git.git',
); );
return array_combine($urls, array_map(function($e) { return array($e); }, $urls));
return array_combine($urls, array_map(function ($e) { return array($e); }, $urls));
} }
/** /**
* @group TLS * @group TLS
*/ */