diff --git a/src/Composer/Autoload/ClassMapGenerator.php b/src/Composer/Autoload/ClassMapGenerator.php index c291f4eef..28ebf3346 100644 --- a/src/Composer/Autoload/ClassMapGenerator.php +++ b/src/Composer/Autoload/ClassMapGenerator.php @@ -94,7 +94,7 @@ class ClassMapGenerator * Extract the classes in the given file * * @param string $path The file to check - * + * @throws \RuntimeException * @return array The found classes */ private static function findClasses($path) diff --git a/src/Composer/Command/Command.php b/src/Composer/Command/Command.php index 849f83778..3799dda04 100644 --- a/src/Composer/Command/Command.php +++ b/src/Composer/Command/Command.php @@ -38,6 +38,7 @@ abstract class Command extends BaseCommand /** * @param bool $required + * @throws \RuntimeException * @return Composer */ public function getComposer($required = true) diff --git a/src/Composer/Config.php b/src/Composer/Config.php index a5d9caca2..f48d95f9b 100644 --- a/src/Composer/Config.php +++ b/src/Composer/Config.php @@ -123,6 +123,7 @@ class Config * Returns a setting * * @param string $key + * @throws \RuntimeException * @return mixed */ public function get($key) diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index d68778c47..c20c5b3b9 100755 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -143,6 +143,7 @@ class Application extends BaseApplication /** * @param bool $required + * @throws JsonValidationException * @return \Composer\Composer */ public function getComposer($required = true) diff --git a/src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php b/src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php index 4e8c81874..c0cc3b034 100644 --- a/src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php +++ b/src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php @@ -26,7 +26,7 @@ class MarkAliasInstalledOperation extends SolverOperation /** * Initializes operation. * - * @param PackageInterface $package package instance + * @param AliasPackage $package package instance * @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 5585011b3..a281b953e 100644 --- a/src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.php +++ b/src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.php @@ -26,7 +26,7 @@ class MarkAliasUninstalledOperation extends SolverOperation /** * Initializes operation. * - * @param PackageInterface $package package instance + * @param AliasPackage $package package instance * @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 34374f6eb..8218a0a11 100644 --- a/src/Composer/DependencyResolver/Problem.php +++ b/src/Composer/DependencyResolver/Problem.php @@ -12,6 +12,8 @@ namespace Composer\DependencyResolver; +use Composer\Package\Link; + /** * Represents a problem detected while solving dependencies * @@ -67,6 +69,7 @@ class Problem * A human readable textual representation of the problem's reasons * * @param array $installedMap A map of all installed packages + * @return string */ public function getPrettyString(array $installedMap = array()) { diff --git a/src/Composer/DependencyResolver/RuleWatchGraph.php b/src/Composer/DependencyResolver/RuleWatchGraph.php index 59c2d6ef5..627a66eb3 100644 --- a/src/Composer/DependencyResolver/RuleWatchGraph.php +++ b/src/Composer/DependencyResolver/RuleWatchGraph.php @@ -127,9 +127,9 @@ class RuleWatchGraph * * The rule node's watched literals are updated accordingly. * - * @param $fromLiteral A literal the node used to watch - * @param $toLiteral A literal the node should watch now - * @param $node The rule node to be moved + * @param $fromLiteral mixed A literal the node used to watch + * @param $toLiteral mixed A literal the node should watch now + * @param $node mixed The rule node to be moved */ protected function moveWatch($fromLiteral, $toLiteral, $node) { diff --git a/src/Composer/Downloader/DownloadManager.php b/src/Composer/Downloader/DownloadManager.php index e52212f76..6d16727a9 100644 --- a/src/Composer/Downloader/DownloadManager.php +++ b/src/Composer/Downloader/DownloadManager.php @@ -44,6 +44,7 @@ class DownloadManager * Makes downloader prefer source installation over the dist. * * @param bool $preferSource prefer downloading from source + * @return DownloadManager */ public function setPreferSource($preferSource) { @@ -56,6 +57,7 @@ class DownloadManager * Makes downloader prefer dist installation over the source. * * @param bool $preferDist prefer downloading from dist + * @return DownloadManager */ public function setPreferDist($preferDist) { @@ -85,6 +87,7 @@ class DownloadManager * * @param string $type installation type * @param DownloaderInterface $downloader downloader instance + * @return DownloadManager */ public function setDownloader($type, DownloaderInterface $downloader) { @@ -101,7 +104,7 @@ class DownloadManager * * @return DownloaderInterface * - * @throws UnexpectedValueException if downloader for provided type is not registered + * @throws \InvalidArgumentException if downloader for provided type is not registered */ public function getDownloader($type) { @@ -120,8 +123,8 @@ class DownloadManager * * @return DownloaderInterface * - * @throws InvalidArgumentException if package has no installation source specified - * @throws LogicException if specific downloader used to load package with + * @throws \InvalidArgumentException if package has no installation source specified + * @throws \LogicException if specific downloader used to load package with * wrong type */ public function getDownloaderForInstalledPackage(PackageInterface $package) @@ -155,7 +158,7 @@ class DownloadManager * @param string $targetDir target dir * @param bool $preferSource prefer installation from source * - * @throws InvalidArgumentException if package have no urls to download from + * @throws \InvalidArgumentException if package have no urls to download from */ public function download(PackageInterface $package, $targetDir, $preferSource = null) { @@ -184,7 +187,7 @@ class DownloadManager * @param PackageInterface $target target package version * @param string $targetDir target dir * - * @throws InvalidArgumentException if initial package is not installed + * @throws \InvalidArgumentException if initial package is not installed */ public function update(PackageInterface $initial, PackageInterface $target, $targetDir) { diff --git a/src/Composer/Downloader/GitDownloader.php b/src/Composer/Downloader/GitDownloader.php index 492468871..939688d7d 100644 --- a/src/Composer/Downloader/GitDownloader.php +++ b/src/Composer/Downloader/GitDownloader.php @@ -272,6 +272,7 @@ class GitDownloader extends VcsDownloader * @param string $url * @param string $cwd * @param bool $initialClone If true, the directory if cleared between every attempt + * @throws \InvalidArgumentException * @throws \RuntimeException */ protected function runCommand($commandCallable, $url, $cwd, $initialClone = false) diff --git a/src/Composer/Downloader/SvnDownloader.php b/src/Composer/Downloader/SvnDownloader.php index aceaa20c0..5d9bcdf5d 100644 --- a/src/Composer/Downloader/SvnDownloader.php +++ b/src/Composer/Downloader/SvnDownloader.php @@ -68,7 +68,7 @@ class SvnDownloader extends VcsDownloader * @param string $url SVN url * @param string $cwd Working directory * @param string $path Target for a checkout - * + * @throws \RuntimeException * @return string */ protected function execute($baseUrl, $command, $url, $cwd = null, $path = null) diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php index fe993cfa8..82c785f71 100644 --- a/src/Composer/Factory.php +++ b/src/Composer/Factory.php @@ -34,6 +34,7 @@ use Composer\Autoload\AutoloadGenerator; class Factory { /** + * @throws \RuntimeException * @return Config */ public static function createConfig() @@ -175,6 +176,7 @@ class Factory * @param array|string|null $localConfig either a configuration array or a filename to read from, if null it will * read from the default filename * @throws \InvalidArgumentException + * @throws \UnexpectedValueException * @return Composer */ public function createComposer(IOInterface $io, $localConfig = null) diff --git a/src/Composer/IO/BufferIO.php b/src/Composer/IO/BufferIO.php index 8e1818a97..1d6ee1c65 100644 --- a/src/Composer/IO/BufferIO.php +++ b/src/Composer/IO/BufferIO.php @@ -25,6 +25,7 @@ class BufferIO extends ConsoleIO /** * @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 fee736b19..9cb8b42dc 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 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/InstallationManager.php b/src/Composer/Installer/InstallationManager.php index 2a9021324..406ee1166 100644 --- a/src/Composer/Installer/InstallationManager.php +++ b/src/Composer/Installer/InstallationManager.php @@ -90,7 +90,7 @@ class InstallationManager * * @return InstallerInterface * - * @throws InvalidArgumentException if installer for provided type is not registered + * @throws \InvalidArgumentException if installer for provided type is not registered */ public function getInstaller($type) { diff --git a/src/Composer/Json/JsonFile.php b/src/Composer/Json/JsonFile.php index 6568bad80..a011f6b1f 100755 --- a/src/Composer/Json/JsonFile.php +++ b/src/Composer/Json/JsonFile.php @@ -42,6 +42,7 @@ class JsonFile * * @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) { @@ -74,6 +75,7 @@ class JsonFile /** * Reads json file. * + * @throws \RuntimeException * @return mixed */ public function read() @@ -98,6 +100,7 @@ class JsonFile * * @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) { @@ -122,7 +125,7 @@ class JsonFile * * @param int $schema a JsonFile::*_SCHEMA constant * @return bool true on success - * @throws \UnexpectedValueException + * @throws JsonValidationException */ public function validateSchema($schema = self::STRICT_SCHEMA) { @@ -291,6 +294,7 @@ class JsonFile * @return bool true on success * @throws \UnexpectedValueException * @throws JsonValidationException + * @throws ParsingException */ protected static function validateSyntax($json, $file = null) { diff --git a/src/Composer/Package/AliasPackage.php b/src/Composer/Package/AliasPackage.php index dc9359cd4..6f1fb5095 100644 --- a/src/Composer/Package/AliasPackage.php +++ b/src/Composer/Package/AliasPackage.php @@ -160,6 +160,8 @@ class AliasPackage extends BasePackage implements CompletePackageInterface * Use by the policy for sorting manually aliased packages first, see #576 * * @param bool $value + * + * @return mixed */ public function setRootPackageAlias($value) { diff --git a/src/Composer/Package/Archiver/ArchiveManager.php b/src/Composer/Package/Archiver/ArchiveManager.php index e896199ac..b691c05a5 100644 --- a/src/Composer/Package/Archiver/ArchiveManager.php +++ b/src/Composer/Package/Archiver/ArchiveManager.php @@ -95,7 +95,8 @@ class ArchiveManager * @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 */ public function archive(PackageInterface $package, $format, $targetDir) diff --git a/src/Composer/Package/LinkConstraint/VersionConstraint.php b/src/Composer/Package/LinkConstraint/VersionConstraint.php index 1fc37bf85..096e6e833 100644 --- a/src/Composer/Package/LinkConstraint/VersionConstraint.php +++ b/src/Composer/Package/LinkConstraint/VersionConstraint.php @@ -61,8 +61,9 @@ class VersionConstraint extends SpecificConstraint } /** - * * @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 41512cfcf..8e8d994f9 100644 --- a/src/Composer/Package/Locker.php +++ b/src/Composer/Package/Locker.php @@ -88,6 +88,7 @@ class Locker * Searches and returns an array of locked packages, retrieved from registered repositories. * * @param bool $withDevReqs true to retrieve the locked dev packages + * @throws \RuntimeException * @return \Composer\Repository\RepositoryInterface */ public function getLockedRepository($withDevReqs = false) diff --git a/src/Composer/Package/Package.php b/src/Composer/Package/Package.php index 90157d9a0..b8a8252bc 100644 --- a/src/Composer/Package/Package.php +++ b/src/Composer/Package/Package.php @@ -299,7 +299,7 @@ class Package extends BasePackage /** * Set the releaseDate * - * @param DateTime $releaseDate + * @param \DateTime $releaseDate */ public function setReleaseDate(\DateTime $releaseDate) { diff --git a/src/Composer/Package/Version/VersionParser.php b/src/Composer/Package/Version/VersionParser.php index ba9b460b0..c03ac3507 100644 --- a/src/Composer/Package/Version/VersionParser.php +++ b/src/Composer/Package/Version/VersionParser.php @@ -88,6 +88,7 @@ class VersionParser * * @param string $version * @param string $fullVersion optional complete version string to give more context + * @throws \UnexpectedValueException * @return array */ public function normalize($version, $fullVersion = null) diff --git a/src/Composer/Repository/Pear/BaseChannelReader.php b/src/Composer/Repository/Pear/BaseChannelReader.php index 2f586ad87..e3ab71af7 100644 --- a/src/Composer/Repository/Pear/BaseChannelReader.php +++ b/src/Composer/Repository/Pear/BaseChannelReader.php @@ -46,6 +46,7 @@ abstract class BaseChannelReader * * @param $origin string server * @param $path string relative path to content + * @throws \UnexpectedValueException * @return \SimpleXMLElement */ protected function requestContent($origin, $path) @@ -64,6 +65,7 @@ abstract class BaseChannelReader * * @param $origin string server * @param $path string relative path to content + * @throws \UnexpectedValueException * @return \SimpleXMLElement */ protected function requestXml($origin, $path) diff --git a/src/Composer/Repository/Pear/ChannelReader.php b/src/Composer/Repository/Pear/ChannelReader.php index bb909b3b7..849055959 100644 --- a/src/Composer/Repository/Pear/ChannelReader.php +++ b/src/Composer/Repository/Pear/ChannelReader.php @@ -45,6 +45,7 @@ class ChannelReader extends BaseChannelReader * Reads PEAR channel through REST interface and builds list of packages * * @param $url string PEAR Channel url + * @throws \UnexpectedValueException * @return ChannelInfo */ public function read($url) diff --git a/src/Composer/Repository/Pear/ChannelRest10Reader.php b/src/Composer/Repository/Pear/ChannelRest10Reader.php index cd3985da5..d96d89155 100644 --- a/src/Composer/Repository/Pear/ChannelRest10Reader.php +++ b/src/Composer/Repository/Pear/ChannelRest10Reader.php @@ -107,6 +107,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 */ private function readPackageReleases($baseUrl, $packageName) diff --git a/src/Composer/Repository/RepositoryManager.php b/src/Composer/Repository/RepositoryManager.php index e3c964cdb..bff561fd6 100644 --- a/src/Composer/Repository/RepositoryManager.php +++ b/src/Composer/Repository/RepositoryManager.php @@ -88,7 +88,7 @@ class RepositoryManager * @param string $type repository type * @param string $config repository configuration * @return RepositoryInterface - * @throws InvalidArgumentException if repository for provided type is not registered + * @throws \InvalidArgumentException if repository for provided type is not registered */ public function createRepository($type, $config) { diff --git a/src/Composer/Repository/Vcs/SvnDriver.php b/src/Composer/Repository/Vcs/SvnDriver.php index f47722bc4..4ac8503a7 100644 --- a/src/Composer/Repository/Vcs/SvnDriver.php +++ b/src/Composer/Repository/Vcs/SvnDriver.php @@ -291,7 +291,7 @@ class SvnDriver extends VcsDriver * * @param string $command The svn command to run. * @param string $url The SVN URL. - * + * @throws \RuntimeException * @return string */ protected function execute($command, $url) diff --git a/src/Composer/Script/EventDispatcher.php b/src/Composer/Script/EventDispatcher.php index c0fefb99e..e804b4edf 100644 --- a/src/Composer/Script/EventDispatcher.php +++ b/src/Composer/Script/EventDispatcher.php @@ -93,6 +93,8 @@ class EventDispatcher * Triggers the listeners of an event. * * @param Event $event The event object to pass to the event handlers/listeners. + * @throws \RuntimeException + * @throws \Exception */ protected function doDispatch(Event $event) { diff --git a/src/Composer/Util/Filesystem.php b/src/Composer/Util/Filesystem.php index 413dac882..805e2680c 100644 --- a/src/Composer/Util/Filesystem.php +++ b/src/Composer/Util/Filesystem.php @@ -194,6 +194,7 @@ class Filesystem * @param string $from * @param string $to * @param bool $directories if true, the source/target are considered to be directories + * @throws \InvalidArgumentException * @return string */ public function findShortestPath($from, $to, $directories = false) @@ -235,6 +236,7 @@ class Filesystem * @param string $from * @param string $to * @param bool $directories if true, the source/target are considered to be directories + * @throws \InvalidArgumentException * @return string */ public function findShortestPathCode($from, $to, $directories = false) @@ -286,6 +288,7 @@ class Filesystem * given, it's size will be computed recursively. * * @param string $path Path to the file or directory + * @throws \RuntimeException * @return int */ public function size($path) diff --git a/src/Composer/Util/GitHub.php b/src/Composer/Util/GitHub.php index 573ecf516..42b791283 100644 --- a/src/Composer/Util/GitHub.php +++ b/src/Composer/Util/GitHub.php @@ -70,6 +70,8 @@ class GitHub * * @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 */ public function authorizeOAuthInteractively($originUrl, $message = null) diff --git a/src/Composer/Util/RemoteFilesystem.php b/src/Composer/Util/RemoteFilesystem.php index 05f99abde..ca66fa9c6 100644 --- a/src/Composer/Util/RemoteFilesystem.php +++ b/src/Composer/Util/RemoteFilesystem.php @@ -85,7 +85,10 @@ class RemoteFilesystem * @param string $fileName the local filename * @param boolean $progress Display the progression * + * @throws TransportException|\Exception * @throws TransportException When the file could not be downloaded + * + * @return bool|string */ protected function get($originUrl, $fileUrl, $additionalOptions = array(), $fileName = null, $progress = true) { @@ -213,6 +216,7 @@ class RemoteFilesystem * @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 941fbf867..787af1ef4 100644 --- a/src/bootstrap.php +++ b/src/bootstrap.php @@ -12,9 +12,7 @@ function includeIfExists($file) { - if (file_exists($file)) { - return include $file; - } + return file_exists($file)===true ? include $file : false; } if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) { diff --git a/tests/Composer/Test/Repository/Pear/PackageDependencyParserTest.php b/tests/Composer/Test/Repository/Pear/PackageDependencyParserTest.php index 959fe2a9e..c2d77aef0 100644 --- a/tests/Composer/Test/Repository/Pear/PackageDependencyParserTest.php +++ b/tests/Composer/Test/Repository/Pear/PackageDependencyParserTest.php @@ -19,7 +19,8 @@ class PackageDependencyParserTest extends TestCase /** * @dataProvider dataProvider10 * @param $expected - * @param $data + * @param $data10 + * @param $data20 */ public function testShouldParseDependencies($expected, $data10, $data20) {