main
Jordi Boggiano 11 years ago
parent 6f6228fb1d
commit 8d0b7f278e

@ -317,7 +317,7 @@ EOF;
} }
} }
if (preg_match('/\.phar$/', $path)){ if (preg_match('/\.phar$/', $path)) {
$baseDir = "'phar://' . " . $baseDir; $baseDir = "'phar://' . " . $baseDir;
} }

@ -121,8 +121,8 @@ class ClassLoader
/** /**
* Registers a set of classes, replacing any others previously set. * Registers a set of classes, replacing any others previously set.
* *
* @param string $prefix The classes prefix * @param string $prefix The classes prefix
* @param array|string $paths The location(s) of the classes * @param array|string $paths The location(s) of the classes
*/ */
public function set($prefix, $paths) public function set($prefix, $paths)
{ {

@ -93,9 +93,9 @@ class ClassMapGenerator
/** /**
* Extract the classes in the given file * Extract the classes in the given file
* *
* @param string $path The file to check * @param string $path The file to check
* @throws \RuntimeException * @throws \RuntimeException
* @return array The found classes * @return array The found classes
*/ */
private static function findClasses($path) private static function findClasses($path)
{ {

@ -66,6 +66,7 @@ class Cache
if ($this->io->isDebug()) { if ($this->io->isDebug()) {
$this->io->write('Reading '.$this->root . $file.' from cache'); $this->io->write('Reading '.$this->root . $file.' from cache');
} }
return file_get_contents($this->root . $file); return file_get_contents($this->root . $file);
} }
@ -80,6 +81,7 @@ class Cache
if ($this->io->isDebug()) { if ($this->io->isDebug()) {
$this->io->write('Writing '.$this->root . $file.' into cache'); $this->io->write('Writing '.$this->root . $file.' into cache');
} }
return file_put_contents($this->root . $file, $contents); return file_put_contents($this->root . $file, $contents);
} }
@ -98,6 +100,7 @@ class Cache
if ($this->io->isDebug()) { if ($this->io->isDebug()) {
$this->io->write('Writing '.$this->root . $file.' into cache'); $this->io->write('Writing '.$this->root . $file.' into cache');
} }
return copy($source, $this->root . $file); return copy($source, $this->root . $file);
} }
@ -116,6 +119,7 @@ class Cache
if ($this->io->isDebug()) { if ($this->io->isDebug()) {
$this->io->write('Reading '.$this->root . $file.' from cache'); $this->io->write('Reading '.$this->root . $file.' from cache');
} }
return copy($this->root . $file, $target); return copy($this->root . $file, $target);
} }

@ -115,6 +115,7 @@ EOT
$io->write('<info>Found an exact match '.$package->getPrettyString().'.</info>'); $io->write('<info>Found an exact match '.$package->getPrettyString().'.</info>');
} else { } else {
$io->write('<error>Could not find a package matching '.$packageName.'.</error>'); $io->write('<error>Could not find a package matching '.$packageName.'.</error>');
return false; return false;
} }

@ -37,7 +37,7 @@ abstract class Command extends BaseCommand
private $io; private $io;
/** /**
* @param bool $required * @param bool $required
* @throws \RuntimeException * @throws \RuntimeException
* @return Composer * @return Composer
*/ */

@ -284,6 +284,7 @@ EOT
if ('stash' === $val) { if ('stash' === $val) {
return 'stash'; return 'stash';
} }
return $val !== 'false' && (bool) $val; return $val !== 'false' && (bool) $val;
} }
), ),

