diff --git a/src/Composer/Command/BaseDependencyCommand.php b/src/Composer/Command/BaseDependencyCommand.php index 4ca6a16a7..561975bd1 100644 --- a/src/Composer/Command/BaseDependencyCommand.php +++ b/src/Composer/Command/BaseDependencyCommand.php @@ -55,10 +55,10 @@ class BaseDependencyCommand extends BaseCommand /** * Execute the command. * - * @param InputInterface $input - * @param OutputInterface $output - * @param bool $inverted Whether to invert matching process (why-not vs why behaviour) - * @return int|null Exit code of the operation. + * @param InputInterface $input + * @param OutputInterface $output + * @param bool $inverted Whether to invert matching process (why-not vs why behaviour) + * @return int|null Exit code of the operation. */ protected function doExecute(InputInterface $input, OutputInterface $output, $inverted = false) { @@ -125,6 +125,7 @@ class BaseDependencyCommand extends BaseCommand } else { $this->printTable($output, $results); } + return 0; } @@ -132,7 +133,7 @@ class BaseDependencyCommand extends BaseCommand * Assembles and prints a bottom-up table of the dependencies. * * @param OutputInterface $output - * @param array $results + * @param array $results */ protected function printTable(OutputInterface $output, $results) { @@ -141,13 +142,13 @@ class BaseDependencyCommand extends BaseCommand do { $queue = array(); $rows = array(); - foreach($results as $result) { + foreach ($results as $result) { /** * @var PackageInterface $package - * @var Link $link + * @var Link $link */ list($package, $link, $children) = $result; - $unique = (string)$link; + $unique = (string) $link; if (isset($doubles[$unique])) { continue; } @@ -158,7 +159,7 @@ class BaseDependencyCommand extends BaseCommand } $results = $queue; $table = array_merge($rows, $table); - } while(!empty($results)); + } while (!empty($results)); // Render table $renderer = new Table($output); @@ -171,17 +172,17 @@ class BaseDependencyCommand extends BaseCommand /** * Recursively prints a tree of the selected results. * - * @param array $results + * @param array $results * @param string $prefix */ protected function printTree($results, $prefix = '') { $count = count($results); $idx = 0; - foreach($results as $key => $result) { + foreach ($results as $key => $result) { /** * @var PackageInterface $package - * @var Link $link + * @var Link $link */ list($package, $link, $children) = $result; $isLast = (++$idx == $count); diff --git a/src/Composer/Command/DependsCommand.php b/src/Composer/Command/DependsCommand.php index 0cfb5b83d..365356d78 100644 --- a/src/Composer/Command/DependsCommand.php +++ b/src/Composer/Command/DependsCommand.php @@ -44,8 +44,8 @@ EOT /** * Execute the function. * - * @param InputInterface $input - * @param OutputInterface $output + * @param InputInterface $input + * @param OutputInterface $output * @return int|null */ protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Composer/Command/ProhibitsCommand.php b/src/Composer/Command/ProhibitsCommand.php index fb717eb7e..925c6aab5 100644 --- a/src/Composer/Command/ProhibitsCommand.php +++ b/src/Composer/Command/ProhibitsCommand.php @@ -44,8 +44,8 @@ EOT /** * Execute the function. * - * @param InputInterface $input - * @param OutputInterface $output + * @param InputInterface $input + * @param OutputInterface $output * @return int|null */ protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Composer/Command/RunScriptCommand.php b/src/Composer/Command/RunScriptCommand.php index da1d36132..296c658fa 100644 --- a/src/Composer/Command/RunScriptCommand.php +++ b/src/Composer/Command/RunScriptCommand.php @@ -93,7 +93,7 @@ EOT throw new \RuntimeException('Timeout value must be numeric and positive if defined, or 0 for forever'); } // Override global timeout set before in Composer by environment or config - ProcessExecutor::setTimeout((int)$timeout); + ProcessExecutor::setTimeout((int) $timeout); } return $composer->getEventDispatcher()->dispatchScript($script, $input->getOption('dev') || !$input->getOption('no-dev'), $args); diff --git a/src/Composer/Command/ValidateCommand.php b/src/Composer/Command/ValidateCommand.php index 87158d2bb..55e0021ea 100644 --- a/src/Composer/Command/ValidateCommand.php +++ b/src/Composer/Command/ValidateCommand.php @@ -16,7 +16,6 @@ use Composer\Factory; use Composer\Package\Loader\ValidatingArrayLoader; use Composer\Plugin\CommandEvent; use Composer\Plugin\PluginEvents; -use Composer\Script\ScriptEvents; use Composer\Util\ConfigValidator; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; diff --git a/src/Composer/Downloader/PathDownloader.php b/src/Composer/Downloader/PathDownloader.php index ae36336ed..ac4d9c457 100644 --- a/src/Composer/Downloader/PathDownloader.php +++ b/src/Composer/Downloader/PathDownloader.php @@ -59,7 +59,6 @@ class PathDownloader extends FileDownloader // Implement symlinks as NTFS junctions on Windows $this->filesystem->junction($realUrl, $path); $this->io->writeError(sprintf(' Junctioned from %s', $url)); - } else { $shortestPath = $this->filesystem->findShortestPath($path, $realUrl); $fileSystem->symlink($shortestPath, $path); diff --git a/src/Composer/Downloader/VcsDownloader.php b/src/Composer/Downloader/VcsDownloader.php index da251d214..377286726 100644 --- a/src/Composer/Downloader/VcsDownloader.php +++ b/src/Composer/Downloader/VcsDownloader.php @@ -245,7 +245,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa * Checks if VCS metadata repository has been initialized * repository example: .git|.svn|.hg * - * @param string $path + * @param string $path * @return bool */ abstract protected function hasMetadataRepository($path); diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 509c01d81..7aadb01a1 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -30,7 +30,6 @@ use Composer\Installer\InstallationManager; use Composer\Installer\InstallerEvents; use Composer\Installer\NoopInstaller; use Composer\IO\IOInterface; -use Composer\Json\JsonFile; use Composer\Package\AliasPackage; use Composer\Package\CompletePackage; use Composer\Package\Link; @@ -40,7 +39,6 @@ use Composer\Package\PackageInterface; use Composer\Package\RootPackageInterface; use Composer\Repository\CompositeRepository; use Composer\Repository\InstalledArrayRepository; -use Composer\Repository\InstalledFilesystemRepository; use Composer\Repository\PlatformRepository; use Composer\Repository\RepositoryInterface; use Composer\Repository\RepositoryManager; diff --git a/src/Composer/Package/Archiver/PharArchiver.php b/src/Composer/Package/Archiver/PharArchiver.php index acd1c3b61..c14e7bd9d 100644 --- a/src/Composer/Package/Archiver/PharArchiver.php +++ b/src/Composer/Package/Archiver/PharArchiver.php @@ -23,12 +23,12 @@ class PharArchiver implements ArchiverInterface 'zip' => \Phar::ZIP, 'tar' => \Phar::TAR, 'tar.gz' => \Phar::TAR, - 'tar.bz2' => \Phar::TAR + 'tar.bz2' => \Phar::TAR, ); protected static $compressFormats = array( 'tar.gz' => \Phar::GZ, - 'tar.bz2' => \Phar::BZ2 + 'tar.bz2' => \Phar::BZ2, ); /** diff --git a/src/Composer/Package/Archiver/ZipArchiver.php b/src/Composer/Package/Archiver/ZipArchiver.php index aaf42ed56..bc5719dce 100644 --- a/src/Composer/Package/Archiver/ZipArchiver.php +++ b/src/Composer/Package/Archiver/ZipArchiver.php @@ -20,7 +20,7 @@ use ZipArchive; class ZipArchiver implements ArchiverInterface { protected static $formats = array( - 'zip' => 1 + 'zip' => 1, ); /** @@ -33,7 +33,7 @@ class ZipArchiver implements ArchiverInterface $res = $zip->open($target, ZipArchive::CREATE); if ($res === true) { $files = new ArchivableFilesFinder($sources, $excludes); - foreach($files as $file) { + foreach ($files as $file) { /** @var $file \SplFileInfo */ $filepath = $file->getPath()."/".$file->getFilename(); $localname = str_replace($sources."/", '', $filepath); @@ -59,7 +59,8 @@ class ZipArchiver implements ArchiverInterface return isset(static::$formats[$format]) && $this->compressionAvailable(); } - private function compressionAvailable() { + private function compressionAvailable() + { return class_exists('ZipArchive'); } } diff --git a/src/Composer/Package/Version/VersionGuesser.php b/src/Composer/Package/Version/VersionGuesser.php index f5d548d3a..b11bb9bc1 100644 --- a/src/Composer/Package/Version/VersionGuesser.php +++ b/src/Composer/Package/Version/VersionGuesser.php @@ -44,9 +44,9 @@ class VersionGuesser private $versionParser; /** - * @param Config $config - * @param ProcessExecutor $process - * @param SemverVersionParser $versionParser + * @param Config $config + * @param ProcessExecutor $process + * @param SemverVersionParser $versionParser */ public function __construct(Config $config, ProcessExecutor $process, SemverVersionParser $versionParser) { diff --git a/src/Composer/Repository/BaseRepository.php b/src/Composer/Repository/BaseRepository.php index 381db4a82..e29d87f6d 100644 --- a/src/Composer/Repository/BaseRepository.php +++ b/src/Composer/Repository/BaseRepository.php @@ -28,11 +28,11 @@ abstract class BaseRepository implements RepositoryInterface * as values. If recursive lookup was requested a third value is returned containing an identically formed array up * to the root package. * - * @param string|string[] $needle The package name(s) to inspect. - * @param ConstraintInterface|null $constraint Optional constraint to filter by. - * @param bool $invert Whether to invert matches to discover reasons for the package *NOT* to be installed. - * @param bool $recurse Whether to recursively expand the requirement tree up to the root package. - * @return array An associative array of arrays as described above. + * @param string|string[] $needle The package name(s) to inspect. + * @param ConstraintInterface|null $constraint Optional constraint to filter by. + * @param bool $invert Whether to invert matches to discover reasons for the package *NOT* to be installed. + * @param bool $recurse Whether to recursively expand the requirement tree up to the root package. + * @return array An associative array of arrays as described above. */ public function getDependents($needle, $constraint = null, $invert = false, $recurse = true) { diff --git a/src/Composer/Repository/PathRepository.php b/src/Composer/Repository/PathRepository.php index c89c328cf..3aac09ca4 100644 --- a/src/Composer/Repository/PathRepository.php +++ b/src/Composer/Repository/PathRepository.php @@ -16,7 +16,6 @@ use Composer\Config; use Composer\IO\IOInterface; use Composer\Json\JsonFile; use Composer\Package\Loader\ArrayLoader; -use Composer\Package\Locker; use Composer\Package\Version\VersionGuesser; use Composer\Package\Version\VersionParser; use Composer\Util\ProcessExecutor; diff --git a/src/Composer/Repository/PearRepository.php b/src/Composer/Repository/PearRepository.php index d92e16ed8..33ce48094 100644 --- a/src/Composer/Repository/PearRepository.php +++ b/src/Composer/Repository/PearRepository.php @@ -94,8 +94,8 @@ class PearRepository extends ArrayRepository implements ConfigurableRepositoryIn /** * Builds CompletePackages from PEAR package definition data. * - * @param ChannelInfo $channelInfo - * @param SemverVersionParser $versionParser + * @param ChannelInfo $channelInfo + * @param SemverVersionParser $versionParser * @return CompletePackage */ private function buildComposerPackages(ChannelInfo $channelInfo, SemverVersionParser $versionParser) diff --git a/src/Composer/Util/Filesystem.php b/src/Composer/Util/Filesystem.php index 4b69a85c9..94044756e 100644 --- a/src/Composer/Util/Filesystem.php +++ b/src/Composer/Util/Filesystem.php @@ -607,7 +607,7 @@ class Filesystem /** * Returns whether the target directory is a Windows NTFS Junction. * - * @param string $junction Path to check. + * @param string $junction Path to check. * @return bool */ public function isJunction($junction) @@ -620,13 +620,14 @@ class Filesystem } // Junctions have no link stat but are otherwise indistinguishable from real directories $stat = lstat($junction); + return ($stat['mode'] === 0); } /** * Removes a Windows NTFS junction. * - * @param string $junction + * @param string $junction * @return bool */ public function removeJunction($junction) @@ -639,6 +640,7 @@ class Filesystem throw new IOException(sprintf('%s is not a junction and thus cannot be removed as one', $junction)); } $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape($junction)); + return ($this->getProcess()->execute($cmd, $output) === 0); } } diff --git a/src/Composer/Util/Platform.php b/src/Composer/Util/Platform.php index eafb88b7a..8939b9467 100644 --- a/src/Composer/Util/Platform.php +++ b/src/Composer/Util/Platform.php @@ -1,5 +1,6 @@ diff --git a/tests/Composer/Test/Package/Archiver/ZipArchiverTest.php b/tests/Composer/Test/Package/Archiver/ZipArchiverTest.php index ff556a507..3a498b674 100644 --- a/tests/Composer/Test/Package/Archiver/ZipArchiverTest.php +++ b/tests/Composer/Test/Package/Archiver/ZipArchiverTest.php @@ -16,7 +16,6 @@ use Composer\Package\Archiver\ZipArchiver; class ZipArchiverTest extends ArchiverTest { - public function testZipArchive() { if (!class_exists('ZipArchive')) { diff --git a/tests/Composer/Test/Util/PlatformTest.php b/tests/Composer/Test/Util/PlatformTest.php index 3d82fb96f..4cbe7ffe8 100644 --- a/tests/Composer/Test/Util/PlatformTest.php +++ b/tests/Composer/Test/Util/PlatformTest.php @@ -1,5 +1,6 @@