From 1818b95149c81ea5bcc47eda4944c01acc3f1480 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 26 Jan 2016 13:07:05 +0000 Subject: [PATCH] CS fixes --- src/Composer/Command/ConfigCommand.php | 4 +-- src/Composer/Command/CreateProjectCommand.php | 1 - src/Composer/Command/DependsCommand.php | 2 +- src/Composer/Command/SelfUpdateCommand.php | 2 +- src/Composer/Command/ShowCommand.php | 26 +++++++++---------- src/Composer/Console/Application.php | 1 - .../SolverProblemsException.php | 2 +- src/Composer/Factory.php | 16 ++++++------ src/Composer/Package/AliasPackage.php | 2 +- src/Composer/Plugin/PluginManager.php | 17 ++++++------ .../Repository/ComposerRepository.php | 1 + src/Composer/Repository/PathRepository.php | 2 +- .../Repository/PlatformRepository.php | 1 + src/Composer/Repository/RepositoryManager.php | 1 - src/Composer/Util/ConfigValidator.php | 1 - src/Composer/Util/Keys.php | 6 ++--- src/Composer/Util/RemoteFilesystem.php | 12 ++++----- src/Composer/Util/Silencer.php | 20 ++++++++------ src/Composer/Util/TlsHelper.php | 8 +++--- .../Test/Config/JsonConfigSourceTest.php | 6 ++--- tests/Composer/Test/DefaultConfigTest.php | 3 +-- .../Test/Downloader/ZipDownloaderTest.php | 1 - .../Test/Plugin/PluginInstallerTest.php | 6 ++--- .../Test/Repository/Vcs/GitLabDriverTest.php | 2 +- .../Test/Util/RemoteFilesystemTest.php | 2 +- tests/Composer/Test/Util/SilencerTest.php | 5 ++-- 26 files changed, 75 insertions(+), 75 deletions(-) diff --git a/src/Composer/Command/ConfigCommand.php b/src/Composer/Command/ConfigCommand.php index 87fdc4ffb..94fccc2e5 100644 --- a/src/Composer/Command/ConfigCommand.php +++ b/src/Composer/Command/ConfigCommand.php @@ -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), ); diff --git a/src/Composer/Command/CreateProjectCommand.php b/src/Composer/Command/CreateProjectCommand.php index dbb7f6802..4ddc2cfa7 100644 --- a/src/Composer/Command/CreateProjectCommand.php +++ b/src/Composer/Command/CreateProjectCommand.php @@ -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; /** diff --git a/src/Composer/Command/DependsCommand.php b/src/Composer/Command/DependsCommand.php index a58e7c5be..abdce5a86 100644 --- a/src/Composer/Command/DependsCommand.php +++ b/src/Composer/Command/DependsCommand.php @@ -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('There is no installed package depending on "'.$needle.'"'.$matchText.'.'); } diff --git a/src/Composer/Command/SelfUpdateCommand.php b/src/Composer/Command/SelfUpdateCommand.php index 7d868da06..fff159158 100644 --- a/src/Composer/Command/SelfUpdateCommand.php +++ b/src/Composer/Command/SelfUpdateCommand.php @@ -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"; }; diff --git a/src/Composer/Command/ShowCommand.php b/src/Composer/Command/ShowCommand.php index 7704e09fb..7f0c77537 100644 --- a/src/Composer/Command/ShowCommand.php +++ b/src/Composer/Command/ShowCommand.php @@ -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) { diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index 10ad2762b..632741586 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -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; diff --git a/src/Composer/DependencyResolver/SolverProblemsException.php b/src/Composer/DependencyResolver/SolverProblemsException.php index fcbb6a77b..a457c5c63 100644 --- a/src/Composer/DependencyResolver/SolverProblemsException.php +++ b/src/Composer/DependencyResolver/SolverProblemsException.php @@ -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; } diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php index eb6072709..e11677b56 100644 --- a/src/Composer/Factory.php +++ b/src/Composer/Factory.php @@ -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() { diff --git a/src/Composer/Package/AliasPackage.php b/src/Composer/Package/AliasPackage.php index f6849a234..e161a4482 100644 --- a/src/Composer/Package/AliasPackage.php +++ b/src/Composer/Package/AliasPackage.php @@ -165,7 +165,7 @@ class AliasPackage extends BasePackage implements CompletePackageInterface } /** - * @param Link[] $links + * @param Link[] $links * @param string $linkType * * @return Link[] diff --git a/src/Composer/Plugin/PluginManager.php b/src/Composer/Plugin/PluginManager.php index 49a783579..bfb0d9427 100644 --- a/src/Composer/Plugin/PluginManager.php +++ b/src/Composer/Plugin/PluginManager.php @@ -127,6 +127,7 @@ class PluginManager $this->io->writeError('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).'); } elseif (!$requiresComposer->matches($currentPluginApiConstraint)) { $this->io->writeError('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.'); + 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()) diff --git a/src/Composer/Repository/ComposerRepository.php b/src/Composer/Repository/ComposerRepository.php index 6806d1c8a..f3cf20e29 100644 --- a/src/Composer/Repository/ComposerRepository.php +++ b/src/Composer/Repository/ComposerRepository.php @@ -747,6 +747,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito $this->io->writeError(''.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date'); } $this->degradedMode = true; + return true; } } diff --git a/src/Composer/Repository/PathRepository.php b/src/Composer/Repository/PathRepository.php index 4529af0f0..c3266543b 100644 --- a/src/Composer/Repository/PathRepository.php +++ b/src/Composer/Repository/PathRepository.php @@ -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)); } diff --git a/src/Composer/Repository/PlatformRepository.php b/src/Composer/Repository/PlatformRepository.php index 084bc2af7..833c82c20 100644 --- a/src/Composer/Repository/PlatformRepository.php +++ b/src/Composer/Repository/PlatformRepository.php @@ -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); diff --git a/src/Composer/Repository/RepositoryManager.php b/src/Composer/Repository/RepositoryManager.php index 7f91ac6ff..42c14106f 100644 --- a/src/Composer/Repository/RepositoryManager.php +++ b/src/Composer/Repository/RepositoryManager.php @@ -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') { diff --git a/src/Composer/Util/ConfigValidator.php b/src/Composer/Util/ConfigValidator.php index cb5706c88..f36ff8e6f 100644 --- a/src/Composer/Util/ConfigValidator.php +++ b/src/Composer/Util/ConfigValidator.php @@ -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. diff --git a/src/Composer/Util/Keys.php b/src/Composer/Util/Keys.php index 19628f5d3..4afa204cd 100644 --- a/src/Composer/Util/Keys.php +++ b/src/Composer/Util/Keys.php @@ -12,8 +12,6 @@ namespace Composer\Util; -use Composer\Config; - /** * @author Jordi Boggiano */ @@ -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), - ]); + )); } } diff --git a/src/Composer/Util/RemoteFilesystem.php b/src/Composer/Util/RemoteFilesystem.php index 1a53c994f..bb351dcdd 100644 --- a/src/Composer/Util/RemoteFilesystem.php +++ b/src/Composer/Util/RemoteFilesystem.php @@ -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 diff --git a/src/Composer/Util/Silencer.php b/src/Composer/Util/Silencer.php index bc09d5efd..03cfff430 100644 --- a/src/Composer/Util/Silencer.php +++ b/src/Composer/Util/Silencer.php @@ -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; } } -} \ No newline at end of file +} diff --git a/src/Composer/Util/TlsHelper.php b/src/Composer/Util/TlsHelper.php index 4aea24df6..6ea5cf591 100644 --- a/src/Composer/Util/TlsHelper.php +++ b/src/Composer/Util/TlsHelper.php @@ -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. * diff --git a/tests/Composer/Test/Config/JsonConfigSourceTest.php b/tests/Composer/Test/Config/JsonConfigSourceTest.php index 5877f69fb..e558932c2 100644 --- a/tests/Composer/Test/Config/JsonConfigSourceTest.php +++ b/tests/Composer/Test/Config/JsonConfigSourceTest.php @@ -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); diff --git a/tests/Composer/Test/DefaultConfigTest.php b/tests/Composer/Test/DefaultConfigTest.php index 4cca5025a..74a74aecd 100644 --- a/tests/Composer/Test/DefaultConfigTest.php +++ b/tests/Composer/Test/DefaultConfigTest.php @@ -24,5 +24,4 @@ class DefaultConfigTest extends \PHPUnit_Framework_TestCase $config = new Config; $this->assertFalse($config->get('disable-tls')); } - -} \ No newline at end of file +} diff --git a/tests/Composer/Test/Downloader/ZipDownloaderTest.php b/tests/Composer/Test/Downloader/ZipDownloaderTest.php index a0507e730..f70d9e44c 100644 --- a/tests/Composer/Test/Downloader/ZipDownloaderTest.php +++ b/tests/Composer/Test/Downloader/ZipDownloaderTest.php @@ -18,7 +18,6 @@ use Composer\Util\Filesystem; class ZipDownloaderTest extends TestCase { - /** * @var string */ diff --git a/tests/Composer/Test/Plugin/PluginInstallerTest.php b/tests/Composer/Test/Plugin/PluginInstallerTest.php index 8d3a5e4dc..50c7178da 100644 --- a/tests/Composer/Test/Plugin/PluginInstallerTest.php +++ b/tests/Composer/Test/Plugin/PluginInstallerTest.php @@ -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(); })); diff --git a/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php b/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php index e1ac82021..70bb94843 100644 --- a/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php +++ b/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php @@ -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'), ), )); diff --git a/tests/Composer/Test/Util/RemoteFilesystemTest.php b/tests/Composer/Test/Util/RemoteFilesystemTest.php index 6647e6d5c..73861e396 100644 --- a/tests/Composer/Test/Util/RemoteFilesystemTest.php +++ b/tests/Composer/Test/Util/RemoteFilesystemTest.php @@ -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']); diff --git a/tests/Composer/Test/Util/SilencerTest.php b/tests/Composer/Test/Util/SilencerTest.php index 3bf913480..5201522f8 100644 --- a/tests/Composer/Test/Util/SilencerTest.php +++ b/tests/Composer/Test/Util/SilencerTest.php @@ -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); }); }