@ -14,9 +14,7 @@ namespace Composer\Command;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Composer\Repository\CompositeRepository;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Composer\Autoload\AutoloadGenerator;
/** /**
* @author Jordi Boggiano <j.boggiano@seld.be> * @author Jordi Boggiano <j.boggiano@seld.be>

@ -19,8 +19,6 @@ use Symfony\Component\Console\Output\OutputInterface;
use Composer\Repository\CompositeRepository; use Composer\Repository\CompositeRepository;
use Composer\Repository\PlatformRepository; use Composer\Repository\PlatformRepository;
use Composer\Repository\RepositoryInterface; use Composer\Repository\RepositoryInterface;
use Composer\Package\CompletePackageInterface;
use Composer\Package\AliasPackage;
use Composer\Factory; use Composer\Factory;
/** /**

@ -44,16 +44,16 @@ EOT
{ {
$localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0]; $localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0];
$tempFilename = dirname($localFilename) . '/' . basename($localFilename, '.phar').'-temp.phar'; $tempFilename = dirname($localFilename) . '/' . basename($localFilename, '.phar').'-temp.phar';
// check for permissions in local filesystem before start connection process // check for permissions in local filesystem before start connection process
if (!is_writable($tempDirectory = dirname($tempFilename))) { 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'); throw new FilesystemException('Composer update failed: the "'.$tempDirectory.'" directory used to download the temp file could not be written');
} }
if (!is_writable($localFilename)) { if (!is_writable($localFilename)) {
throw new FilesystemException('Composer update failed: the "'.$localFilename. '" file could not be written'); throw new FilesystemException('Composer update failed: the "'.$localFilename. '" file could not be written');
} }
$protocol = extension_loaded('openssl') ? 'https' : 'http'; $protocol = extension_loaded('openssl') ? 'https' : 'http';
$rfs = new RemoteFilesystem($this->getIO()); $rfs = new RemoteFilesystem($this->getIO());
$latest = trim($rfs->getContents('getcomposer.org', $protocol . '://getcomposer.org/version', false)); $latest = trim($rfs->getContents('getcomposer.org', $protocol . '://getcomposer.org/version', false));
@ -61,7 +61,7 @@ EOT
if (Composer::VERSION !== $latest) { if (Composer::VERSION !== $latest) {
$output->writeln(sprintf("Updating to version <info>%s</info>.", $latest)); $output->writeln(sprintf("Updating to version <info>%s</info>.", $latest));
$remoteFilename = $protocol . '://getcomposer.org/composer.phar'; $remoteFilename = $protocol . '://getcomposer.org/composer.phar';
$rfs->copy('getcomposer.org', $remoteFilename, $tempFilename); $rfs->copy('getcomposer.org', $remoteFilename, $tempFilename);

@ -17,7 +17,6 @@ use Composer\DependencyResolver\Pool;
use Composer\DependencyResolver\DefaultPolicy; use Composer\DependencyResolver\DefaultPolicy;
use Composer\Factory; use Composer\Factory;
use Composer\Package\CompletePackageInterface; use Composer\Package\CompletePackageInterface;
use Composer\Package\LinkConstraint\VersionConstraint;
use Composer\Package\Version\VersionParser; use Composer\Package\Version\VersionParser;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;

@ -122,7 +122,7 @@ class Config
/** /**
* Returns a setting * Returns a setting
* *
* @param string $key * @param string $key
* @throws \RuntimeException * @throws \RuntimeException
* @return mixed * @return mixed
*/ */

@ -142,7 +142,7 @@ class Application extends BaseApplication
} }
/** /**
* @param bool $required * @param bool $required
* @throws JsonValidationException * @throws JsonValidationException
* @return \Composer\Composer * @return \Composer\Composer
*/ */

