More PSR-2 goodness

main
Jordi Boggiano 12 years ago
parent 99513ba52b
commit c440b4594a

@ -26,7 +26,7 @@ class ClassMapGenerator
* @param Traversable $dirs Directories or a single path to search in
* @param string $file The name of the class map file
*/
static public function dump($dirs, $file)
public static function dump($dirs, $file)
{
$maps = array();
@ -44,7 +44,7 @@ class ClassMapGenerator
*
* @return array A class map array
*/
static public function createMap($dir)
public static function createMap($dir)
{
if (is_string($dir)) {
if (is_file($dir)) {
@ -85,7 +85,7 @@ class ClassMapGenerator
*
* @return array The found classes
*/
static private function findClasses($path)
private static function findClasses($path)
{
$contents = file_get_contents($path);
try {

@ -25,19 +25,19 @@ interface OperationInterface
*
* @return string
*/
function getJobType();
public function getJobType();
/**
* Returns operation reason.
*
* @return string
*/
function getReason();
public function getReason();
/**
* Serializes the operation in a human readable format
*
* @return string
*/
function __toString();
public function __toString();
}

@ -19,7 +19,7 @@ use Composer\Package\PackageInterface;
*/
interface PolicyInterface
{
function versionCompare(PackageInterface $a, PackageInterface $b, $operator);
function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package);
function selectPreferedPackages(Pool $pool, array $installedMap, array $literals);
public function versionCompare(PackageInterface $a, PackageInterface $b, $operator);
public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package);
public function selectPreferedPackages(Pool $pool, array $installedMap, array $literals);
}

@ -27,7 +27,7 @@ interface DownloaderInterface
*
* @return string "source" or "dist"
*/
function getInstallationSource();
public function getInstallationSource();
/**
* Downloads specific package into specific folder.
@ -35,7 +35,7 @@ interface DownloaderInterface
* @param PackageInterface $package package instance
* @param string $path download path
*/
function download(PackageInterface $package, $path);
public function download(PackageInterface $package, $path);
/**
* Updates specific package in specific folder from initial to target version.
@ -44,7 +44,7 @@ interface DownloaderInterface
* @param PackageInterface $target updated package
* @param string $path download path
*/
function update(PackageInterface $initial, PackageInterface $target, $path);
public function update(PackageInterface $initial, PackageInterface $target, $path);
/**
* Removes specific package from specific folder.
@ -52,5 +52,5 @@ interface DownloaderInterface
* @param PackageInterface $package package instance
* @param string $path download path
*/
function remove(PackageInterface $package, $path);
public function remove(PackageInterface $package, $path);
}

@ -254,7 +254,7 @@ class Factory
* @param mixed $config either a configuration array or a filename to read from, if null it will read from the default filename
* @return Composer
*/
static public function create(IOInterface $io, $config = null)
public static function create(IOInterface $io, $config = null)
{
$factory = new static();

@ -24,21 +24,21 @@ interface IOInterface
*
* @return Boolean
*/
function isInteractive();
public function isInteractive();
/**
* Is this input verbose?
*
* @return Boolean
*/
function isVerbose();
public function isVerbose();
/**
* Is this output decorated?
*
* @return Boolean
*/
function isDecorated();
public function isDecorated();
/**
* Writes a message to the output.
@ -46,7 +46,7 @@ interface IOInterface
* @param string|array $messages The message as an array of lines or a single string
* @param Boolean $newline Whether to add a newline or not
*/
function write($messages, $newline = true);
public function write($messages, $newline = true);
/**
* Overwrites a previous message to the output.
@ -55,7 +55,7 @@ interface IOInterface
* @param Boolean $newline Whether to add a newline or not
* @param integer $size The size of line
*/
function overwrite($messages, $newline = true, $size = 80);
public function overwrite($messages, $newline = true, $size = 80);
/**
* Asks a question to the user.
@ -67,7 +67,7 @@ interface IOInterface
*
* @throws \RuntimeException If there is no data to read in the input stream
*/
function ask($question, $default = null);
public function ask($question, $default = null);
/**
* Asks a confirmation to the user.
@ -79,7 +79,7 @@ interface IOInterface
*
* @return Boolean true if the user has confirmed, false otherwise
*/
function askConfirmation($question, $default = true);
public function askConfirmation($question, $default = true);
/**
* Asks for a value and validates the response.
@ -97,7 +97,7 @@ interface IOInterface
*
* @throws \Exception When any of the validators return an error
*/
function askAndValidate($question, $validator, $attempts = false, $default = null);
public function askAndValidate($question, $validator, $attempts = false, $default = null);
/**
* Asks a question to the user and hide the answer.
@ -106,14 +106,14 @@ interface IOInterface
*
* @return string The answer
*/
function askAndHideAnswer($question);
public function askAndHideAnswer($question);
/**
* Get all authorization informations entered.
*
* @return array The map of authorization
*/
function getAuthorizations();
public function getAuthorizations();
/**
* Verify if the repository has a authorization informations.
@ -122,7 +122,7 @@ interface IOInterface
*
* @return boolean
*/
function hasAuthorization($repositoryName);
public function hasAuthorization($repositoryName);
/**
* Get the username and password of repository.
@ -131,7 +131,7 @@ interface IOInterface
*
* @return array The 'username' and 'password'
*/
function getAuthorization($repositoryName);
public function getAuthorization($repositoryName);
/**
* Set the authorization informations for the repository.
@ -140,5 +140,5 @@ interface IOInterface
* @param string $username The username
* @param string $password The password
*/
function setAuthorization($repositoryName, $username, $password = null);
public function setAuthorization($repositoryName, $username, $password = null);
}

@ -452,7 +452,7 @@ class Installer
* @param AutoloadGenerator $autoloadGenerator
* @return Installer
*/
static public function create(IOInterface $io, Composer $composer, EventDispatcher $eventDispatcher = null, AutoloadGenerator $autoloadGenerator = null)
public static function create(IOInterface $io, Composer $composer, EventDispatcher $eventDispatcher = null, AutoloadGenerator $autoloadGenerator = null)
{
$eventDispatcher = $eventDispatcher ?: new EventDispatcher($composer, $io);
$autoloadGenerator = $autoloadGenerator ?: new AutoloadGenerator;

@ -29,7 +29,7 @@ interface InstallerInterface
* @param string $packageType
* @return Boolean
*/
function supports($packageType);
public function supports($packageType);
/**
* Checks that provided package is installed.
@ -39,7 +39,7 @@ interface InstallerInterface
*
* @return Boolean
*/
function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package);
public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package);
/**
* Installs specific package.
@ -47,7 +47,7 @@ interface InstallerInterface
* @param InstalledRepositoryInterface $repo repository in which to check
* @param PackageInterface $package package instance
*/
function install(InstalledRepositoryInterface $repo, PackageInterface $package);
public function install(InstalledRepositoryInterface $repo, PackageInterface $package);
/**
* Updates specific package.
@ -58,7 +58,7 @@ interface InstallerInterface
*
* @throws InvalidArgumentException if $from package is not installed
*/
function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target);
public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target);
/**
* Uninstalls specific package.
@ -66,7 +66,7 @@ interface InstallerInterface
* @param InstalledRepositoryInterface $repo repository in which to check
* @param PackageInterface $package package instance
*/
function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package);
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package);
/**
* Returns the installation path of a package
@ -74,5 +74,5 @@ interface InstallerInterface
* @param PackageInterface $package
* @return string path
*/
function getInstallPath(PackageInterface $package);
public function getInstallPath(PackageInterface $package);
}

