diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index fc5e55cfd..5f8e4477e 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -317,7 +317,7 @@ EOF; } } - if (preg_match('/\.phar$/', $path)){ + if (preg_match('/\.phar$/', $path)) { $baseDir = "'phar://' . " . $baseDir; } diff --git a/src/Composer/Autoload/ClassLoader.php b/src/Composer/Autoload/ClassLoader.php index ef9924516..1db8d9a0b 100644 --- a/src/Composer/Autoload/ClassLoader.php +++ b/src/Composer/Autoload/ClassLoader.php @@ -121,8 +121,8 @@ class ClassLoader /** * Registers a set of classes, replacing any others previously set. * - * @param string $prefix The classes prefix - * @param array|string $paths The location(s) of the classes + * @param string $prefix The classes prefix + * @param array|string $paths The location(s) of the classes */ public function set($prefix, $paths) { diff --git a/src/Composer/Autoload/ClassMapGenerator.php b/src/Composer/Autoload/ClassMapGenerator.php index 28ebf3346..f3b59c5aa 100644 --- a/src/Composer/Autoload/ClassMapGenerator.php +++ b/src/Composer/Autoload/ClassMapGenerator.php @@ -93,9 +93,9 @@ class ClassMapGenerator /** * Extract the classes in the given file * - * @param string $path The file to check + * @param string $path The file to check * @throws \RuntimeException - * @return array The found classes + * @return array The found classes */ private static function findClasses($path) { diff --git a/src/Composer/Cache.php b/src/Composer/Cache.php index 1253d72ce..260682d1a 100644 --- a/src/Composer/Cache.php +++ b/src/Composer/Cache.php @@ -66,6 +66,7 @@ class Cache if ($this->io->isDebug()) { $this->io->write('Reading '.$this->root . $file.' from cache'); } + return file_get_contents($this->root . $file); } @@ -80,6 +81,7 @@ class Cache if ($this->io->isDebug()) { $this->io->write('Writing '.$this->root . $file.' into cache'); } + return file_put_contents($this->root . $file, $contents); } @@ -98,6 +100,7 @@ class Cache if ($this->io->isDebug()) { $this->io->write('Writing '.$this->root . $file.' into cache'); } + return copy($source, $this->root . $file); } @@ -116,6 +119,7 @@ class Cache if ($this->io->isDebug()) { $this->io->write('Reading '.$this->root . $file.' from cache'); } + return copy($this->root . $file, $target); } diff --git a/src/Composer/Command/ArchiveCommand.php b/src/Composer/Command/ArchiveCommand.php index b56d06467..d7ed722df 100644 --- a/src/Composer/Command/ArchiveCommand.php +++ b/src/Composer/Command/ArchiveCommand.php @@ -115,6 +115,7 @@ EOT $io->write('Found an exact match '.$package->getPrettyString().'.'); } else { $io->write('Could not find a package matching '.$packageName.'.'); + return false; } diff --git a/src/Composer/Command/Command.php b/src/Composer/Command/Command.php index 3799dda04..6e91ff869 100644 --- a/src/Composer/Command/Command.php +++ b/src/Composer/Command/Command.php @@ -37,7 +37,7 @@ abstract class Command extends BaseCommand private $io; /** - * @param bool $required + * @param bool $required * @throws \RuntimeException * @return Composer */ diff --git a/src/Composer/Command/ConfigCommand.php b/src/Composer/Command/ConfigCommand.php index f447a70ba..a241b1426 100644 --- a/src/Composer/Command/ConfigCommand.php +++ b/src/Composer/Command/ConfigCommand.php @@ -284,6 +284,7 @@ EOT if ('stash' === $val) { return 'stash'; } + return $val !== 'false' && (bool) $val; } ), diff --git a/src/Composer/Command/DumpAutoloadCommand.php b/src/Composer/Command/DumpAutoloadCommand.php index e3687899e..4855a409d 100755 --- a/src/Composer/Command/DumpAutoloadCommand.php +++ b/src/Composer/Command/DumpAutoloadCommand.php @@ -14,9 +14,7 @@ namespace Composer\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; -use Composer\Repository\CompositeRepository; use Symfony\Component\Console\Output\OutputInterface; -use Composer\Autoload\AutoloadGenerator; /** * @author Jordi Boggiano diff --git a/src/Composer/Command/SearchCommand.php b/src/Composer/Command/SearchCommand.php index e3aee3744..a212eb329 100644 --- a/src/Composer/Command/SearchCommand.php +++ b/src/Composer/Command/SearchCommand.php @@ -19,8 +19,6 @@ use Symfony\Component\Console\Output\OutputInterface; use Composer\Repository\CompositeRepository; use Composer\Repository\PlatformRepository; use Composer\Repository\RepositoryInterface; -use Composer\Package\CompletePackageInterface; -use Composer\Package\AliasPackage; use Composer\Factory; /** diff --git a/src/Composer/Command/SelfUpdateCommand.php b/src/Composer/Command/SelfUpdateCommand.php index 5358af43a..07ed9eae1 100644 --- a/src/Composer/Command/SelfUpdateCommand.php +++ b/src/Composer/Command/SelfUpdateCommand.php @@ -44,16 +44,16 @@ EOT { $localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0]; $tempFilename = dirname($localFilename) . '/' . basename($localFilename, '.phar').'-temp.phar'; - + // check for permissions in local filesystem before start connection process if (!is_writable($tempDirectory = dirname($tempFilename))) { throw new FilesystemException('Composer update failed: the "'.$tempDirectory.'" directory used to download the temp file could not be written'); } - + if (!is_writable($localFilename)) { throw new FilesystemException('Composer update failed: the "'.$localFilename. '" file could not be written'); } - + $protocol = extension_loaded('openssl') ? 'https' : 'http'; $rfs = new RemoteFilesystem($this->getIO()); $latest = trim($rfs->getContents('getcomposer.org', $protocol . '://getcomposer.org/version', false)); @@ -61,7 +61,7 @@ EOT if (Composer::VERSION !== $latest) { $output->writeln(sprintf("Updating to version %s.", $latest)); - $remoteFilename = $protocol . '://getcomposer.org/composer.phar'; + $remoteFilename = $protocol . '://getcomposer.org/composer.phar'; $rfs->copy('getcomposer.org', $remoteFilename, $tempFilename); diff --git a/src/Composer/Command/ShowCommand.php b/src/Composer/Command/ShowCommand.php index 6124d30d7..a54de99c7 100644 --- a/src/Composer/Command/ShowCommand.php +++ b/src/Composer/Command/ShowCommand.php @@ -17,7 +17,6 @@ use Composer\DependencyResolver\Pool; use Composer\DependencyResolver\DefaultPolicy; use Composer\Factory; use Composer\Package\CompletePackageInterface; -use Composer\Package\LinkConstraint\VersionConstraint; use Composer\Package\Version\VersionParser; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputArgument; diff --git a/src/Composer/Config.php b/src/Composer/Config.php index f48d95f9b..c704c34a2 100644 --- a/src/Composer/Config.php +++ b/src/Composer/Config.php @@ -122,7 +122,7 @@ class Config /** * Returns a setting * - * @param string $key + * @param string $key * @throws \RuntimeException * @return mixed */ diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index c20c5b3b9..424d9d3df 100755 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -142,7 +142,7 @@ class Application extends BaseApplication } /** - * @param bool $required + * @param bool $required * @throws JsonValidationException * @return \Composer\Composer */ diff --git a/src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php b/src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php index c0cc3b034..c901bd190 100644 --- a/src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php +++ b/src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php @@ -27,7 +27,7 @@ class MarkAliasInstalledOperation extends SolverOperation * Initializes operation. * * @param AliasPackage $package package instance - * @param string $reason operation reason + * @param string $reason operation reason */ public function __construct(AliasPackage $package, $reason = null) { diff --git a/src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.php b/src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.php index a281b953e..56f7ac19b 100644 --- a/src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.php +++ b/src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.php @@ -27,7 +27,7 @@ class MarkAliasUninstalledOperation extends SolverOperation * Initializes operation. * * @param AliasPackage $package package instance - * @param string $reason operation reason + * @param string $reason operation reason */ public function __construct(AliasPackage $package, $reason = null) { diff --git a/src/Composer/DependencyResolver/Problem.php b/src/Composer/DependencyResolver/Problem.php index 655bed732..ac4541eb6 100644 --- a/src/Composer/DependencyResolver/Problem.php +++ b/src/Composer/DependencyResolver/Problem.php @@ -66,7 +66,7 @@ class Problem /** * A human readable textual representation of the problem's reasons * - * @param array $installedMap A map of all installed packages + * @param array $installedMap A map of all installed packages * @return string */ public function getPrettyString(array $installedMap = array()) diff --git a/src/Composer/Downloader/DownloadManager.php b/src/Composer/Downloader/DownloadManager.php index 6d16727a9..344d58a19 100644 --- a/src/Composer/Downloader/DownloadManager.php +++ b/src/Composer/Downloader/DownloadManager.php @@ -43,7 +43,7 @@ class DownloadManager /** * Makes downloader prefer source installation over the dist. * - * @param bool $preferSource prefer downloading from source + * @param bool $preferSource prefer downloading from source * @return DownloadManager */ public function setPreferSource($preferSource) @@ -56,7 +56,7 @@ class DownloadManager /** * Makes downloader prefer dist installation over the source. * - * @param bool $preferDist prefer downloading from dist + * @param bool $preferDist prefer downloading from dist * @return DownloadManager */ public function setPreferDist($preferDist) @@ -85,8 +85,8 @@ class DownloadManager /** * Sets installer downloader for a specific installation type. * - * @param string $type installation type - * @param DownloaderInterface $downloader downloader instance + * @param string $type installation type + * @param DownloaderInterface $downloader downloader instance * @return DownloadManager */ public function setDownloader($type, DownloaderInterface $downloader) diff --git a/src/Composer/Downloader/FilesystemException.php b/src/Composer/Downloader/FilesystemException.php index 9829b7d4a..2e5c6b48d 100644 --- a/src/Composer/Downloader/FilesystemException.php +++ b/src/Composer/Downloader/FilesystemException.php @@ -14,7 +14,7 @@ namespace Composer\Downloader; /** * Exception thrown when issues exist on local filesystem - * + * * @author Javier Spagnoletti */ class FilesystemException extends \Exception diff --git a/src/Composer/Downloader/GitDownloader.php b/src/Composer/Downloader/GitDownloader.php index 939688d7d..590d43068 100644 --- a/src/Composer/Downloader/GitDownloader.php +++ b/src/Composer/Downloader/GitDownloader.php @@ -268,10 +268,10 @@ class GitDownloader extends VcsDownloader /** * Runs a command doing attempts for each protocol supported by github. * - * @param callable $commandCallable A callable building the command for the given url - * @param string $url - * @param string $cwd - * @param bool $initialClone If true, the directory if cleared between every attempt + * @param callable $commandCallable A callable building the command for the given url + * @param string $url + * @param string $cwd + * @param bool $initialClone If true, the directory if cleared between every attempt * @throws \InvalidArgumentException * @throws \RuntimeException */ diff --git a/src/Composer/Downloader/SvnDownloader.php b/src/Composer/Downloader/SvnDownloader.php index 5d9bcdf5d..5f47c7b5f 100644 --- a/src/Composer/Downloader/SvnDownloader.php +++ b/src/Composer/Downloader/SvnDownloader.php @@ -63,11 +63,11 @@ class SvnDownloader extends VcsDownloader * Execute an SVN command and try to fix up the process with credentials * if necessary. * - * @param string $baseUrl Base URL of the repository - * @param string $command SVN command to run - * @param string $url SVN url - * @param string $cwd Working directory - * @param string $path Target for a checkout + * @param string $baseUrl Base URL of the repository + * @param string $command SVN command to run + * @param string $url SVN url + * @param string $cwd Working directory + * @param string $path Target for a checkout * @throws \RuntimeException * @return string */ diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php index 82c785f71..c8e854e3e 100644 --- a/src/Composer/Factory.php +++ b/src/Composer/Factory.php @@ -328,8 +328,8 @@ class Factory } /** - * @param Config $config The configuration - * @param Downloader\DownloadManager $dm Manager use to download sources + * @param Config $config The configuration + * @param Downloader\DownloadManager $dm Manager use to download sources * * @return Archiver\ArchiveManager */ diff --git a/src/Composer/IO/BufferIO.php b/src/Composer/IO/BufferIO.php index 1d6ee1c65..fc675ce70 100644 --- a/src/Composer/IO/BufferIO.php +++ b/src/Composer/IO/BufferIO.php @@ -23,8 +23,8 @@ use Symfony\Component\Console\Helper\HelperSet; class BufferIO extends ConsoleIO { /** - * @param string $input - * @param int $verbosity + * @param string $input + * @param int $verbosity * @param OutputFormatterInterface $formatter */ public function __construct($input = '', $verbosity = null, OutputFormatterInterface $formatter = null) diff --git a/src/Composer/IO/IOInterface.php b/src/Composer/IO/IOInterface.php index 9cb8b42dc..168e47a77 100644 --- a/src/Composer/IO/IOInterface.php +++ b/src/Composer/IO/IOInterface.php @@ -104,7 +104,7 @@ interface IOInterface * * @param string|array $question The question to ask * @param callback $validator A PHP callback - * @param bool|integer $attempts Max number of times to ask before giving up (false by default, which means infinite) + * @param bool|integer $attempts Max number of times to ask before giving up (false by default, which means infinite) * @param string $default The default answer if none is given by the user * * @return mixed diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 5b5b82970..ab937e47e 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -742,7 +742,8 @@ class Installer return false; } - private function extractPlatformRequirements($links) { + private function extractPlatformRequirements($links) + { $platformReqs = array(); foreach ($links as $link) { if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) { @@ -857,8 +858,8 @@ class Installer /** * Create Installer * - * @param IOInterface $io - * @param Composer $composer + * @param IOInterface $io + * @param Composer $composer * @return Installer */ public static function create(IOInterface $io, Composer $composer) diff --git a/src/Composer/Installer/InstallerInstaller.php b/src/Composer/Installer/InstallerInstaller.php index 5a41d4e96..a4386c684 100644 --- a/src/Composer/Installer/InstallerInstaller.php +++ b/src/Composer/Installer/InstallerInstaller.php @@ -15,7 +15,6 @@ namespace Composer\Installer; use Composer\Composer; use Composer\Package\Package; use Composer\IO\IOInterface; -use Composer\Autoload\AutoloadGenerator; use Composer\Repository\InstalledRepositoryInterface; use Composer\Package\PackageInterface; diff --git a/src/Composer/Installer/LibraryInstaller.php b/src/Composer/Installer/LibraryInstaller.php index b4938f848..6984ad918 100644 --- a/src/Composer/Installer/LibraryInstaller.php +++ b/src/Composer/Installer/LibraryInstaller.php @@ -140,12 +140,14 @@ class LibraryInstaller implements InstallerInterface public function getInstallPath(PackageInterface $package) { $targetDir = $package->getTargetDir(); + return $this->getPackageBasePath($package) . ($targetDir ? '/'.$targetDir : ''); } protected function getPackageBasePath(PackageInterface $package) { $this->initializeVendorDir(); + return ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName(); } diff --git a/src/Composer/Json/JsonFile.php b/src/Composer/Json/JsonFile.php index a011f6b1f..f7e1a2126 100755 --- a/src/Composer/Json/JsonFile.php +++ b/src/Composer/Json/JsonFile.php @@ -40,8 +40,8 @@ class JsonFile /** * Initializes json file reader/parser. * - * @param string $path path to a lockfile - * @param RemoteFilesystem $rfs required for loading http/https json files + * @param string $path path to a lockfile + * @param RemoteFilesystem $rfs required for loading http/https json files * @throws \InvalidArgumentException */ public function __construct($path, RemoteFilesystem $rfs = null) @@ -98,8 +98,8 @@ class JsonFile /** * Writes json file. * - * @param array $hash writes hash into json file - * @param int $options json_encode options (defaults to JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) + * @param array $hash writes hash into json file + * @param int $options json_encode options (defaults to JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) * @throws \UnexpectedValueException */ public function write(array $hash, $options = 448) @@ -123,8 +123,8 @@ class JsonFile /** * Validates the schema of the current json file according to composer-schema.json rules * - * @param int $schema a JsonFile::*_SCHEMA constant - * @return bool true on success + * @param int $schema a JsonFile::*_SCHEMA constant + * @return bool true on success * @throws JsonValidationException */ public function validateSchema($schema = self::STRICT_SCHEMA) diff --git a/src/Composer/Package/Archiver/ArchivableFilesFinder.php b/src/Composer/Package/Archiver/ArchivableFilesFinder.php index 451265b8b..f6cadbe21 100644 --- a/src/Composer/Package/Archiver/ArchivableFilesFinder.php +++ b/src/Composer/Package/Archiver/ArchivableFilesFinder.php @@ -12,8 +12,6 @@ namespace Composer\Package\Archiver; -use Composer\Package\BasePackage; -use Composer\Package\PackageInterface; use Composer\Util\Filesystem; use Symfony\Component\Finder; @@ -36,8 +34,8 @@ class ArchivableFilesFinder extends \FilterIterator /** * Initializes the internal Symfony Finder with appropriate filters * - * @param string $sources Path to source files to be archived - * @param array $excludes Composer's own exclude rules from composer.json + * @param string $sources Path to source files to be archived + * @param array $excludes Composer's own exclude rules from composer.json */ public function __construct($sources, array $excludes) { @@ -64,6 +62,7 @@ class ArchivableFilesFinder extends \FilterIterator foreach ($filters as $filter) { $exclude = $filter->filter($relativePath, $exclude); } + return !$exclude; }; diff --git a/src/Composer/Package/Archiver/ArchiveManager.php b/src/Composer/Package/Archiver/ArchiveManager.php index b691c05a5..be1d66bb8 100644 --- a/src/Composer/Package/Archiver/ArchiveManager.php +++ b/src/Composer/Package/Archiver/ArchiveManager.php @@ -13,8 +13,6 @@ namespace Composer\Package\Archiver; use Composer\Downloader\DownloadManager; -use Composer\Factory; -use Composer\IO\NullIO; use Composer\Package\PackageInterface; use Composer\Package\RootPackage; use Composer\Util\Filesystem; @@ -60,6 +58,7 @@ class ArchiveManager public function setOverwriteFiles($overwriteFiles) { $this->overwriteFiles = $overwriteFiles; + return $this; } @@ -92,12 +91,12 @@ class ArchiveManager /** * Create an archive of the specified package. * - * @param PackageInterface $package The package to archive - * @param string $format The format of the archive (zip, tar, ...) - * @param string $targetDir The diretory where to build the archive + * @param PackageInterface $package The package to archive + * @param string $format The format of the archive (zip, tar, ...) + * @param string $targetDir The diretory where to build the archive * @throws \InvalidArgumentException * @throws \RuntimeException - * @return string The path of the created archive + * @return string The path of the created archive */ public function archive(PackageInterface $package, $format, $targetDir) { diff --git a/src/Composer/Package/Archiver/ArchiverInterface.php b/src/Composer/Package/Archiver/ArchiverInterface.php index 5858c6892..72a06c1c9 100644 --- a/src/Composer/Package/Archiver/ArchiverInterface.php +++ b/src/Composer/Package/Archiver/ArchiverInterface.php @@ -12,8 +12,6 @@ namespace Composer\Package\Archiver; -use Composer\Package\PackageInterface; - /** * @author Till Klampaeckel * @author Matthieu Moquet @@ -24,10 +22,10 @@ interface ArchiverInterface /** * Create an archive from the sources. * - * @param string $sources The sources directory - * @param string $target The target file - * @param string $format The format used for archive - * @param array $excludes A list of patterns for files to exclude + * @param string $sources The sources directory + * @param string $target The target file + * @param string $format The format used for archive + * @param array $excludes A list of patterns for files to exclude * * @return string The path to the written archive file */ diff --git a/src/Composer/Package/Archiver/BaseExcludeFilter.php b/src/Composer/Package/Archiver/BaseExcludeFilter.php index e52e02af7..bba2003a8 100644 --- a/src/Composer/Package/Archiver/BaseExcludeFilter.php +++ b/src/Composer/Package/Archiver/BaseExcludeFilter.php @@ -44,7 +44,7 @@ abstract class BaseExcludeFilter * Negated patterns overwrite exclude decisions of previous filters. * * @param string $relativePath The file's path relative to the sourcePath - * @param bool $exclude Whether a previous filter wants to exclude this file + * @param bool $exclude Whether a previous filter wants to exclude this file * * @return bool Whether the file should be excluded */ @@ -63,13 +63,14 @@ abstract class BaseExcludeFilter $exclude = !$negate; } } + return $exclude; } /** * Processes a file containing exclude rules of different formats per line * - * @param array $lines A set of lines to be parsed + * @param array $lines A set of lines to be parsed * @param callback $lineParser The parser to be used on each line * * @return array Exclude patterns to be used in filter() @@ -89,6 +90,7 @@ abstract class BaseExcludeFilter if ($line) { return call_user_func($lineParser, $line); } + return null; }, $lines), function ($pattern) { @@ -110,6 +112,7 @@ abstract class BaseExcludeFilter foreach ($rules as $rule) { $patterns[] = $this->generatePattern($rule); } + return $patterns; } @@ -138,6 +141,7 @@ abstract class BaseExcludeFilter } $pattern .= substr(Finder\Glob::toRegex($rule), 2, -2); + return array($pattern . '#', $negate, false); } } diff --git a/src/Composer/Package/Archiver/ComposerExcludeFilter.php b/src/Composer/Package/Archiver/ComposerExcludeFilter.php index c98a3ae66..9e663869c 100644 --- a/src/Composer/Package/Archiver/ComposerExcludeFilter.php +++ b/src/Composer/Package/Archiver/ComposerExcludeFilter.php @@ -20,8 +20,8 @@ namespace Composer\Package\Archiver; class ComposerExcludeFilter extends BaseExcludeFilter { /** - * @param string $sourcePath Directory containing sources to be filtered - * @param array $excludeRules An array of exclude rules from composer.json + * @param string $sourcePath Directory containing sources to be filtered + * @param array $excludeRules An array of exclude rules from composer.json */ public function __construct($sourcePath, array $excludeRules) { diff --git a/src/Composer/Package/Archiver/HgExcludeFilter.php b/src/Composer/Package/Archiver/HgExcludeFilter.php index b2e843f75..fa2327c5f 100644 --- a/src/Composer/Package/Archiver/HgExcludeFilter.php +++ b/src/Composer/Package/Archiver/HgExcludeFilter.php @@ -64,6 +64,7 @@ class HgExcludeFilter extends BaseExcludeFilter } else { $this->patternMode = self::HG_IGNORE_REGEX; } + return null; } @@ -85,6 +86,7 @@ class HgExcludeFilter extends BaseExcludeFilter { $pattern = '#'.substr(Finder\Glob::toRegex($line), 2, -1).'#'; $pattern = str_replace('[^/]*', '.*', $pattern); + return array($pattern, false, true); } @@ -99,6 +101,7 @@ class HgExcludeFilter extends BaseExcludeFilter { // WTF need to escape the delimiter safely $pattern = '#'.preg_replace('/((?:\\\\\\\\)*)(\\\\?)#/', '\1\2\2\\#', $line).'#'; + return array($pattern, false, true); } } diff --git a/src/Composer/Package/Archiver/PharArchiver.php b/src/Composer/Package/Archiver/PharArchiver.php index bd8f5c292..75b9843f3 100644 --- a/src/Composer/Package/Archiver/PharArchiver.php +++ b/src/Composer/Package/Archiver/PharArchiver.php @@ -12,9 +12,6 @@ namespace Composer\Package\Archiver; -use Composer\Package\BasePackage; -use Composer\Package\PackageInterface; - /** * @author Till Klampaeckel * @author Nils Adermann @@ -43,6 +40,7 @@ class PharArchiver implements ArchiverInterface $phar = new \PharData($target, null, null, static::$formats[$format]); $files = new ArchivableFilesFinder($sources, $excludes); $phar->buildFromIterator($files, $sources); + return $target; } catch (\UnexpectedValueException $e) { $message = sprintf("Could not create archive '%s' from '%s': %s", diff --git a/src/Composer/Package/LinkConstraint/VersionConstraint.php b/src/Composer/Package/LinkConstraint/VersionConstraint.php index 096e6e833..0e8a8c3b7 100644 --- a/src/Composer/Package/LinkConstraint/VersionConstraint.php +++ b/src/Composer/Package/LinkConstraint/VersionConstraint.php @@ -61,8 +61,8 @@ class VersionConstraint extends SpecificConstraint } /** - * @param VersionConstraint $provider - * @param bool $compareBranches + * @param VersionConstraint $provider + * @param bool $compareBranches * @return bool */ public function matchSpecific(VersionConstraint $provider, $compareBranches = false) diff --git a/src/Composer/Package/Locker.php b/src/Composer/Package/Locker.php index 8e8d994f9..13b08e260 100644 --- a/src/Composer/Package/Locker.php +++ b/src/Composer/Package/Locker.php @@ -123,7 +123,7 @@ class Locker /** * Returns the platform requirements stored in the lock file * - * @param bool $withDevReqs if true, the platform requirements from the require-dev block are also returned + * @param bool $withDevReqs if true, the platform requirements from the require-dev block are also returned * @return \Composer\Package\Link[] */ public function getPlatformRequirements($withDevReqs = false) @@ -306,7 +306,7 @@ class Locker * Returns the packages's datetime for its source reference. * * @param PackageInterface $package The package to scan. - * @return string|null The formatted datetime or null if none was found. + * @return string|null The formatted datetime or null if none was found. */ private function getPackageTime(PackageInterface $package) { diff --git a/src/Composer/Package/RootAliasPackage.php b/src/Composer/Package/RootAliasPackage.php index ef717d0a8..a16e0e914 100644 --- a/src/Composer/Package/RootAliasPackage.php +++ b/src/Composer/Package/RootAliasPackage.php @@ -12,9 +12,6 @@ namespace Composer\Package; -use Composer\Package\LinkConstraint\VersionConstraint; -use Composer\Package\Version\VersionParser; - /** * @author Jordi Boggiano */ diff --git a/src/Composer/Package/Version/VersionParser.php b/src/Composer/Package/Version/VersionParser.php index c03ac3507..470fd8f75 100644 --- a/src/Composer/Package/Version/VersionParser.php +++ b/src/Composer/Package/Version/VersionParser.php @@ -86,8 +86,8 @@ class VersionParser /** * Normalizes a version string to be able to perform comparisons on it * - * @param string $version - * @param string $fullVersion optional complete version string to give more context + * @param string $version + * @param string $fullVersion optional complete version string to give more context * @throws \UnexpectedValueException * @return array */ diff --git a/src/Composer/Repository/Pear/ChannelRest10Reader.php b/src/Composer/Repository/Pear/ChannelRest10Reader.php index d96d89155..5b5fd7828 100644 --- a/src/Composer/Repository/Pear/ChannelRest10Reader.php +++ b/src/Composer/Repository/Pear/ChannelRest10Reader.php @@ -108,7 +108,7 @@ class ChannelRest10Reader extends BaseChannelReader * @param $baseUrl string * @param $packageName string * @throws \Composer\Downloader\TransportException|\Exception - * @return ReleaseInfo[] hash array with keys as version numbers + * @return ReleaseInfo[] hash array with keys as version numbers */ private function readPackageReleases($baseUrl, $packageName) { diff --git a/src/Composer/Repository/RepositoryInterface.php b/src/Composer/Repository/RepositoryInterface.php index c38b00653..0d6c50414 100644 --- a/src/Composer/Repository/RepositoryInterface.php +++ b/src/Composer/Repository/RepositoryInterface.php @@ -65,8 +65,8 @@ interface RepositoryInterface extends \Countable /** * Searches the repository for packages containing the query * - * @param string $query search query - * @param int $mode a set of SEARCH_* constants to search on, implementations should do a best effort only + * @param string $query search query + * @param int $mode a set of SEARCH_* constants to search on, implementations should do a best effort only * @return array[] an array of array('name' => '...', 'description' => '...') */ public function search($query, $mode = 0); diff --git a/src/Composer/Repository/RepositoryManager.php b/src/Composer/Repository/RepositoryManager.php index bff561fd6..ed915707f 100644 --- a/src/Composer/Repository/RepositoryManager.php +++ b/src/Composer/Repository/RepositoryManager.php @@ -85,8 +85,8 @@ class RepositoryManager /** * Returns a new repository for a specific installation type. * - * @param string $type repository type - * @param string $config repository configuration + * @param string $type repository type + * @param string $config repository configuration * @return RepositoryInterface * @throws \InvalidArgumentException if repository for provided type is not registered */ diff --git a/src/Composer/Repository/RepositorySecurityException.php b/src/Composer/Repository/RepositorySecurityException.php index ea13b9465..b115d9cbe 100644 --- a/src/Composer/Repository/RepositorySecurityException.php +++ b/src/Composer/Repository/RepositorySecurityException.php @@ -19,4 +19,4 @@ namespace Composer\Repository; */ class RepositorySecurityException extends \Exception { -} \ No newline at end of file +} diff --git a/src/Composer/Repository/Vcs/SvnDriver.php b/src/Composer/Repository/Vcs/SvnDriver.php index 4ac8503a7..b979c2e4b 100644 --- a/src/Composer/Repository/Vcs/SvnDriver.php +++ b/src/Composer/Repository/Vcs/SvnDriver.php @@ -289,8 +289,8 @@ class SvnDriver extends VcsDriver * Execute an SVN command and try to fix up the process with credentials * if necessary. * - * @param string $command The svn command to run. - * @param string $url The SVN URL. + * @param string $command The svn command to run. + * @param string $url The SVN URL. * @throws \RuntimeException * @return string */ @@ -316,8 +316,8 @@ class SvnDriver extends VcsDriver /** * Build the identifier respecting "package-path" config option * - * @param string $baseDir The path to trunk/branch/tag - * @param int $revision The revision mark to add to identifier + * @param string $baseDir The path to trunk/branch/tag + * @param int $revision The revision mark to add to identifier * * @return string */ @@ -326,4 +326,3 @@ class SvnDriver extends VcsDriver return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision; } } - diff --git a/src/Composer/Repository/Vcs/VcsDriver.php b/src/Composer/Repository/Vcs/VcsDriver.php index 686975c5f..31b858089 100644 --- a/src/Composer/Repository/Vcs/VcsDriver.php +++ b/src/Composer/Repository/Vcs/VcsDriver.php @@ -44,13 +44,13 @@ abstract class VcsDriver implements VcsDriverInterface */ final public function __construct(array $repoConfig, IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null) { - + if (self::isLocalUrl($repoConfig['url'])) { $repoConfig['url'] = realpath( preg_replace('/^file:\/\//', '', $repoConfig['url']) ); } - + $this->url = $repoConfig['url']; $this->originUrl = $repoConfig['url']; $this->repoConfig = $repoConfig; diff --git a/src/Composer/Script/EventDispatcher.php b/src/Composer/Script/EventDispatcher.php index e804b4edf..47a9cf54a 100644 --- a/src/Composer/Script/EventDispatcher.php +++ b/src/Composer/Script/EventDispatcher.php @@ -12,7 +12,6 @@ namespace Composer\Script; -use Composer\Autoload\AutoloadGenerator; use Composer\IO\IOInterface; use Composer\Composer; use Composer\DependencyResolver\Operation\OperationInterface; @@ -54,8 +53,8 @@ class EventDispatcher /** * Dispatch a script event. * - * @param string $eventName The constant in ScriptEvents - * @param Event $event + * @param string $eventName The constant in ScriptEvents + * @param Event $event */ public function dispatch($eventName, Event $event = null) { @@ -92,7 +91,7 @@ class EventDispatcher /** * Triggers the listeners of an event. * - * @param Event $event The event object to pass to the event handlers/listeners. + * @param Event $event The event object to pass to the event handlers/listeners. * @throws \RuntimeException * @throws \Exception */ diff --git a/src/Composer/Util/Filesystem.php b/src/Composer/Util/Filesystem.php index 805e2680c..475e77a6e 100644 --- a/src/Composer/Util/Filesystem.php +++ b/src/Composer/Util/Filesystem.php @@ -191,9 +191,9 @@ class Filesystem /** * Returns the shortest path from $from to $to * - * @param string $from - * @param string $to - * @param bool $directories if true, the source/target are considered to be directories + * @param string $from + * @param string $to + * @param bool $directories if true, the source/target are considered to be directories * @throws \InvalidArgumentException * @return string */ @@ -233,9 +233,9 @@ class Filesystem /** * Returns PHP code that, when executed in $from, will return the path to $to * - * @param string $from - * @param string $to - * @param bool $directories if true, the source/target are considered to be directories + * @param string $from + * @param string $to + * @param bool $directories if true, the source/target are considered to be directories * @throws \InvalidArgumentException * @return string */ @@ -287,7 +287,7 @@ class Filesystem * Returns size of a file or directory specified by path. If a directory is * given, it's size will be computed recursively. * - * @param string $path Path to the file or directory + * @param string $path Path to the file or directory * @throws \RuntimeException * @return int */ @@ -307,7 +307,7 @@ class Filesystem * Normalize a path. This replaces backslashes with slashes, removes ending * slash and collapses redundant separators and up-level references. * - * @param string $path Path to the file or directory + * @param string $path Path to the file or directory * @return string */ public function normalizePath($path) diff --git a/src/Composer/Util/GitHub.php b/src/Composer/Util/GitHub.php index 42b791283..93894cc76 100644 --- a/src/Composer/Util/GitHub.php +++ b/src/Composer/Util/GitHub.php @@ -68,11 +68,11 @@ class GitHub /** * Authorizes a GitHub domain interactively via OAuth * - * @param string $originUrl The host this GitHub instance is located at - * @param string $message The reason this authorization is required + * @param string $originUrl The host this GitHub instance is located at + * @param string $message The reason this authorization is required * @throws \RuntimeException - * @throws \Composer\Downloader\TransportException|\Exception - * @return bool true on success + * @throws TransportException|\Exception + * @return bool true on success */ public function authorizeOAuthInteractively($originUrl, $message = null) { diff --git a/src/Composer/Util/RemoteFilesystem.php b/src/Composer/Util/RemoteFilesystem.php index ca66fa9c6..25ef08a61 100644 --- a/src/Composer/Util/RemoteFilesystem.php +++ b/src/Composer/Util/RemoteFilesystem.php @@ -86,7 +86,7 @@ class RemoteFilesystem * @param boolean $progress Display the progression * * @throws TransportException|\Exception - * @throws TransportException When the file could not be downloaded + * @throws TransportException When the file could not be downloaded * * @return bool|string */ @@ -210,12 +210,12 @@ class RemoteFilesystem /** * Get notification action. * - * @param integer $notificationCode The notification code - * @param integer $severity The severity level - * @param string $message The message - * @param integer $messageCode The message code - * @param integer $bytesTransferred The loaded size - * @param integer $bytesMax The total size + * @param integer $notificationCode The notification code + * @param integer $severity The severity level + * @param string $message The message + * @param integer $messageCode The message code + * @param integer $bytesTransferred The loaded size + * @param integer $bytesMax The total size * @throws TransportException */ protected function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax) diff --git a/src/bootstrap.php b/src/bootstrap.php index 787af1ef4..338b3cce4 100644 --- a/src/bootstrap.php +++ b/src/bootstrap.php @@ -12,7 +12,7 @@ function includeIfExists($file) { - return file_exists($file)===true ? include $file : false; + return file_exists($file) ? include $file : false; } if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) { diff --git a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php index bde4b5ecb..9f54c3791 100644 --- a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php +++ b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php @@ -67,6 +67,7 @@ class AutoloadGeneratorTest extends TestCase ->method('getInstallPath') ->will($this->returnCallback(function ($package) use ($that) { $targetDir = $package->getTargetDir(); + return $that->vendorDir.'/'.$package->getName() . ($targetDir ? '/'.$targetDir : ''); })); $this->repository = $this->getMock('Composer\Repository\InstalledRepositoryInterface'); @@ -697,6 +698,7 @@ EOF; ->method('getInstallPath') ->will($this->returnCallback(function ($package) use ($vendorDir) { $targetDir = $package->getTargetDir(); + return $vendorDir.'/'.$package->getName() . ($targetDir ? '/'.$targetDir : ''); })); diff --git a/tests/Composer/Test/Command/InitCommandTest.php b/tests/Composer/Test/Command/InitCommandTest.php index 6aa042c21..1794d1b77 100644 --- a/tests/Composer/Test/Command/InitCommandTest.php +++ b/tests/Composer/Test/Command/InitCommandTest.php @@ -17,7 +17,7 @@ use Composer\Test\TestCase; class InitCommandTest extends TestCase { - function testParseValidAuthorString() + public function testParseValidAuthorString() { $command = new InitCommand; $author = $command->parseAuthorString('John Smith '); @@ -25,14 +25,14 @@ class InitCommandTest extends TestCase $this->assertEquals('john@example.com', $author['email']); } - function testParseEmptyAuthorString() + public function testParseEmptyAuthorString() { $command = new InitCommand; $this->setExpectedException('InvalidArgumentException'); $command->parseAuthorString(''); } - function testParseAuthorStringWithInvalidEmail() + public function testParseAuthorStringWithInvalidEmail() { $command = new InitCommand; $this->setExpectedException('InvalidArgumentException'); diff --git a/tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php b/tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php index 4891aa3a6..83c3de0b6 100644 --- a/tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php +++ b/tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php @@ -13,9 +13,7 @@ namespace Composer\Test\Package\Archiver; use Composer\Factory; -use Composer\IO\NullIO; use Composer\Package\Archiver; -use Composer\Package\Archiver\ArchiveManager; use Composer\Package\PackageInterface; class ArchiveManagerTest extends ArchiverTest diff --git a/tests/Composer/Test/Package/LockerTest.php b/tests/Composer/Test/Package/LockerTest.php index 09d31439f..b911d3de9 100644 --- a/tests/Composer/Test/Package/LockerTest.php +++ b/tests/Composer/Test/Package/LockerTest.php @@ -13,7 +13,6 @@ namespace Composer\Test\Package; use Composer\Package\Locker; -use Composer\Package\CompletePackage; class LockerTest extends \PHPUnit_Framework_TestCase {