@ -27,7 +27,7 @@ class MarkAliasInstalledOperation extends SolverOperation
* Initializes operation. * Initializes operation.
* *
* @param AliasPackage $package package instance * @param AliasPackage $package package instance
* @param string $reason operation reason * @param string $reason operation reason
*/ */
public function __construct(AliasPackage $package, $reason = null) public function __construct(AliasPackage $package, $reason = null)
{ {

@ -27,7 +27,7 @@ class MarkAliasUninstalledOperation extends SolverOperation
* Initializes operation. * Initializes operation.
* *
* @param AliasPackage $package package instance * @param AliasPackage $package package instance
* @param string $reason operation reason * @param string $reason operation reason
*/ */
public function __construct(AliasPackage $package, $reason = null) public function __construct(AliasPackage $package, $reason = null)
{ {

@ -66,7 +66,7 @@ class Problem
/** /**
* A human readable textual representation of the problem's reasons * 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 * @return string
*/ */
public function getPrettyString(array $installedMap = array()) public function getPrettyString(array $installedMap = array())

@ -43,7 +43,7 @@ class DownloadManager
/** /**
* Makes downloader prefer source installation over the dist. * Makes downloader prefer source installation over the dist.
* *
* @param bool $preferSource prefer downloading from source * @param bool $preferSource prefer downloading from source
* @return DownloadManager * @return DownloadManager
*/ */
public function setPreferSource($preferSource) public function setPreferSource($preferSource)
@ -56,7 +56,7 @@ class DownloadManager
/** /**
* Makes downloader prefer dist installation over the source. * Makes downloader prefer dist installation over the source.
* *
* @param bool $preferDist prefer downloading from dist * @param bool $preferDist prefer downloading from dist
* @return DownloadManager * @return DownloadManager
*/ */
public function setPreferDist($preferDist) public function setPreferDist($preferDist)
@ -85,8 +85,8 @@ class DownloadManager
/** /**
* Sets installer downloader for a specific installation type. * Sets installer downloader for a specific installation type.
* *
* @param string $type installation type * @param string $type installation type
* @param DownloaderInterface $downloader downloader instance * @param DownloaderInterface $downloader downloader instance
* @return DownloadManager * @return DownloadManager
*/ */
public function setDownloader($type, DownloaderInterface $downloader) public function setDownloader($type, DownloaderInterface $downloader)

@ -14,7 +14,7 @@ namespace Composer\Downloader;
/** /**
* Exception thrown when issues exist on local filesystem * Exception thrown when issues exist on local filesystem
* *
* @author Javier Spagnoletti <jspagnoletti@javierspagnoletti.com.ar> * @author Javier Spagnoletti <jspagnoletti@javierspagnoletti.com.ar>
*/ */
class FilesystemException extends \Exception class FilesystemException extends \Exception

@ -268,10 +268,10 @@ class GitDownloader extends VcsDownloader
/** /**
* Runs a command doing attempts for each protocol supported by github. * Runs a command doing attempts for each protocol supported by github.
* *
* @param callable $commandCallable A callable building the command for the given url * @param callable $commandCallable A callable building the command for the given url
* @param string $url * @param string $url
* @param string $cwd * @param string $cwd
* @param bool $initialClone If true, the directory if cleared between every attempt * @param bool $initialClone If true, the directory if cleared between every attempt
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @throws \RuntimeException * @throws \RuntimeException
*/ */

@ -63,11 +63,11 @@ class SvnDownloader extends VcsDownloader
* Execute an SVN command and try to fix up the process with credentials * Execute an SVN command and try to fix up the process with credentials
* if necessary. * if necessary.
* *
* @param string $baseUrl Base URL of the repository * @param string $baseUrl Base URL of the repository
* @param string $command SVN command to run * @param string $command SVN command to run
* @param string $url SVN url * @param string $url SVN url
* @param string $cwd Working directory * @param string $cwd Working directory
* @param string $path Target for a checkout * @param string $path Target for a checkout
* @throws \RuntimeException * @throws \RuntimeException
* @return string * @return string
*/ */

@ -328,8 +328,8 @@ class Factory
} }
/** /**
* @param Config $config The configuration * @param Config $config The configuration
* @param Downloader\DownloadManager $dm Manager use to download sources * @param Downloader\DownloadManager $dm Manager use to download sources
* *
* @return Archiver\ArchiveManager * @return Archiver\ArchiveManager
*/ */

@ -23,8 +23,8 @@ use Symfony\Component\Console\Helper\HelperSet;
class BufferIO extends ConsoleIO class BufferIO extends ConsoleIO
{ {
/** /**
* @param string $input * @param string $input
* @param int $verbosity * @param int $verbosity
* @param OutputFormatterInterface $formatter * @param OutputFormatterInterface $formatter
*/ */
public function __construct($input = '', $verbosity = null, OutputFormatterInterface $formatter = null) public function __construct($input = '', $verbosity = null, OutputFormatterInterface $formatter = null)

@ -104,7 +104,7 @@ interface IOInterface
* *
* @param string|array $question The question to ask * @param string|array $question The question to ask
* @param callback $validator A PHP callback * @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 * @param string $default The default answer if none is given by the user
* *
* @return mixed * @return mixed

@ -742,7 +742,8 @@ class Installer
return false; return false;
} }
private function extractPlatformRequirements($links) { private function extractPlatformRequirements($links)
{
$platformReqs = array(); $platformReqs = array();
foreach ($links as $link) { foreach ($links as $link) {
if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) { if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
@ -857,8 +858,8 @@ class Installer
/** /**
* Create Installer * Create Installer
* *
* @param IOInterface $io * @param IOInterface $io
* @param Composer $composer * @param Composer $composer
* @return Installer * @return Installer
*/ */
public static function create(IOInterface $io, Composer $composer) public static function create(IOInterface $io, Composer $composer)

@ -15,7 +15,6 @@ namespace Composer\Installer;
use Composer\Composer; use Composer\Composer;
use Composer\Package\Package; use Composer\Package\Package;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
use Composer\Autoload\AutoloadGenerator;
use Composer\Repository\InstalledRepositoryInterface; use Composer\Repository\InstalledRepositoryInterface;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;

@ -140,12 +140,14 @@ class LibraryInstaller implements InstallerInterface
public function getInstallPath(PackageInterface $package) public function getInstallPath(PackageInterface $package)
{ {
$targetDir = $package->getTargetDir(); $targetDir = $package->getTargetDir();
return $this->getPackageBasePath($package) . ($targetDir ? '/'.$targetDir : ''); return $this->getPackageBasePath($package) . ($targetDir ? '/'.$targetDir : '');
} }
protected function getPackageBasePath(PackageInterface $package) protected function getPackageBasePath(PackageInterface $package)
{ {
$this->initializeVendorDir(); $this->initializeVendorDir();
return ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName(); return ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
} }

@ -40,8 +40,8 @@ class JsonFile
/** /**
* Initializes json file reader/parser. * Initializes json file reader/parser.
* *
* @param string $path path to a lockfile * @param string $path path to a lockfile
* @param RemoteFilesystem $rfs required for loading http/https json files * @param RemoteFilesystem $rfs required for loading http/https json files
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public function __construct($path, RemoteFilesystem $rfs = null) public function __construct($path, RemoteFilesystem $rfs = null)
@ -98,8 +98,8 @@ class JsonFile
/** /**
* Writes json file. * Writes json file.
* *
* @param array $hash writes hash into 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 int $options json_encode options (defaults to JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)
* @throws \UnexpectedValueException * @throws \UnexpectedValueException
*/ */
public function write(array $hash, $options = 448) 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 * Validates the schema of the current json file according to composer-schema.json rules
* *
* @param int $schema a JsonFile::*_SCHEMA constant * @param int $schema a JsonFile::*_SCHEMA constant
* @return bool true on success * @return bool true on success
* @throws JsonValidationException * @throws JsonValidationException
*/ */
public function validateSchema($schema = self::STRICT_SCHEMA) public function validateSchema($schema = self::STRICT_SCHEMA)

@ -12,8 +12,6 @@
namespace Composer\Package\Archiver; namespace Composer\Package\Archiver;
use Composer\Package\BasePackage;
use Composer\Package\PackageInterface;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;
use Symfony\Component\Finder; use Symfony\Component\Finder;
@ -36,8 +34,8 @@ class ArchivableFilesFinder extends \FilterIterator
/** /**
* Initializes the internal Symfony Finder with appropriate filters * Initializes the internal Symfony Finder with appropriate filters
* *
* @param string $sources Path to source files to be archived * @param string $sources Path to source files to be archived
* @param array $excludes Composer's own exclude rules from composer.json * @param array $excludes Composer's own exclude rules from composer.json
*/ */
public function __construct($sources, array $excludes) public function __construct($sources, array $excludes)
{ {
@ -64,6 +62,7 @@ class ArchivableFilesFinder extends \FilterIterator
foreach ($filters as $filter) { foreach ($filters as $filter) {
$exclude = $filter->filter($relativePath, $exclude); $exclude = $filter->filter($relativePath, $exclude);
} }
return !$exclude; return !$exclude;
}; };

@ -13,8 +13,6 @@
namespace Composer\Package\Archiver; namespace Composer\Package\Archiver;
use Composer\Downloader\DownloadManager; use Composer\Downloader\DownloadManager;
use Composer\Factory;
use Composer\IO\NullIO;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Package\RootPackage; use Composer\Package\RootPackage;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;
@ -60,6 +58,7 @@ class ArchiveManager
public function setOverwriteFiles($overwriteFiles) public function setOverwriteFiles($overwriteFiles)
{ {
$this->overwriteFiles = $overwriteFiles; $this->overwriteFiles = $overwriteFiles;
return $this; return $this;
} }
@ -92,12 +91,12 @@ class ArchiveManager
/** /**
* Create an archive of the specified package. * Create an archive of the specified package.
* *
* @param PackageInterface $package The package to archive * @param PackageInterface $package The package to archive
* @param string $format The format of the archive (zip, tar, ...) * @param string $format The format of the archive (zip, tar, ...)
* @param string $targetDir The diretory where to build the archive * @param string $targetDir The diretory where to build the archive
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @throws \RuntimeException * @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) public function archive(PackageInterface $package, $format, $targetDir)
{ {

@ -12,8 +12,6 @@
namespace Composer\Package\Archiver; namespace Composer\Package\Archiver;
use Composer\Package\PackageInterface;
/** /**
* @author Till Klampaeckel <till@php.net> * @author Till Klampaeckel <till@php.net>
* @author Matthieu Moquet <matthieu@moquet.net> * @author Matthieu Moquet <matthieu@moquet.net>
@ -24,10 +22,10 @@ interface ArchiverInterface
/** /**
* Create an archive from the sources. * Create an archive from the sources.
* *
* @param string $sources The sources directory * @param string $sources The sources directory
* @param string $target The target file * @param string $target The target file
* @param string $format The format used for archive * @param string $format The format used for archive
* @param array $excludes A list of patterns for files to exclude * @param array $excludes A list of patterns for files to exclude
* *
* @return string The path to the written archive file * @return string The path to the written archive file
*/ */

@ -44,7 +44,7 @@ abstract class BaseExcludeFilter
* Negated patterns overwrite exclude decisions of previous filters. * Negated patterns overwrite exclude decisions of previous filters.
* *
* @param string $relativePath The file's path relative to the sourcePath * @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 * @return bool Whether the file should be excluded
*/ */
@ -63,13 +63,14 @@ abstract class BaseExcludeFilter
$exclude = !$negate; $exclude = !$negate;
} }
} }
return $exclude; return $exclude;
} }
/** /**
* Processes a file containing exclude rules of different formats per line * 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 * @param callback $lineParser The parser to be used on each line
* *
* @return array Exclude patterns to be used in filter() * @return array Exclude patterns to be used in filter()
@ -89,6 +90,7 @@ abstract class BaseExcludeFilter
if ($line) { if ($line) {
return call_user_func($lineParser, $line); return call_user_func($lineParser, $line);
} }
return null; return null;
}, $lines), }, $lines),
function ($pattern) { function ($pattern) {
@ -110,6 +112,7 @@ abstract class BaseExcludeFilter
foreach ($rules as $rule) { foreach ($rules as $rule) {
$patterns[] = $this->generatePattern($rule); $patterns[] = $this->generatePattern($rule);
} }
return $patterns; return $patterns;
} }
@ -138,6 +141,7 @@ abstract class BaseExcludeFilter
} }
$pattern .= substr(Finder\Glob::toRegex($rule), 2, -2); $pattern .= substr(Finder\Glob::toRegex($rule), 2, -2);
return array($pattern . '#', $negate, false); return array($pattern . '#', $negate, false);
} }
} }

@ -20,8 +20,8 @@ namespace Composer\Package\Archiver;
class ComposerExcludeFilter extends BaseExcludeFilter class ComposerExcludeFilter extends BaseExcludeFilter
{ {
/** /**
* @param string $sourcePath Directory containing sources to be filtered * @param string $sourcePath Directory containing sources to be filtered
* @param array $excludeRules An array of exclude rules from composer.json * @param array $excludeRules An array of exclude rules from composer.json
*/ */
public function __construct($sourcePath, array $excludeRules) public function __construct($sourcePath, array $excludeRules)
{ {

@ -64,6 +64,7 @@ class HgExcludeFilter extends BaseExcludeFilter
} else { } else {
$this->patternMode = self::HG_IGNORE_REGEX; $this->patternMode = self::HG_IGNORE_REGEX;
} }
return null; return null;
} }
@ -85,6 +86,7 @@ class HgExcludeFilter extends BaseExcludeFilter
{ {
$pattern = '#'.substr(Finder\Glob::toRegex($line), 2, -1).'#'; $pattern = '#'.substr(Finder\Glob::toRegex($line), 2, -1).'#';
$pattern = str_replace('[^/]*', '.*', $pattern); $pattern = str_replace('[^/]*', '.*', $pattern);
return array($pattern, false, true); return array($pattern, false, true);
} }
@ -99,6 +101,7 @@ class HgExcludeFilter extends BaseExcludeFilter
{ {
// WTF need to escape the delimiter safely // WTF need to escape the delimiter safely
$pattern = '#'.preg_replace('/((?:\\\\\\\\)*)(\\\\?)#/', '\1\2\2\\#', $line).'#'; $pattern = '#'.preg_replace('/((?:\\\\\\\\)*)(\\\\?)#/', '\1\2\2\\#', $line).'#';
return array($pattern, false, true); return array($pattern, false, true);
} }
} }