@ -166,7 +166,7 @@ class JsonFile
* @param int $options json_encode options (defaults to JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)
* @return string Encoded json
*/
static public function encode($data, $options = 448)
public static function encode($data, $options = 448)
{
if (version_compare(PHP_VERSION, '5.4', '>=')) {
return json_encode($data, $options);

@ -19,6 +19,6 @@ namespace Composer\Package\LinkConstraint;
*/
interface LinkConstraintInterface
{
function matches(LinkConstraintInterface $provider);
function __toString();
public function matches(LinkConstraintInterface $provider);
public function __toString();
}

@ -25,14 +25,14 @@ interface PackageInterface
*
* @return string package name
*/
function getName();
public function getName();
/**
* Returns the package's pretty (i.e. with proper case) name
*
* @return string package name
*/
function getPrettyName();
public function getPrettyName();
/**
* Returns a set of names that could refer to this package
@ -42,21 +42,21 @@ interface PackageInterface
*
* @return array An array of strings referring to this package
*/
function getNames();
public function getNames();
/**
* Allows the solver to set an id for this package to refer to it.
*
* @param int $id
*/
function setId($id);
public function setId($id);
/**
* Retrieves the package's id set through setId
*
* @return int The previously set package id
*/
function getId();
public function getId();
/**
* Checks if the package matches the given constraint directly or through
@ -66,133 +66,133 @@ interface PackageInterface
* @param LinkConstraintInterface $constraint The constraint to verify
* @return bool Whether this package matches the name and constraint
*/
function matches($name, LinkConstraintInterface $constraint);
public function matches($name, LinkConstraintInterface $constraint);
/**
* Returns whether the package is a development virtual package or a concrete one
*
* @return Boolean
*/
function isDev();
public function isDev();
/**
* Returns the package type, e.g. library
*
* @return string The package type
*/
function getType();
public function getType();
/**
* Returns the package targetDir property
*
* @return string The package targetDir
*/
function getTargetDir();
public function getTargetDir();
/**
* Returns the package extra data
*
* @return array The package extra data
*/
function getExtra();
public function getExtra();
/**
* Sets source from which this package was installed (source/dist).
*
* @param string $type source/dist
*/
function setInstallationSource($type);
public function setInstallationSource($type);
/**
* Returns source from which this package was installed (source/dist).
*
* @param string $type source/dist
*/
function getInstallationSource();
public function getInstallationSource();
/**
* Returns the repository type of this package, e.g. git, svn
*
* @return string The repository type
*/
function getSourceType();
public function getSourceType();
/**
* Returns the repository url of this package, e.g. git://github.com/naderman/composer.git
*
* @return string The repository url
*/
function getSourceUrl();
public function getSourceUrl();
/**
* Returns the repository reference of this package, e.g. master, 1.0.0 or a commit hash for git
*
* @return string The repository reference
*/
function getSourceReference();
public function getSourceReference();
/**
* Returns the type of the distribution archive of this version, e.g. zip, tarball
*
* @return string The repository type
*/
function getDistType();
public function getDistType();
/**
* Returns the url of the distribution archive of this version
*
* @return string
*/
function getDistUrl();
public function getDistUrl();
/**
* Returns the reference of the distribution archive of this version, e.g. master, 1.0.0 or a commit hash for git
*
* @return string
*/
function getDistReference();
public function getDistReference();
/**
* Returns the sha1 checksum for the distribution archive of this version
*
* @return string
*/
function getDistSha1Checksum();
public function getDistSha1Checksum();
/**
* Returns the scripts of this package
*
* @return array array('script name' => array('listeners'))
*/
function getScripts();
public function getScripts();
/**
* Returns the version of this package
*
* @return string version
*/
function getVersion();
public function getVersion();
/**
* Returns the pretty (i.e. non-normalized) version string of this package
*
* @return string version
*/
function getPrettyVersion();
public function getPrettyVersion();
/**
* Returns the stability of this package: one of (dev, alpha, beta, RC, stable)
*
* @return string
*/
function getStability();
public function getStability();
/**
* Returns the package license, e.g. MIT, BSD, GPL
*
* @return array The package licenses
*/
function getLicense();
public function getLicense();
/**
* Returns a set of links to packages which need to be installed before
@ -200,7 +200,7 @@ interface PackageInterface
*
* @return array An array of package links defining required packages
*/
function getRequires();
public function getRequires();
/**
* Returns a set of links to packages which must not be installed at the
@ -208,7 +208,7 @@ interface PackageInterface
*
* @return array An array of package links defining conflicting packages
*/
function getConflicts();
public function getConflicts();
/**
* Returns a set of links to virtual packages that are provided through
@ -216,7 +216,7 @@ interface PackageInterface
*
* @return array An array of package links defining provided packages
*/
function getProvides();
public function getProvides();
/**
* Returns a set of links to packages which can alternatively be
@ -224,7 +224,7 @@ interface PackageInterface
*
* @return array An array of package links defining replaced packages
*/
function getReplaces();
public function getReplaces();
/**
* Returns a set of links to packages which are required to develop
@ -232,7 +232,7 @@ interface PackageInterface
*
* @return array An array of package links defining packages required for development
*/
function getDevRequires();
public function getDevRequires();
/**
* Returns a set of package names and reasons why they are useful in
@ -240,7 +240,7 @@ interface PackageInterface
*
* @return array An array of package suggestions with descriptions
*/
function getSuggests();
public function getSuggests();
/**
* Returns an associative array of autoloading rules
@ -252,7 +252,7 @@ interface PackageInterface
*
* @return array Mapping of autoloading rules
*/
function getAutoload();
public function getAutoload();
/**
* Returns a list of directories which should get added to PHP's
@ -260,7 +260,7 @@ interface PackageInterface
*
* @return array
*/
function getIncludePaths();
public function getIncludePaths();
/**
* Returns an array of repositories
@ -269,56 +269,56 @@ interface PackageInterface
*
* @return array Repositories
*/
function getRepositories();
public function getRepositories();
/**
* Stores a reference to the repository that owns the package
*
* @param RepositoryInterface $repository
*/
function setRepository(RepositoryInterface $repository);
public function setRepository(RepositoryInterface $repository);
/**
* Returns a reference to the repository that owns the package
*
* @return RepositoryInterface
*/
function getRepository();
public function getRepository();
/**
* Returns the release date of the package
*
* @return \DateTime
*/
function getReleaseDate();
public function getReleaseDate();
/**
* Returns an array of keywords relating to the package
*
* @return array
*/
function getKeywords();
public function getKeywords();
/**
* Returns the package description
*
* @return string
*/
function getDescription();
public function getDescription();
/**
* Returns the package binaries
*
* @return array
*/
function getBinaries();
public function getBinaries();
/**
* Returns the package homepage
*
* @return string
*/
function getHomepage();
public function getHomepage();
/**
* Returns an array of authors of the package
@ -327,33 +327,33 @@ interface PackageInterface
*
* @return array
*/
function getAuthors();
public function getAuthors();
/**
* Returns a version this package should be aliased to
*
* @return string
*/
function getAlias();
public function getAlias();
/**
* Returns a non-normalized version this package should be aliased to
*
* @return string
*/
function getPrettyAlias();
public function getPrettyAlias();
/**
* Returns package unique name, constructed from name and version.
*
* @return string
*/
function getUniqueName();
public function getUniqueName();
/**
* Converts the package into a readable and unique string
*
* @return string
*/
function __toString();
public function __toString();
}

@ -32,7 +32,7 @@ class VersionParser
* @param string $version
* @return string
*/
static public function parseStability($version)
public static function parseStability($version)
{
$version = preg_replace('{#[a-f0-9]+$}i', '', $version);
@ -52,14 +52,14 @@ class VersionParser
return 'stable';
}
static public function normalizeStability($stability)
public static function normalizeStability($stability)
{
$stability = strtolower($stability);
return $stability === 'rc' ? 'RC' : $stability;
}
static public function formatVersion(PackageInterface $package, $truncate = true)
public static function formatVersion(PackageInterface $package, $truncate = true)
{
if (!$package->isDev() || !in_array($package->getSourceType(), array('hg', 'git'))) {
return $package->getPrettyVersion();

@ -24,5 +24,5 @@ interface NotifiableRepositoryInterface extends RepositoryInterface
*
* @param PackageInterface $package Package that is installed
*/
function notifyInstall(PackageInterface $package);
public function notifyInstall(PackageInterface $package);
}

@ -29,7 +29,7 @@ interface RepositoryInterface extends \Countable
*
* @return Boolean
*/
function hasPackage(PackageInterface $package);
public function hasPackage(PackageInterface $package);
/**
* Searches for the first match of a package by name and version.
@ -39,7 +39,7 @@ interface RepositoryInterface extends \Countable
*
* @return PackageInterface|null
*/
function findPackage($name, $version);
public function findPackage($name, $version);
/**
* Searches for all packages matching a name and optionally a version.
@ -49,12 +49,12 @@ interface RepositoryInterface extends \Countable
*
* @return array
*/
function findPackages($name, $version = null);
public function findPackages($name, $version = null);
/**
* Returns list of registered packages.
*
* @return array
*/
function getPackages();
public function getPackages();
}

@ -22,7 +22,7 @@ interface VcsDriverInterface
/**
* Initializes the driver (git clone, svn checkout, fetch info etc)
*/
function initialize();
public function initialize();
/**
* Return the composer.json file information
@ -30,47 +30,47 @@ interface VcsDriverInterface
* @param string $identifier Any identifier to a specific branch/tag/commit
* @return array containing all infos from the composer.json file
*/
function getComposerInformation($identifier);
public function getComposerInformation($identifier);
/**
* Return the root identifier (trunk, master, default/tip ..)
*
* @return string Identifier
*/
function getRootIdentifier();
public function getRootIdentifier();
/**
* Return list of branches in the repository
*
* @return array Branch names as keys, identifiers as values
*/
function getBranches();
public function getBranches();
/**
* Return list of tags in the repository
*
* @return array Tag names as keys, identifiers as values
*/
function getTags();
public function getTags();
/**
* @param string $identifier Any identifier to a specific branch/tag/commit
* @return array With type, url reference and shasum keys.
*/
function getDist($identifier);
public function getDist($identifier);
/**
* @param string $identifier Any identifier to a specific branch/tag/commit
* @return array With type, url and reference keys.
*/
function getSource($identifier);
public function getSource($identifier);
/**
* Return the URL of the repository
*
* @return string
*/
function getUrl();
public function getUrl();
/**
* Return true if the repository has a composer file for a given identifier,
@ -79,7 +79,7 @@ interface VcsDriverInterface
* @param string $identifier Any identifier to a specific branch/tag/commit
* @return boolean Whether the repository has a composer file for a given identifier.
*/
function hasComposerFile($identifier);
public function hasComposerFile($identifier);
/**
* Checks if this driver can handle a given url
@ -89,5 +89,5 @@ interface VcsDriverInterface
* @param Boolean $shallow unless true, only shallow checks (url matching typically) should be done
* @return Boolean
*/
static function supports(IOInterface $io, $url, $deep = false);
public static function supports(IOInterface $io, $url, $deep = false);
}

