diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index e2eb6bf56..836acafe8 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -623,7 +623,7 @@ FOOTER; * * Packages of equal weight retain the original order * - * @param array $packageMap + * @param array $packageMap * @return array */ protected function sortPackageMap(array $packageMap) @@ -646,7 +646,7 @@ FOOTER; $computing = array(); $computed = array(); - $computeImportance = function($name) use(&$computeImportance, &$computing, &$computed, $usageList) { + $computeImportance = function ($name) use (&$computeImportance, &$computing, &$computed, $usageList) { // reusing computed importance if (isset($computed[$name])) { return $computed[$name]; @@ -679,17 +679,17 @@ FOOTER; $weightList[$name] = $weight; } - $stable_sort = function(&$array) { + $stable_sort = function (&$array) { static $transform, $restore; $i = 0; if (!$transform) { - $transform = function(&$v, $k) use(&$i) { + $transform = function (&$v, $k) use (&$i) { $v = array($v, ++$i, $k, $v); }; - $restore = function(&$v, $k) { + $restore = function (&$v, $k) { $v = $v[3]; }; } diff --git a/src/Composer/Autoload/ClassLoader.php b/src/Composer/Autoload/ClassLoader.php index a71055531..88684c526 100644 --- a/src/Composer/Autoload/ClassLoader.php +++ b/src/Composer/Autoload/ClassLoader.php @@ -202,10 +202,11 @@ class ClassLoader * Registers a set of PSR-4 directories for a given namespace, * replacing any others previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-4 base directories + * @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 { diff --git a/src/Composer/Autoload/ClassMapGenerator.php b/src/Composer/Autoload/ClassMapGenerator.php index 7b977cd3d..6cb306bfb 100644 --- a/src/Composer/Autoload/ClassMapGenerator.php +++ b/src/Composer/Autoload/ClassMapGenerator.php @@ -28,7 +28,7 @@ class ClassMapGenerator * Generate a class map file * * @param \Traversable $dirs Directories or a single path to search in - * @param string $file The name of the class map file + * @param string $file The name of the class map file */ public static function dump($dirs, $file) { diff --git a/src/Composer/Cache.php b/src/Composer/Cache.php index f8d64cae1..7387a94cc 100644 --- a/src/Composer/Cache.php +++ b/src/Composer/Cache.php @@ -144,8 +144,7 @@ class Cache public function gc($ttl, $maxSize) { - if ($this->enabled) - { + if ($this->enabled) { $expire = new \DateTime(); $expire->modify('-'.$ttl.' seconds'); diff --git a/src/Composer/Command/ArchiveCommand.php b/src/Composer/Command/ArchiveCommand.php index 7a57ca13b..d7e627b34 100644 --- a/src/Composer/Command/ArchiveCommand.php +++ b/src/Composer/Command/ArchiveCommand.php @@ -69,6 +69,7 @@ EOT if (0 === $returnCode) { $this->getComposer()->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ARCHIVE_CMD); } + return $returnCode; } diff --git a/src/Composer/Command/CreateProjectCommand.php b/src/Composer/Command/CreateProjectCommand.php index 8adc7e106..632e869df 100644 --- a/src/Composer/Command/CreateProjectCommand.php +++ b/src/Composer/Command/CreateProjectCommand.php @@ -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; @@ -339,10 +338,10 @@ EOT /** * Updated preferSource or preferDist based on the preferredInstall config option - * @param Config $config + * @param Config $config * @param InputInterface $input - * @param boolean $preferSource - * @param boolean $preferDist + * @param boolean $preferSource + * @param boolean $preferDist */ protected function updatePreferredOptions(Config $config, InputInterface $input, &$preferSource, &$preferDist) { diff --git a/src/Composer/Command/InstallCommand.php b/src/Composer/Command/InstallCommand.php index ac220fdf0..4f40837f1 100644 --- a/src/Composer/Command/InstallCommand.php +++ b/src/Composer/Command/InstallCommand.php @@ -64,6 +64,7 @@ EOT { if ($args = $input->getArgument('packages')) { $output->writeln('Invalid argument '.implode(' ', $args).'. Use "composer require '.implode(' ', $args).'" instead to add packages to your composer.json.'); + return 1; } diff --git a/src/Composer/Config.php b/src/Composer/Config.php index cfc042465..8d41f3fb1 100644 --- a/src/Composer/Config.php +++ b/src/Composer/Config.php @@ -269,7 +269,7 @@ class Config /** * Replaces {$refs} inside a config string * - * @param string $value a config string that can contain {$refs-to-other-config} + * @param string $value a config string that can contain {$refs-to-other-config} * @return string */ private function process($value) diff --git a/src/Composer/Config/JsonConfigSource.php b/src/Composer/Config/JsonConfigSource.php index 3057556e5..6ca613ea6 100644 --- a/src/Composer/Config/JsonConfigSource.php +++ b/src/Composer/Config/JsonConfigSource.php @@ -179,14 +179,15 @@ class JsonConfigSource implements ConfigSourceInterface /** * Prepend a reference to an element to the beginning of an array. * - * @param array $array - * @param mixed $value + * @param array $array + * @param mixed $value * @return array */ private function arrayUnshiftRef(&$array, &$value) { $return = array_unshift($array, ''); $array[0] =& $value; + return $return; } } diff --git a/src/Composer/DependencyResolver/Pool.php b/src/Composer/DependencyResolver/Pool.php index baac24457..636a78c0a 100644 --- a/src/Composer/DependencyResolver/Pool.php +++ b/src/Composer/DependencyResolver/Pool.php @@ -227,12 +227,12 @@ class Pool /** * Searches all packages providing the given package name and match the constraint * - * @param string $name The package name to be searched for - * @param LinkConstraintInterface $constraint A constraint that all returned - * packages must match or null to return all - * @param bool $mustMatchName Whether the name of returned packages - * must match the given name - * @return array A set of packages + * @param string $name The package name to be searched for + * @param LinkConstraintInterface $constraint A constraint that all returned + * packages must match or null to return all + * @param bool $mustMatchName Whether the name of returned packages + * must match the given name + * @return array A set of packages */ public function whatProvides($name, LinkConstraintInterface $constraint = null, $mustMatchName = false) { diff --git a/src/Composer/DependencyResolver/RuleSetGenerator.php b/src/Composer/DependencyResolver/RuleSetGenerator.php index 5e571c73b..5bcf9a079 100644 --- a/src/Composer/DependencyResolver/RuleSetGenerator.php +++ b/src/Composer/DependencyResolver/RuleSetGenerator.php @@ -40,13 +40,13 @@ class RuleSetGenerator * This rule is of the form (-A|B|C), where B and C are the providers of * one requirement of the package A. * - * @param PackageInterface $package The package with a requirement - * @param array $providers The providers of the requirement - * @param int $reason A RULE_* constant describing the - * reason for generating this rule - * @param mixed $reasonData Any data, e.g. the requirement name, - * that goes with the reason - * @return Rule The generated rule or null if tautological + * @param PackageInterface $package The package with a requirement + * @param array $providers The providers of the requirement + * @param int $reason A RULE_* constant describing the + * reason for generating this rule + * @param mixed $reasonData Any data, e.g. the requirement name, + * that goes with the reason + * @return Rule The generated rule or null if tautological */ protected function createRequireRule(PackageInterface $package, array $providers, $reason, $reasonData = null) { @@ -69,10 +69,10 @@ class RuleSetGenerator * The rule is (A|B|C) with A, B and C different packages. If the given * set of packages is empty an impossible rule is generated. * - * @param array $packages The set of packages to choose from - * @param int $reason A RULE_* constant describing the reason for - * generating this rule - * @param array $job The job this rule was created from + * @param array $packages The set of packages to choose from + * @param int $reason A RULE_* constant describing the reason for + * generating this rule + * @param array $job The job this rule was created from * @return Rule The generated rule */ protected function createInstallOneOfRule(array $packages, $reason, $job) @@ -90,11 +90,11 @@ class RuleSetGenerator * * The rule for a package A is (-A). * - * @param PackageInterface $package The package to be removed - * @param int $reason A RULE_* constant describing the - * reason for generating this rule - * @param array $job The job this rule was created from - * @return Rule The generated rule + * @param PackageInterface $package The package to be removed + * @param int $reason A RULE_* constant describing the + * reason for generating this rule + * @param array $job The job this rule was created from + * @return Rule The generated rule */ protected function createRemoveRule(PackageInterface $package, $reason, $job) { @@ -107,13 +107,13 @@ class RuleSetGenerator * The rule for conflicting packages A and B is (-A|-B). A is called the issuer * and B the provider. * - * @param PackageInterface $issuer The package declaring the conflict - * @param PackageInterface $provider The package causing the conflict - * @param int $reason A RULE_* constant describing the - * reason for generating this rule - * @param mixed $reasonData Any data, e.g. the package name, that - * goes with the reason - * @return Rule The generated rule + * @param PackageInterface $issuer The package declaring the conflict + * @param PackageInterface $provider The package causing the conflict + * @param int $reason A RULE_* constant describing the + * reason for generating this rule + * @param mixed $reasonData Any data, e.g. the package name, that + * goes with the reason + * @return Rule The generated rule */ protected function createConflictRule(PackageInterface $issuer, PackageInterface $provider, $reason, $reasonData = null) { @@ -262,7 +262,7 @@ class RuleSetGenerator * Adds all rules for all update packages of a given package * * @param PackageInterface $package Rules for this package's updates are to - * be added + * be added */ private function addRulesForUpdatePackages(PackageInterface $package) { diff --git a/src/Composer/DependencyResolver/RuleWatchGraph.php b/src/Composer/DependencyResolver/RuleWatchGraph.php index 627a66eb3..a9f7414b2 100644 --- a/src/Composer/DependencyResolver/RuleWatchGraph.php +++ b/src/Composer/DependencyResolver/RuleWatchGraph.php @@ -69,11 +69,11 @@ class RuleWatchGraph * above example the rule was (-A|+B), then A turning true means that * B must now be decided true as well. * - * @param int $decidedLiteral The literal which was decided (A in our example) - * @param int $level The level at which the decision took place and at which - * all resulting decisions should be made. - * @param Decisions $decisions Used to check previous decisions and to - * register decisions resulting from propagation + * @param int $decidedLiteral The literal which was decided (A in our example) + * @param int $level The level at which the decision took place and at which + * all resulting decisions should be made. + * @param Decisions $decisions Used to check previous decisions and to + * register decisions resulting from propagation * @return Rule|null If a conflict is found the conflicting rule is returned */ public function propagateLiteral($decidedLiteral, $level, $decisions) diff --git a/src/Composer/DependencyResolver/Transaction.php b/src/Composer/DependencyResolver/Transaction.php index 0c30f06df..214c502d1 100644 --- a/src/Composer/DependencyResolver/Transaction.php +++ b/src/Composer/DependencyResolver/Transaction.php @@ -13,7 +13,6 @@ namespace Composer\DependencyResolver; use Composer\Package\AliasPackage; -use Composer\DependencyResolver\Operation; /** * @author Nils Adermann diff --git a/src/Composer/Downloader/DownloadManager.php b/src/Composer/Downloader/DownloadManager.php index f2296d7d7..26c5a5301 100644 --- a/src/Composer/Downloader/DownloadManager.php +++ b/src/Composer/Downloader/DownloadManager.php @@ -13,7 +13,6 @@ namespace Composer\Downloader; use Composer\Package\PackageInterface; -use Composer\Downloader\DownloaderInterface; use Composer\IO\IOInterface; use Composer\Util\Filesystem; @@ -104,7 +103,7 @@ class DownloadManager /** * Returns downloader for a specific installation type. * - * @param string $type installation type + * @param string $type installation type * @return DownloaderInterface * * @throws \InvalidArgumentException if downloader for provided type is not registered @@ -122,12 +121,12 @@ class DownloadManager /** * Returns downloader for already installed package. * - * @param PackageInterface $package package instance + * @param PackageInterface $package package instance * @return DownloaderInterface|null * * @throws \InvalidArgumentException if package has no installation source specified * @throws \LogicException if specific downloader used to load package with - * wrong type + * wrong type */ public function getDownloaderForInstalledPackage(PackageInterface $package) { diff --git a/src/Composer/Downloader/FileDownloader.php b/src/Composer/Downloader/FileDownloader.php index fc903fd66..7d1c4f9a7 100644 --- a/src/Composer/Downloader/FileDownloader.php +++ b/src/Composer/Downloader/FileDownloader.php @@ -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')); } diff --git a/src/Composer/Downloader/GitDownloader.php b/src/Composer/Downloader/GitDownloader.php index e33c9d790..f44b1514e 100644 --- a/src/Composer/Downloader/GitDownloader.php +++ b/src/Composer/Downloader/GitDownloader.php @@ -47,7 +47,7 @@ class GitDownloader extends VcsDownloader $command = 'git clone --no-checkout %s %s && cd '.$flag.'%2$s && git remote add composer %1$s && git fetch composer'; $this->io->write(" Cloning ".$ref); - $commandCallable = function($url) use ($ref, $path, $command) { + $commandCallable = function ($url) use ($ref, $path, $command) { return sprintf($command, escapeshellarg($url), escapeshellarg($path), escapeshellarg($ref)); }; @@ -77,7 +77,7 @@ class GitDownloader extends VcsDownloader $this->io->write(" Checking out ".$ref); $command = 'git remote set-url composer %s && git fetch composer && git fetch --tags composer'; - $commandCallable = function($url) use ($command) { + $commandCallable = function ($url) use ($command) { return sprintf($command, escapeshellarg($url)); }; @@ -201,10 +201,10 @@ class GitDownloader extends VcsDownloader /** * Updates the given path to the given commit ref * - * @param string $path - * @param string $reference - * @param string $branch - * @param DateTime $date + * @param string $path + * @param string $reference + * @param string $branch + * @param DateTime $date * @return null|string if a string is returned, it is the commit reference that was checked out if the original could not be found */ protected function updateToCommit($path, $reference, $branch, $date) diff --git a/src/Composer/Downloader/GzipDownloader.php b/src/Composer/Downloader/GzipDownloader.php index fb4bce89d..073b18c30 100644 --- a/src/Composer/Downloader/GzipDownloader.php +++ b/src/Composer/Downloader/GzipDownloader.php @@ -68,4 +68,3 @@ class GzipDownloader extends ArchiveDownloader return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME); } } - diff --git a/src/Composer/Downloader/PearPackageExtractor.php b/src/Composer/Downloader/PearPackageExtractor.php index 5310c7ab7..3ed3ed7be 100644 --- a/src/Composer/Downloader/PearPackageExtractor.php +++ b/src/Composer/Downloader/PearPackageExtractor.php @@ -127,11 +127,11 @@ class PearPackageExtractor /** * Builds list of copy and list of remove actions that would transform extracted PEAR tarball into installed package. * - * @param string $source string path to extracted files - * @param array $roles array [role => roleRoot] relative root for files having that role - * @param array $vars list of values can be used for replacement tasks - * @return array array of 'source' => 'target', where source is location of file in the tarball (relative to source - * path, and target is destination of file (also relative to $source path) + * @param string $source string path to extracted files + * @param array $roles array [role => roleRoot] relative root for files having that role + * @param array $vars list of values can be used for replacement tasks + * @return array array of 'source' => 'target', where source is location of file in the tarball (relative to source + * path, and target is destination of file (also relative to $source path) * @throws \RuntimeException */ private function buildCopyActions($source, array $roles, $vars) diff --git a/src/Composer/Downloader/PerforceDownloader.php b/src/Composer/Downloader/PerforceDownloader.php index 42f424057..683ea9f34 100644 --- a/src/Composer/Downloader/PerforceDownloader.php +++ b/src/Composer/Downloader/PerforceDownloader.php @@ -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; } diff --git a/src/Composer/Downloader/VcsDownloader.php b/src/Composer/Downloader/VcsDownloader.php index b0f0b7cbc..ea7df270a 100644 --- a/src/Composer/Downloader/VcsDownloader.php +++ b/src/Composer/Downloader/VcsDownloader.php @@ -181,10 +181,10 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa /** * Prompt the user to check if changes should be stashed/removed or the operation aborted * - * @param PackageInterface $package - * @param string $path - * @param bool $update if true (update) the changes can be stashed and reapplied after an update, - * if false (remove) the changes should be assumed to be lost if the operation is not aborted + * @param PackageInterface $package + * @param string $path + * @param bool $update if true (update) the changes can be stashed and reapplied after an update, + * if false (remove) the changes should be assumed to be lost if the operation is not aborted * @throws \RuntimeException in case the operation must be aborted */ protected function cleanChanges(PackageInterface $package, $path, $update) diff --git a/src/Composer/Downloader/ZipDownloader.php b/src/Composer/Downloader/ZipDownloader.php index 88c0e4346..b35d6a5af 100644 --- a/src/Composer/Downloader/ZipDownloader.php +++ b/src/Composer/Downloader/ZipDownloader.php @@ -45,7 +45,7 @@ class ZipDownloader extends ArchiveDownloader } $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput(); - } catch(\Exception $e) { + } catch (\Exception $e) { $processError = 'Failed to execute ' . $command . "\n\n" . $e->getMessage(); } } diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php index d65bc44a8..5c5bfd5cf 100644 --- a/src/Composer/Factory.php +++ b/src/Composer/Factory.php @@ -178,9 +178,9 @@ class Factory /** * Creates a Composer instance * - * @param IOInterface $io IO instance - * @param array|string|null $localConfig either a configuration array or a filename to read from, if null it will - * read from the default filename + * @param IOInterface $io IO instance + * @param array|string|null $localConfig either a configuration array or a filename to read from, if null it will + * read from the default filename * @param bool $disablePlugins Whether plugins should not be loaded * @throws \InvalidArgumentException * @throws \UnexpectedValueException @@ -453,10 +453,10 @@ class Factory } /** - * @param IOInterface $io IO instance - * @param mixed $config either a configuration array or a filename to read from, if null it will read from - * the default filename - * @param bool $disablePlugins Whether plugins should not be loaded + * @param IOInterface $io IO instance + * @param mixed $config either a configuration array or a filename to read from, if null it will read from + * the default filename + * @param bool $disablePlugins Whether plugins should not be loaded * @return Composer */ public static function create(IOInterface $io, $config = null, $disablePlugins = false) diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 29a89a4ba..fac713226 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -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; @@ -843,7 +842,7 @@ class Installer /** * Build a regexp from a package name, expanding * globs as required * - * @param string $whiteListedPattern + * @param string $whiteListedPattern * @return string */ private function packageNameToRegexp($whiteListedPattern) @@ -1146,7 +1145,7 @@ class Installer /** * Should dependencies of whitelisted packages be updated recursively? * - * @param boolean $updateDependencies + * @param boolean $updateDependencies * @return Installer */ public function setWhitelistDependencies($updateDependencies = true) diff --git a/src/Composer/Json/JsonFile.php b/src/Composer/Json/JsonFile.php index 999fa33e8..2d35b9671 100644 --- a/src/Composer/Json/JsonFile.php +++ b/src/Composer/Json/JsonFile.php @@ -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; diff --git a/src/Composer/Json/JsonFormatter.php b/src/Composer/Json/JsonFormatter.php index f06928e34..614683608 100644 --- a/src/Composer/Json/JsonFormatter.php +++ b/src/Composer/Json/JsonFormatter.php @@ -30,9 +30,9 @@ class JsonFormatter * Originally licensed under MIT by Dave Perrett * * - * @param string $json - * @param bool $unescapeUnicode Un escape unicode - * @param bool $unescapeSlashes Un escape slashes + * @param string $json + * @param bool $unescapeUnicode Un escape unicode + * @param bool $unescapeSlashes Un escape slashes * @return string */ public static function format($json, $unescapeUnicode, $unescapeSlashes) @@ -66,7 +66,7 @@ class JsonFormatter if ($unescapeUnicode && function_exists('mb_convert_encoding')) { // http://stackoverflow.com/questions/2934563/how-to-decode-unicode-escape-sequences-like-u00ed-to-proper-utf-8-encoded-cha - $buffer = preg_replace_callback('/(\\\\+)u([0-9a-f]{4})/i', function($match) { + $buffer = preg_replace_callback('/(\\\\+)u([0-9a-f]{4})/i', function ($match) { $l = strlen($match[1]); if ($l % 2) { @@ -76,6 +76,7 @@ class JsonFormatter 'UCS-2BE' ); } + return $match[0]; }, $buffer); } diff --git a/src/Composer/Package/Link.php b/src/Composer/Package/Link.php index 159fa3ae9..5aba8b119 100644 --- a/src/Composer/Package/Link.php +++ b/src/Composer/Package/Link.php @@ -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 diff --git a/src/Composer/Package/Loader/RootPackageLoader.php b/src/Composer/Package/Loader/RootPackageLoader.php index 300adea17..64880d727 100644 --- a/src/Composer/Package/Loader/RootPackageLoader.php +++ b/src/Composer/Package/Loader/RootPackageLoader.php @@ -320,6 +320,7 @@ class RootPackageLoader extends ArrayLoader if ('9999999-dev' === $version) { $version = 'dev-'.$matches[3]; } + return $version; } diff --git a/src/Composer/Package/Locker.php b/src/Composer/Package/Locker.php index 674bc9484..2aa36187f 100644 --- a/src/Composer/Package/Locker.php +++ b/src/Composer/Package/Locker.php @@ -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; diff --git a/src/Composer/Repository/ArtifactRepository.php b/src/Composer/Repository/ArtifactRepository.php index b4d0d8c92..6a942ad2d 100644 --- a/src/Composer/Repository/ArtifactRepository.php +++ b/src/Composer/Repository/ArtifactRepository.php @@ -75,22 +75,23 @@ class ArtifactRepository extends ArrayRepository } /** - * Find a file by name, returning the one that has the shortest path. - * - * @param \ZipArchive $zip + * Find a file by name, returning the one that has the shortest path. + * + * @param \ZipArchive $zip * @param $filename * @return bool|int */ - private function locateFile(\ZipArchive $zip, $filename) { + private function locateFile(\ZipArchive $zip, $filename) + { $indexOfShortestMatch = false; $lengthOfShortestMatch = -1; - for ($i = 0; $i < $zip->numFiles; $i++ ){ + for ($i = 0; $i < $zip->numFiles; $i++) { $stat = $zip->statIndex($i); - if (strcmp(basename($stat['name']), $filename) === 0){ + if (strcmp(basename($stat['name']), $filename) === 0) { $directoryName = dirname($stat['name']); if ($directoryName == '.') { - //if composer.json is in root directory + //if composer.json is in root directory //it has to be the one to use. return $i; } @@ -100,7 +101,7 @@ class ArtifactRepository extends ArrayRepository //composer.json files below first directory are rejected continue; } - + $length = strlen($stat['name']); if ($indexOfShortestMatch == false || $length < $lengthOfShortestMatch) { //Check it's not a directory. @@ -115,7 +116,7 @@ class ArtifactRepository extends ArrayRepository return $indexOfShortestMatch; } - + private function getComposerInformation(\SplFileInfo $file) { $zip = new \ZipArchive(); diff --git a/src/Composer/Repository/ComposerRepository.php b/src/Composer/Repository/ComposerRepository.php index e73977271..82d8b9a36 100644 --- a/src/Composer/Repository/ComposerRepository.php +++ b/src/Composer/Repository/ComposerRepository.php @@ -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; } } diff --git a/src/Composer/Repository/PlatformRepository.php b/src/Composer/Repository/PlatformRepository.php index 0c6a5d9ce..636cba16b 100644 --- a/src/Composer/Repository/PlatformRepository.php +++ b/src/Composer/Repository/PlatformRepository.php @@ -161,7 +161,6 @@ class PlatformRepository extends ArrayRepository } } - private function buildPackageName($name) { return 'ext-' . str_replace(' ', '-', $name); diff --git a/src/Composer/Repository/Vcs/GitDriver.php b/src/Composer/Repository/Vcs/GitDriver.php index 0e6286906..f37be1e9a 100644 --- a/src/Composer/Repository/Vcs/GitDriver.php +++ b/src/Composer/Repository/Vcs/GitDriver.php @@ -67,7 +67,7 @@ class GitDriver extends VcsDriver $gitUtil = new GitUtil($this->io, $this->config, $this->process, $fs); $repoDir = $this->repoDir; - $commandCallable = function($url) use ($repoDir) { + $commandCallable = function ($url) use ($repoDir) { return sprintf('git clone --mirror %s %s', escapeshellarg($url), escapeshellarg($repoDir)); }; diff --git a/src/Composer/Repository/Vcs/GitHubDriver.php b/src/Composer/Repository/Vcs/GitHubDriver.php index 0dc8a7eee..bb9e34fc7 100644 --- a/src/Composer/Repository/Vcs/GitHubDriver.php +++ b/src/Composer/Repository/Vcs/GitHubDriver.php @@ -54,6 +54,7 @@ class GitHubDriver extends VcsDriver if (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api']) { $this->setupGitDriver($this->url); + return; } diff --git a/src/Composer/Repository/Vcs/PerforceDriver.php b/src/Composer/Repository/Vcs/PerforceDriver.php index e928e5835..7e313bf63 100644 --- a/src/Composer/Repository/Vcs/PerforceDriver.php +++ b/src/Composer/Repository/Vcs/PerforceDriver.php @@ -140,6 +140,7 @@ class PerforceDriver extends VcsDriver { $this->composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier); $this->composerInfoIdentifier = $identifier; + return !empty($this->composerInfo); } diff --git a/src/Composer/Util/ConfigValidator.php b/src/Composer/Util/ConfigValidator.php index 5b9a7cf26..5b33e35ae 100644 --- a/src/Composer/Util/ConfigValidator.php +++ b/src/Composer/Util/ConfigValidator.php @@ -37,7 +37,7 @@ class ConfigValidator /** * Validates the config, and returns the result. * - * @param string $file The path to the file + * @param string $file The path to the file * @param integer $arrayLoaderValidationFlags Flags for ArrayLoader validation * * @return array a triple containing the errors, publishable errors, and warnings diff --git a/src/Composer/Util/Filesystem.php b/src/Composer/Util/Filesystem.php index b567c4b31..798cd9e44 100644 --- a/src/Composer/Util/Filesystem.php +++ b/src/Composer/Util/Filesystem.php @@ -384,7 +384,7 @@ class Filesystem /** * Return if the given path is local * - * @param string $path + * @param string $path * @return bool */ public static function isLocalPath($path) diff --git a/src/Composer/Util/GitHub.php b/src/Composer/Util/GitHub.php index a0b803db7..784cb51c9 100644 --- a/src/Composer/Util/GitHub.php +++ b/src/Composer/Util/GitHub.php @@ -150,7 +150,7 @@ class GitHub if (in_array($e->getCode(), array(403, 401))) { // 401 when authentication was supplied, handle 2FA if required. if ($this->io->hasAuthentication($originUrl)) { - $headerNames = array_map(function($header) { + $headerNames = array_map(function ($header) { return strtolower(strstr($header, ':', true)); }, $e->getHeaders()); diff --git a/src/Composer/Util/Perforce.php b/src/Composer/Util/Perforce.php index 894a151ef..d3dcd696f 100644 --- a/src/Composer/Util/Perforce.php +++ b/src/Composer/Util/Perforce.php @@ -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; } } @@ -283,18 +287,19 @@ class Perforce { $command = $this->generateP4Command('login -s', false); $exitCode = $this->executeCommand($command); - if ($exitCode){ + if ($exitCode) { $errorOutput = $this->process->getErrorOutput(); $index = strpos($errorOutput, $this->getUser()); - if ($index === false){ + if ($index === false) { $index = strpos($errorOutput, 'p4'); - if ($index===false){ + if ($index === false) { return false; } throw new \Exception('p4 command not found in path: ' . $errorOutput); } throw new \Exception('Invalid user name: ' . $this->getUser() ); } + return true; } @@ -384,7 +389,7 @@ class Perforce $command = 'echo ' . $password . ' | ' . $this->generateP4Command(' login -a', false); $exitCode = $this->executeCommand($command); $result = trim($this->commandResult); - if ($exitCode){ + if ($exitCode) { throw new \Exception("Error logging in:" . $this->process->getErrorOutput()); } } @@ -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; diff --git a/src/Composer/Util/ProcessExecutor.php b/src/Composer/Util/ProcessExecutor.php index 1ad2b1dfa..ab4e4b2db 100644 --- a/src/Composer/Util/ProcessExecutor.php +++ b/src/Composer/Util/ProcessExecutor.php @@ -34,10 +34,10 @@ class ProcessExecutor /** * runs a process on the commandline * - * @param string $command the command to execute - * @param mixed $output the output will be written into this var if passed by ref - * if a callable is passed it will be used as output handler - * @param string $cwd the working directory + * @param string $command the command to execute + * @param mixed $output the output will be written into this var if passed by ref + * if a callable is passed it will be used as output handler + * @param string $cwd the working directory * @return int statuscode */ public function execute($command, &$output = null, $cwd = null) diff --git a/tests/Composer/Test/AllFunctionalTest.php b/tests/Composer/Test/AllFunctionalTest.php index 03ec4305f..f27d58117 100644 --- a/tests/Composer/Test/AllFunctionalTest.php +++ b/tests/Composer/Test/AllFunctionalTest.php @@ -124,7 +124,7 @@ class AllFunctionalTest extends \PHPUnit_Framework_TestCase $testDir = sys_get_temp_dir().'/composer_functional_test'.uniqid(mt_rand(), true); $this->testDir = $testDir; $varRegex = '#%([a-zA-Z_-]+)%#'; - $variableReplacer = function($match) use (&$data, $testDir) { + $variableReplacer = function ($match) use (&$data, $testDir) { list(, $var) = $match; switch ($var) { diff --git a/tests/Composer/Test/Autoload/ClassLoaderTest.php b/tests/Composer/Test/Autoload/ClassLoaderTest.php index 0b9c1934e..eee942e42 100644 --- a/tests/Composer/Test/Autoload/ClassLoaderTest.php +++ b/tests/Composer/Test/Autoload/ClassLoaderTest.php @@ -14,9 +14,9 @@ class ClassLoaderTest extends \PHPUnit_Framework_TestCase * * @dataProvider getLoadClassTests * - * @param string $class The fully-qualified class name to test, without preceding namespace separator. - * @param bool $prependSeparator Whether to call ->loadClass() with a class name with preceding - * namespace separator, as it happens in PHP 5.3.0 - 5.3.2. See https://bugs.php.net/50731 + * @param string $class The fully-qualified class name to test, without preceding namespace separator. + * @param bool $prependSeparator Whether to call ->loadClass() with a class name with preceding + * namespace separator, as it happens in PHP 5.3.0 - 5.3.2. See https://bugs.php.net/50731 */ public function testLoadClass($class, $prependSeparator = FALSE) { diff --git a/tests/Composer/Test/Downloader/FileDownloaderTest.php b/tests/Composer/Test/Downloader/FileDownloaderTest.php index ffdbf997d..f0578f6be 100644 --- a/tests/Composer/Test/Downloader/FileDownloaderTest.php +++ b/tests/Composer/Test/Downloader/FileDownloaderTest.php @@ -109,7 +109,7 @@ class FileDownloaderTest extends \PHPUnit_Framework_TestCase $ioMock = $this->getMock('Composer\IO\IOInterface'); $ioMock->expects($this->any()) ->method('write') - ->will($this->returnCallback(function($messages, $newline = true) use ($path) { + ->will($this->returnCallback(function ($messages, $newline = true) use ($path) { if (is_file($path.'/script.js')) { unlink($path.'/script.js'); } diff --git a/tests/Composer/Test/Downloader/PerforceDownloaderTest.php b/tests/Composer/Test/Downloader/PerforceDownloaderTest.php index b1d3d8fb9..9e26689a9 100644 --- a/tests/Composer/Test/Downloader/PerforceDownloaderTest.php +++ b/tests/Composer/Test/Downloader/PerforceDownloaderTest.php @@ -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; } diff --git a/tests/Composer/Test/Json/JsonFormatterTest.php b/tests/Composer/Test/Json/JsonFormatterTest.php index ce7ceefa6..eb6e87b00 100644 --- a/tests/Composer/Test/Json/JsonFormatterTest.php +++ b/tests/Composer/Test/Json/JsonFormatterTest.php @@ -34,7 +34,7 @@ class JsonFormatterTest extends \PHPUnit_Framework_TestCase /** * Convert string to character codes split by a plus sign - * @param string $string + * @param string $string * @return string */ protected function getCharacterCodes($string) @@ -43,6 +43,7 @@ class JsonFormatterTest extends \PHPUnit_Framework_TestCase for ($i = 0; $i < strlen($string); $i++) { $codes[] = ord($string[$i]); } + return implode('+', $codes); } diff --git a/tests/Composer/Test/Json/JsonValidationExceptionTest.php b/tests/Composer/Test/Json/JsonValidationExceptionTest.php index 38486a2a4..76959d688 100644 --- a/tests/Composer/Test/Json/JsonValidationExceptionTest.php +++ b/tests/Composer/Test/Json/JsonValidationExceptionTest.php @@ -25,13 +25,13 @@ class JsonValidationExceptionTest extends \PHPUnit_Framework_TestCase $this->assertEquals($message, $object->getMessage()); $this->assertEquals($errors, $object->getErrors()); } - + public function testGetErrorsWhenNoErrorsProvided() { $object = new JsonValidationException('test message'); $this->assertEquals(array(), $object->getErrors()); } - + public function errorProvider() { return array( diff --git a/tests/Composer/Test/Package/Loader/RootPackageLoaderTest.php b/tests/Composer/Test/Package/Loader/RootPackageLoaderTest.php index 1a6a3bf78..51799d053 100644 --- a/tests/Composer/Test/Package/Loader/RootPackageLoaderTest.php +++ b/tests/Composer/Test/Package/Loader/RootPackageLoaderTest.php @@ -35,7 +35,7 @@ class RootPackageLoaderTest extends \PHPUnit_Framework_TestCase $self = $this; /* Can do away with this mock object when https://github.com/sebastianbergmann/phpunit-mock-objects/issues/81 is fixed */ - $processExecutor = new ProcessExecutorMock(function($command, &$output = null, $cwd = null) use ($self, $commitHash) { + $processExecutor = new ProcessExecutorMock(function ($command, &$output = null, $cwd = null) use ($self, $commitHash) { if (0 === strpos($command, 'git describe')) { // simulate not being on a tag return 1; @@ -69,7 +69,7 @@ class RootPackageLoaderTest extends \PHPUnit_Framework_TestCase $self = $this; /* Can do away with this mock object when https://github.com/sebastianbergmann/phpunit-mock-objects/issues/81 is fixed */ - $processExecutor = new ProcessExecutorMock(function($command, &$output = null, $cwd = null) use ($self) { + $processExecutor = new ProcessExecutorMock(function ($command, &$output = null, $cwd = null) use ($self) { $self->assertEquals('git describe --exact-match --tags', $command); $output = "v2.0.5-alpha2"; @@ -98,7 +98,7 @@ class RootPackageLoaderTest extends \PHPUnit_Framework_TestCase $self = $this; /* Can do away with this mock object when https://github.com/sebastianbergmann/phpunit-mock-objects/issues/81 is fixed */ - $processExecutor = new ProcessExecutorMock(function($command, &$output = null, $cwd = null) use ($self) { + $processExecutor = new ProcessExecutorMock(function ($command, &$output = null, $cwd = null) use ($self) { if ('git describe --exact-match --tags' === $command) { $output = "foo-bar"; @@ -124,7 +124,7 @@ class RootPackageLoaderTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $processExecutor = new ProcessExecutorMock(function($command, &$output = null, $cwd = null) { + $processExecutor = new ProcessExecutorMock(function ($command, &$output = null, $cwd = null) { return 1; }); diff --git a/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php b/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php index 593598a58..23c47c3c7 100644 --- a/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php +++ b/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php @@ -198,6 +198,7 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase { if (!$mustCheck) { $this->assertTrue(true); + return; } $internalLoader = $this->getMock('Composer\Package\Loader\LoaderInterface'); diff --git a/tests/Composer/Test/Package/Version/VersionParserTest.php b/tests/Composer/Test/Package/Version/VersionParserTest.php index 18b5c493f..464779d83 100644 --- a/tests/Composer/Test/Package/Version/VersionParserTest.php +++ b/tests/Composer/Test/Package/Version/VersionParserTest.php @@ -54,7 +54,7 @@ class VersionParserTest extends \PHPUnit_Framework_TestCase ); $self = $this; - $createPackage = function($arr) use ($self) { + $createPackage = function ($arr) use ($self) { $package = $self->getMock('\Composer\Package\PackageInterface'); $package->expects($self->once())->method('isDev')->will($self->returnValue(true)); $package->expects($self->once())->method('getSourceType')->will($self->returnValue('git')); diff --git a/tests/Composer/Test/Repository/ArtifactRepositoryTest.php b/tests/Composer/Test/Repository/ArtifactRepositoryTest.php index a5889dd28..7833899e0 100644 --- a/tests/Composer/Test/Repository/ArtifactRepositoryTest.php +++ b/tests/Composer/Test/Repository/ArtifactRepositoryTest.php @@ -28,14 +28,14 @@ class ArtifactRepositoryTest extends TestCase 'vendor3/package1-5.4.3', 'test/jsonInRoot-1.0.0', 'test/jsonInFirstLevel-1.0.0', - //The files not-an-artifact.zip and jsonSecondLevel are not valid + //The files not-an-artifact.zip and jsonSecondLevel are not valid //artifacts and do not get detected. ); $coordinates = array('type' => 'artifact', 'url' => __DIR__ . '/Fixtures/artifacts'); $repo = new ArtifactRepository($coordinates, new NullIO(), new Config()); - $foundPackages = array_map(function(BasePackage $package) { + $foundPackages = array_map(function (BasePackage $package) { return "{$package->getPrettyName()}-{$package->getPrettyVersion()}"; }, $repo->getPackages()); @@ -73,7 +73,7 @@ class ArtifactRepositoryTest extends TestCase // ), //); // -//foreach($archivesToCreate as $archiveName => $fileDetails) { +//foreach ($archivesToCreate as $archiveName => $fileDetails) { // $zipFile = new ZipArchive(); // $zipFile->open("$archiveName.zip", ZIPARCHIVE::CREATE); // @@ -83,4 +83,3 @@ class ArtifactRepositoryTest extends TestCase // // $zipFile->close(); //} - diff --git a/tests/Composer/Test/Repository/FilesystemRepositoryTest.php b/tests/Composer/Test/Repository/FilesystemRepositoryTest.php index fa6214dee..fa1ec6d5b 100644 --- a/tests/Composer/Test/Repository/FilesystemRepositoryTest.php +++ b/tests/Composer/Test/Repository/FilesystemRepositoryTest.php @@ -12,7 +12,6 @@ namespace Composer\Repository; -use Composer\Repository\FilesystemRepository; use Composer\TestCase; class FilesystemRepositoryTest extends TestCase diff --git a/tests/Composer/Test/Repository/Vcs/PerforceDriverTest.php b/tests/Composer/Test/Repository/Vcs/PerforceDriverTest.php index dcb50244a..09762f26e 100644 --- a/tests/Composer/Test/Repository/Vcs/PerforceDriverTest.php +++ b/tests/Composer/Test/Repository/Vcs/PerforceDriverTest.php @@ -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(); } diff --git a/tests/Composer/Test/Util/PerforceTest.php b/tests/Composer/Test/Util/PerforceTest.php index a5f3e60fa..91575b06d 100644 --- a/tests/Composer/Test/Util/PerforceTest.php +++ b/tests/Composer/Test/Util/PerforceTest.php @@ -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()) @@ -629,12 +629,12 @@ class PerforceTest extends \PHPUnit_Framework_TestCase $result = $this->perforce->checkServerExists('perforce.does.exist:port', $processExecutor); $this->assertTrue($result); } - + /** * Test if "p4" command is missing. - * + * * @covers \Composer\Util\Perforce::checkServerExists - * + * * @return void */ public function testCheckServerClientError() @@ -646,7 +646,7 @@ class PerforceTest extends \PHPUnit_Framework_TestCase ->method('execute') ->with($this->equalTo($expectedCommand), $this->equalTo(null)) ->will($this->returnValue(127)); - + $result = $this->perforce->checkServerExists('perforce.does.exist:port', $processExecutor); $this->assertFalse($result); } diff --git a/tests/Composer/Test/Util/StreamContextFactoryTest.php b/tests/Composer/Test/Util/StreamContextFactoryTest.php index b0923e6df..5415a8c11 100644 --- a/tests/Composer/Test/Util/StreamContextFactoryTest.php +++ b/tests/Composer/Test/Util/StreamContextFactoryTest.php @@ -52,7 +52,7 @@ class StreamContextFactoryTest extends \PHPUnit_Framework_TestCase ), array( $a = array('http' => array('method' => 'GET', 'max_redirects' => 20, 'follow_location' => 1)), array('http' => array('method' => 'GET')), - array('options' => $a, 'notification' => $f = function() {}), array('notification' => $f) + array('options' => $a, 'notification' => $f = function () {}), array('notification' => $f) ), ); }