@ -12,9 +12,6 @@
namespace Composer\Package\Archiver; namespace Composer\Package\Archiver;
use Composer\Package\BasePackage;
use Composer\Package\PackageInterface;
/** /**
* @author Till Klampaeckel <till@php.net> * @author Till Klampaeckel <till@php.net>
* @author Nils Adermann <naderman@naderman.de> * @author Nils Adermann <naderman@naderman.de>
@ -43,6 +40,7 @@ class PharArchiver implements ArchiverInterface
$phar = new \PharData($target, null, null, static::$formats[$format]); $phar = new \PharData($target, null, null, static::$formats[$format]);
$files = new ArchivableFilesFinder($sources, $excludes); $files = new ArchivableFilesFinder($sources, $excludes);
$phar->buildFromIterator($files, $sources); $phar->buildFromIterator($files, $sources);
return $target; return $target;
} catch (\UnexpectedValueException $e) { } catch (\UnexpectedValueException $e) {
$message = sprintf("Could not create archive '%s' from '%s': %s", $message = sprintf("Could not create archive '%s' from '%s': %s",

@ -61,8 +61,8 @@ class VersionConstraint extends SpecificConstraint
} }
/** /**
* @param VersionConstraint $provider * @param VersionConstraint $provider
* @param bool $compareBranches * @param bool $compareBranches
* @return bool * @return bool
*/ */
public function matchSpecific(VersionConstraint $provider, $compareBranches = false) public function matchSpecific(VersionConstraint $provider, $compareBranches = false)