@ -24,24 +24,24 @@ interface WritableRepositoryInterface extends RepositoryInterface
/**
* Writes repository (f.e. to the disc).
*/
function write();
public function write();
/**
* Adds package to the repository.
*
* @param PackageInterface $package package instance
*/
function addPackage(PackageInterface $package);
public function addPackage(PackageInterface $package);
/**
* Removes package from the repository.
*
* @param PackageInterface $package package instance
*/
function removePackage(PackageInterface $package);
public function removePackage(PackageInterface $package);
/**
* Forces a reload of all packages
*/
function reload();
public function reload();
}

@ -19,7 +19,7 @@ use Symfony\Component\Process\Process;
*/
class ProcessExecutor
{
static protected $timeout = 300;
protected static $timeout = 300;
protected $captureOutput;
protected $errorOutput;
@ -75,12 +75,12 @@ class ProcessExecutor
echo $buffer;
}
static public function getTimeout()
public static function getTimeout()
{
return static::$timeout;
}
static public function setTimeout($timeout)
public static function setTimeout($timeout)
{
static::$timeout = $timeout;
}

@ -27,7 +27,7 @@ final class StreamContextFactory
* @return resource Default context
* @throws \RuntimeException if https proxy required and OpenSSL uninstalled
*/
static public function getContext(array $defaultOptions = array(), array $defaultParams = array())
public static function getContext(array $defaultOptions = array(), array $defaultParams = array())
{
$options = array('http' => array());

Loading…
Cancel
Save