diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index 5a0da1f40..f7dfdef0d 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -922,7 +922,7 @@ INITIALIZER; $packages[$name] = $package; } - $add = function (PackageInterface $package) use (&$add, $mainPackage, $packages, &$include) { + $add = function (PackageInterface $package) use (&$add, $packages, &$include) { foreach ($package->getRequires() as $link) { $target = $link->getTarget(); if (!isset($include[$target])) { diff --git a/src/Composer/Command/ShowCommand.php b/src/Composer/Command/ShowCommand.php index 168b0f285..d42da046b 100644 --- a/src/Composer/Command/ShowCommand.php +++ b/src/Composer/Command/ShowCommand.php @@ -383,7 +383,7 @@ EOT } if ($latestPackage && $latestPackage->isAbandoned()) { - $replacement = (is_string($latestPackage->getReplacementPackage())) + $replacement = is_string($latestPackage->getReplacementPackage()) ? 'Use ' . $latestPackage->getReplacementPackage() . ' instead' : 'No replacement was suggested'; $packageWarning = sprintf( diff --git a/src/Composer/Command/StatusCommand.php b/src/Composer/Command/StatusCommand.php index f7b0ef37e..6ea388a7a 100644 --- a/src/Composer/Command/StatusCommand.php +++ b/src/Composer/Command/StatusCommand.php @@ -12,7 +12,6 @@ namespace Composer\Command; -use Composer\Downloader\DownloaderInterface; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; diff --git a/src/Composer/DependencyResolver/GenericRule.php b/src/Composer/DependencyResolver/GenericRule.php index 0af3617d4..df8a2a003 100644 --- a/src/Composer/DependencyResolver/GenericRule.php +++ b/src/Composer/DependencyResolver/GenericRule.php @@ -75,7 +75,7 @@ class GenericRule extends Rule */ public function __toString() { - $result = ($this->isDisabled()) ? 'disabled(' : '('; + $result = $this->isDisabled() ? 'disabled(' : '('; foreach ($this->literals as $i => $literal) { if ($i != 0) { diff --git a/src/Composer/DependencyResolver/Problem.php b/src/Composer/DependencyResolver/Problem.php index debc8678c..184a55636 100644 --- a/src/Composer/DependencyResolver/Problem.php +++ b/src/Composer/DependencyResolver/Problem.php @@ -247,6 +247,6 @@ class Problem */ protected function constraintToText($constraint) { - return ($constraint) ? ' '.$constraint->getPrettyString() : ''; + return $constraint ? ' '.$constraint->getPrettyString() : ''; } } diff --git a/src/Composer/DependencyResolver/Rule2Literals.php b/src/Composer/DependencyResolver/Rule2Literals.php index 359fe4f20..c44a15ab2 100644 --- a/src/Composer/DependencyResolver/Rule2Literals.php +++ b/src/Composer/DependencyResolver/Rule2Literals.php @@ -93,7 +93,7 @@ class Rule2Literals extends Rule */ public function __toString() { - $result = ($this->isDisabled()) ? 'disabled(' : '('; + $result = $this->isDisabled() ? 'disabled(' : '('; $result .= $this->literal1 . '|' . $this->literal2 . ')'; diff --git a/src/Composer/DependencyResolver/RuleSetGenerator.php b/src/Composer/DependencyResolver/RuleSetGenerator.php index 2cf150a33..3855f7d04 100644 --- a/src/Composer/DependencyResolver/RuleSetGenerator.php +++ b/src/Composer/DependencyResolver/RuleSetGenerator.php @@ -215,7 +215,7 @@ class RuleSetGenerator } // check obsoletes and implicit obsoletes of a package - $isInstalled = (isset($this->installedMap[$package->id])); + $isInstalled = isset($this->installedMap[$package->id]); foreach ($package->getReplaces() as $link) { $obsoleteProviders = $this->pool->whatProvides($link->getTarget(), $link->getConstraint()); @@ -226,7 +226,7 @@ class RuleSetGenerator } if (!$this->obsoleteImpossibleForAlias($package, $provider)) { - $reason = ($isInstalled) ? Rule::RULE_INSTALLED_PACKAGE_OBSOLETES : Rule::RULE_PACKAGE_OBSOLETES; + $reason = $isInstalled ? Rule::RULE_INSTALLED_PACKAGE_OBSOLETES : Rule::RULE_PACKAGE_OBSOLETES; $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $provider, $reason, $link)); } } diff --git a/src/Composer/DependencyResolver/Transaction.php b/src/Composer/DependencyResolver/Transaction.php index 3674a1989..c8d3bbe53 100644 --- a/src/Composer/DependencyResolver/Transaction.php +++ b/src/Composer/DependencyResolver/Transaction.php @@ -49,7 +49,7 @@ class Transaction $package = $this->pool->literalToPackage($literal); // wanted & installed || !wanted & !installed - if (($literal > 0) == (isset($this->installedMap[$package->id]))) { + if (($literal > 0) == isset($this->installedMap[$package->id])) { continue; } diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index f4f778ddb..1ae72aed0 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -251,7 +251,7 @@ class Installer continue; } - $replacement = (is_string($package->getReplacementPackage())) + $replacement = is_string($package->getReplacementPackage()) ? 'Use ' . $package->getReplacementPackage() . ' instead' : 'No replacement was suggested'; @@ -1033,11 +1033,8 @@ class Installer $package->setReplaces($newPackage->getReplaces()); } - if ($task === 'force-updates' && $newPackage && ( - (($newPackage->getSourceReference() && $newPackage->getSourceReference() !== $package->getSourceReference()) - || ($newPackage->getDistReference() && $newPackage->getDistReference() !== $package->getDistReference()) - ) - )) { + if ($task === 'force-updates' && $newPackage && ($newPackage->getSourceReference() && $newPackage->getSourceReference() !== $package->getSourceReference()) + || ($newPackage->getDistReference() && $newPackage->getDistReference() !== $package->getDistReference())) { $operations[] = new UpdateOperation($package, $newPackage); continue; diff --git a/src/Composer/Installer/BinaryInstaller.php b/src/Composer/Installer/BinaryInstaller.php index a61ea86a1..0f709f60b 100644 --- a/src/Composer/Installer/BinaryInstaller.php +++ b/src/Composer/Installer/BinaryInstaller.php @@ -113,7 +113,7 @@ class BinaryInstaller } // attempt removing the bin dir in case it is left empty - if ((is_dir($this->binDir)) && ($this->filesystem->isDirEmpty($this->binDir))) { + if (is_dir($this->binDir) && $this->filesystem->isDirEmpty($this->binDir)) { Silencer::call('rmdir', $this->binDir); } } diff --git a/src/Composer/Json/JsonFile.php b/src/Composer/Json/JsonFile.php index 0557847d6..b84791420 100644 --- a/src/Composer/Json/JsonFile.php +++ b/src/Composer/Json/JsonFile.php @@ -281,7 +281,6 @@ class JsonFile * @param string $json * @param string $file * @throws \UnexpectedValueException - * @throws JsonValidationException * @throws ParsingException * @return bool true on success */ diff --git a/src/Composer/Json/JsonFormatter.php b/src/Composer/Json/JsonFormatter.php index 8e2005715..680a57baf 100644 --- a/src/Composer/Json/JsonFormatter.php +++ b/src/Composer/Json/JsonFormatter.php @@ -88,7 +88,7 @@ class JsonFormatter if (':' === $char) { // Add a space after the : character $char .= ' '; - } elseif (('}' === $char || ']' === $char)) { + } elseif ('}' === $char || ']' === $char) { $pos--; $prevChar = substr($json, $i - 1, 1); diff --git a/src/Composer/Package/Loader/RootPackageLoader.php b/src/Composer/Package/Loader/RootPackageLoader.php index 04b44f7b6..f917eb838 100644 --- a/src/Composer/Package/Loader/RootPackageLoader.php +++ b/src/Composer/Package/Loader/RootPackageLoader.php @@ -230,7 +230,7 @@ class RootPackageLoader extends ArrayLoader { foreach ($requires as $reqName => $reqVersion) { $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion); - if (preg_match('{^[^,\s@]+?#([a-f0-9]+)$}', $reqVersion, $match) && 'dev' === ($stabilityName = VersionParser::parseStability($reqVersion))) { + if (preg_match('{^[^,\s@]+?#([a-f0-9]+)$}', $reqVersion, $match) && 'dev' === VersionParser::parseStability($reqVersion)) { $name = strtolower($reqName); $references[$name] = $match[1]; } diff --git a/src/Composer/Package/Loader/ValidatingArrayLoader.php b/src/Composer/Package/Loader/ValidatingArrayLoader.php index fb2eafd93..2a71be6cb 100644 --- a/src/Composer/Package/Loader/ValidatingArrayLoader.php +++ b/src/Composer/Package/Loader/ValidatingArrayLoader.php @@ -12,7 +12,6 @@ namespace Composer\Package\Loader; -use Composer\Package; use Composer\Package\BasePackage; use Composer\Semver\Constraint\Constraint; use Composer\Package\Version\VersionParser; diff --git a/src/Composer/Plugin/PluginManager.php b/src/Composer/Plugin/PluginManager.php index 9cae9ee5d..e8f4b58c3 100644 --- a/src/Composer/Plugin/PluginManager.php +++ b/src/Composer/Plugin/PluginManager.php @@ -169,7 +169,7 @@ class PluginManager $generator = $this->composer->getAutoloadGenerator(); $autoloads = array(); foreach ($autoloadPackages as $autoloadPackage) { - $downloadPath = $this->getInstallPath($autoloadPackage, ($globalRepo && $globalRepo->hasPackage($autoloadPackage))); + $downloadPath = $this->getInstallPath($autoloadPackage, $globalRepo && $globalRepo->hasPackage($autoloadPackage)); $autoloads[] = array($autoloadPackage, $downloadPath); } @@ -307,7 +307,7 @@ class PluginManager { $packages = $pool->whatProvides($link->getTarget(), $link->getConstraint()); - return (!empty($packages)) ? $packages[0] : null; + return !empty($packages) ? $packages[0] : null; } /** diff --git a/src/Composer/Util/Filesystem.php b/src/Composer/Util/Filesystem.php index 2daa1ceb1..f262432ff 100644 --- a/src/Composer/Util/Filesystem.php +++ b/src/Composer/Util/Filesystem.php @@ -565,7 +565,7 @@ class Filesystem chdir($cwd); - return (bool) $result; + return $result; } /** diff --git a/src/Composer/Util/TlsHelper.php b/src/Composer/Util/TlsHelper.php index b261f47a5..e04c7157e 100644 --- a/src/Composer/Util/TlsHelper.php +++ b/src/Composer/Util/TlsHelper.php @@ -140,7 +140,7 @@ final class TlsHelper //Convert PEM to DER before SHA1'ing $start = '-----BEGIN PUBLIC KEY-----'; $end = '-----END PUBLIC KEY-----'; - $pemtrim = substr($pubkeypem, (strpos($pubkeypem, $start) + strlen($start)), (strlen($pubkeypem) - strpos($pubkeypem, $end)) * (-1)); + $pemtrim = substr($pubkeypem, strpos($pubkeypem, $start) + strlen($start), (strlen($pubkeypem) - strpos($pubkeypem, $end)) * (-1)); $der = base64_decode($pemtrim); return sha1($der); diff --git a/src/Composer/Util/Url.php b/src/Composer/Util/Url.php index f8d4b446d..4a5d5f90c 100644 --- a/src/Composer/Util/Url.php +++ b/src/Composer/Util/Url.php @@ -13,7 +13,6 @@ namespace Composer\Util; use Composer\Config; -use Composer\IO\IOInterface; /** * @author Jordi Boggiano