@ -123,7 +123,7 @@ class Locker
/** /**
* Returns the platform requirements stored in the lock file * 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[] * @return \Composer\Package\Link[]
*/ */
public function getPlatformRequirements($withDevReqs = false) public function getPlatformRequirements($withDevReqs = false)
@ -306,7 +306,7 @@ class Locker
* Returns the packages's datetime for its source reference. * Returns the packages's datetime for its source reference.
* *
* @param PackageInterface $package The package to scan. * @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) private function getPackageTime(PackageInterface $package)
{ {

@ -12,9 +12,6 @@
namespace Composer\Package; namespace Composer\Package;
use Composer\Package\LinkConstraint\VersionConstraint;
use Composer\Package\Version\VersionParser;
/** /**
* @author Jordi Boggiano <j.boggiano@seld.be> * @author Jordi Boggiano <j.boggiano@seld.be>
*/ */

@ -86,8 +86,8 @@ class VersionParser
/** /**
* Normalizes a version string to be able to perform comparisons on it * Normalizes a version string to be able to perform comparisons on it
* *
* @param string $version * @param string $version
* @param string $fullVersion optional complete version string to give more context * @param string $fullVersion optional complete version string to give more context
* @throws \UnexpectedValueException * @throws \UnexpectedValueException
* @return array * @return array
*/ */

@ -108,7 +108,7 @@ class ChannelRest10Reader extends BaseChannelReader
* @param $baseUrl string * @param $baseUrl string
* @param $packageName string * @param $packageName string
* @throws \Composer\Downloader\TransportException|\Exception * @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) private function readPackageReleases($baseUrl, $packageName)
{ {

@ -65,8 +65,8 @@ interface RepositoryInterface extends \Countable
/** /**
* Searches the repository for packages containing the query * Searches the repository for packages containing the query
* *
* @param string $query search 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 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' => '...') * @return array[] an array of array('name' => '...', 'description' => '...')
*/ */
public function search($query, $mode = 0); public function search($query, $mode = 0);

@ -85,8 +85,8 @@ class RepositoryManager
/** /**
* Returns a new repository for a specific installation type. * Returns a new repository for a specific installation type.
* *
* @param string $type repository type * @param string $type repository type
* @param string $config repository configuration * @param string $config repository configuration
* @return RepositoryInterface * @return RepositoryInterface
* @throws \InvalidArgumentException if repository for provided type is not registered * @throws \InvalidArgumentException if repository for provided type is not registered
*/ */

@ -19,4 +19,4 @@ namespace Composer\Repository;
*/ */
class RepositorySecurityException extends \Exception class RepositorySecurityException extends \Exception
{ {
} }

@ -289,8 +289,8 @@ class SvnDriver extends VcsDriver
* Execute an SVN command and try to fix up the process with credentials * Execute an SVN command and try to fix up the process with credentials
* if necessary. * if necessary.
* *
* @param string $command The svn command to run. * @param string $command The svn command to run.
* @param string $url The SVN URL. * @param string $url The SVN URL.
* @throws \RuntimeException * @throws \RuntimeException
* @return string * @return string
*/ */
@ -316,8 +316,8 @@ class SvnDriver extends VcsDriver
/** /**
* Build the identifier respecting "package-path" config option * Build the identifier respecting "package-path" config option
* *
* @param string $baseDir The path to trunk/branch/tag * @param string $baseDir The path to trunk/branch/tag
* @param int $revision The revision mark to add to identifier * @param int $revision The revision mark to add to identifier
* *
* @return string * @return string
*/ */
@ -326,4 +326,3 @@ class SvnDriver extends VcsDriver
return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision; return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision;
} }
} }

@ -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) final public function __construct(array $repoConfig, IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
{ {
if (self::isLocalUrl($repoConfig['url'])) { if (self::isLocalUrl($repoConfig['url'])) {
$repoConfig['url'] = realpath( $repoConfig['url'] = realpath(
preg_replace('/^file:\/\//', '', $repoConfig['url']) preg_replace('/^file:\/\//', '', $repoConfig['url'])
); );
} }
$this->url = $repoConfig['url']; $this->url = $repoConfig['url'];
$this->originUrl = $repoConfig['url']; $this->originUrl = $repoConfig['url'];
$this->repoConfig = $repoConfig; $this->repoConfig = $repoConfig;

@ -12,7 +12,6 @@
namespace Composer\Script; namespace Composer\Script;
use Composer\Autoload\AutoloadGenerator;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
use Composer\Composer; use Composer\Composer;
use Composer\DependencyResolver\Operation\OperationInterface; use Composer\DependencyResolver\Operation\OperationInterface;
@ -54,8 +53,8 @@ class EventDispatcher
/** /**
* Dispatch a script event. * Dispatch a script event.
* *
* @param string $eventName The constant in ScriptEvents * @param string $eventName The constant in ScriptEvents
* @param Event $event * @param Event $event
*/ */
public function dispatch($eventName, Event $event = null) public function dispatch($eventName, Event $event = null)
{ {
@ -92,7 +91,7 @@ class EventDispatcher
/** /**
* Triggers the listeners of an event. * 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 \RuntimeException
* @throws \Exception * @throws \Exception
*/ */

@ -191,9 +191,9 @@ class Filesystem
/** /**
* Returns the shortest path from $from to $to * Returns the shortest path from $from to $to
* *
* @param string $from * @param string $from
* @param string $to * @param string $to
* @param bool $directories if true, the source/target are considered to be directories * @param bool $directories if true, the source/target are considered to be directories
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return string * @return string
*/ */
@ -233,9 +233,9 @@ class Filesystem
/** /**
* Returns PHP code that, when executed in $from, will return the path to $to * Returns PHP code that, when executed in $from, will return the path to $to
* *
* @param string $from * @param string $from
* @param string $to * @param string $to
* @param bool $directories if true, the source/target are considered to be directories * @param bool $directories if true, the source/target are considered to be directories
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return string * @return string
*/ */
@ -287,7 +287,7 @@ class Filesystem
* Returns size of a file or directory specified by path. If a directory is * Returns size of a file or directory specified by path. If a directory is
* given, it's size will be computed recursively. * 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 * @throws \RuntimeException
* @return int * @return int
*/ */
@ -307,7 +307,7 @@ class Filesystem
* Normalize a path. This replaces backslashes with slashes, removes ending * Normalize a path. This replaces backslashes with slashes, removes ending
* slash and collapses redundant separators and up-level references. * 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 * @return string
*/ */
public function normalizePath($path) public function normalizePath($path)

@ -68,11 +68,11 @@ class GitHub
/** /**
* Authorizes a GitHub domain interactively via OAuth * Authorizes a GitHub domain interactively via OAuth
* *
* @param string $originUrl The host this GitHub instance is located at * @param string $originUrl The host this GitHub instance is located at
* @param string $message The reason this authorization is required * @param string $message The reason this authorization is required
* @throws \RuntimeException * @throws \RuntimeException
* @throws \Composer\Downloader\TransportException|\Exception * @throws TransportException|\Exception
* @return bool true on success * @return bool true on success
*/ */
public function authorizeOAuthInteractively($originUrl, $message = null) public function authorizeOAuthInteractively($originUrl, $message = null)
{ {

@ -86,7 +86,7 @@ class RemoteFilesystem
* @param boolean $progress Display the progression * @param boolean $progress Display the progression
* *
* @throws TransportException|\Exception * @throws TransportException|\Exception
* @throws TransportException When the file could not be downloaded * @throws TransportException When the file could not be downloaded
* *
* @return bool|string * @return bool|string
*/ */
@ -210,12 +210,12 @@ class RemoteFilesystem
/** /**
* Get notification action. * Get notification action.
* *
* @param integer $notificationCode The notification code * @param integer $notificationCode The notification code
* @param integer $severity The severity level * @param integer $severity The severity level
* @param string $message The message * @param string $message The message
* @param integer $messageCode The message code * @param integer $messageCode The message code
* @param integer $bytesTransferred The loaded size * @param integer $bytesTransferred The loaded size
* @param integer $bytesMax The total size * @param integer $bytesMax The total size
* @throws TransportException * @throws TransportException
*/ */
protected function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax) protected function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax)

@ -12,7 +12,7 @@
function includeIfExists($file) 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'))) { if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {

@ -67,6 +67,7 @@ class AutoloadGeneratorTest extends TestCase
->method('getInstallPath') ->method('getInstallPath')
->will($this->returnCallback(function ($package) use ($that) { ->will($this->returnCallback(function ($package) use ($that) {
$targetDir = $package->getTargetDir(); $targetDir = $package->getTargetDir();
return $that->vendorDir.'/'.$package->getName() . ($targetDir ? '/'.$targetDir : ''); return $that->vendorDir.'/'.$package->getName() . ($targetDir ? '/'.$targetDir : '');
})); }));
$this->repository = $this->getMock('Composer\Repository\InstalledRepositoryInterface'); $this->repository = $this->getMock('Composer\Repository\InstalledRepositoryInterface');
@ -697,6 +698,7 @@ EOF;
->method('getInstallPath') ->method('getInstallPath')
->will($this->returnCallback(function ($package) use ($vendorDir) { ->will($this->returnCallback(function ($package) use ($vendorDir) {
$targetDir = $package->getTargetDir(); $targetDir = $package->getTargetDir();
return $vendorDir.'/'.$package->getName() . ($targetDir ? '/'.$targetDir : ''); return $vendorDir.'/'.$package->getName() . ($targetDir ? '/'.$targetDir : '');
})); }));

@ -17,7 +17,7 @@ use Composer\Test\TestCase;
class InitCommandTest extends TestCase class InitCommandTest extends TestCase
{ {
function testParseValidAuthorString() public function testParseValidAuthorString()
{ {
$command = new InitCommand; $command = new InitCommand;
$author = $command->parseAuthorString('John Smith <john@example.com>'); $author = $command->parseAuthorString('John Smith <john@example.com>');
@ -25,14 +25,14 @@ class InitCommandTest extends TestCase
$this->assertEquals('john@example.com', $author['email']); $this->assertEquals('john@example.com', $author['email']);
} }
function testParseEmptyAuthorString() public function testParseEmptyAuthorString()
{ {
$command = new InitCommand; $command = new InitCommand;
$this->setExpectedException('InvalidArgumentException'); $this->setExpectedException('InvalidArgumentException');
$command->parseAuthorString(''); $command->parseAuthorString('');
} }
function testParseAuthorStringWithInvalidEmail() public function testParseAuthorStringWithInvalidEmail()
{ {
$command = new InitCommand; $command = new InitCommand;
$this->setExpectedException('InvalidArgumentException'); $this->setExpectedException('InvalidArgumentException');

@ -13,9 +13,7 @@
namespace Composer\Test\Package\Archiver; namespace Composer\Test\Package\Archiver;
use Composer\Factory; use Composer\Factory;
use Composer\IO\NullIO;
use Composer\Package\Archiver; use Composer\Package\Archiver;
use Composer\Package\Archiver\ArchiveManager;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
class ArchiveManagerTest extends ArchiverTest class ArchiveManagerTest extends ArchiverTest

@ -13,7 +13,6 @@
namespace Composer\Test\Package; namespace Composer\Test\Package;
use Composer\Package\Locker; use Composer\Package\Locker;
use Composer\Package\CompletePackage;
class LockerTest extends \PHPUnit_Framework_TestCase class LockerTest extends \PHPUnit_Framework_TestCase
{ {

Loading…
Cancel
Save