1
0
Fork 0

Fixes for implicit variable declarations, return type mismatches and invalid method declarations.

pull/4972/head
Niels Keurentjes 2016-02-27 23:39:57 +01:00
parent b059cbe37c
commit f794ee7870
7 changed files with 26 additions and 8 deletions

View File

@ -40,6 +40,7 @@ class FileDownloader implements DownloaderInterface
protected $cache; protected $cache;
protected $outputProgress = true; protected $outputProgress = true;
private $lastCacheWrites = array(); private $lastCacheWrites = array();
private $eventDispatcher;
/** /**
* Constructor. * Constructor.

View File

@ -21,6 +21,7 @@ use Composer\Util\Perforce;
*/ */
class PerforceDownloader extends VcsDownloader class PerforceDownloader extends VcsDownloader
{ {
/** @var Perforce */
protected $perforce; protected $perforce;
/** /**
@ -34,7 +35,7 @@ class PerforceDownloader extends VcsDownloader
$this->io->writeError(' Cloning ' . $ref); $this->io->writeError(' Cloning ' . $ref);
$this->initPerforce($package, $path, $url); $this->initPerforce($package, $path, $url);
$this->perforce->setStream($ref); $this->perforce->setStream($ref);
$this->perforce->p4Login($this->io); $this->perforce->p4Login();
$this->perforce->writeP4ClientSpec(); $this->perforce->writeP4ClientSpec();
$this->perforce->connectClient(); $this->perforce->connectClient();
$this->perforce->syncCodeBase($label); $this->perforce->syncCodeBase($label);
@ -51,7 +52,7 @@ class PerforceDownloader extends VcsDownloader
return null; return null;
} }
public function initPerforce($package, $path, $url) public function initPerforce(PackageInterface $package, $path, $url)
{ {
if (!empty($this->perforce)) { if (!empty($this->perforce)) {
$this->perforce->initializePath($path); $this->perforce->initializePath($path);

View File

@ -23,10 +23,11 @@ class AliasPackage extends BasePackage implements CompletePackageInterface
protected $version; protected $version;
protected $prettyVersion; protected $prettyVersion;
protected $dev; protected $dev;
protected $aliasOf;
protected $rootPackageAlias = false; protected $rootPackageAlias = false;
protected $stability; protected $stability;
/** @var PackageInterface */
protected $aliasOf;
/** @var Link[] */ /** @var Link[] */
protected $requires; protected $requires;
/** @var Link[] */ /** @var Link[] */

View File

@ -38,6 +38,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
protected $loader; protected $loader;
protected $repoConfig; protected $repoConfig;
protected $branchErrorOccurred = false; protected $branchErrorOccurred = false;
private $drivers;
public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, array $drivers = null) public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, array $drivers = null)
{ {
@ -77,6 +78,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
if (isset($this->drivers[$this->type])) { if (isset($this->drivers[$this->type])) {
$class = $this->drivers[$this->type]; $class = $this->drivers[$this->type];
$driver = new $class($this->repoConfig, $this->io, $this->config); $driver = new $class($this->repoConfig, $this->io, $this->config);
/** @var VcsDriverInterface $driver */
$driver->initialize(); $driver->initialize();
return $driver; return $driver;
@ -85,6 +87,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
foreach ($this->drivers as $driver) { foreach ($this->drivers as $driver) {
if ($driver::supports($this->io, $this->config, $this->url)) { if ($driver::supports($this->io, $this->config, $this->url)) {
$driver = new $driver($this->repoConfig, $this->io, $this->config); $driver = new $driver($this->repoConfig, $this->io, $this->config);
/** @var VcsDriverInterface $driver */
$driver->initialize(); $driver->initialize();
return $driver; return $driver;
@ -94,6 +97,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
foreach ($this->drivers as $driver) { foreach ($this->drivers as $driver) {
if ($driver::supports($this->io, $this->config, $this->url, true)) { if ($driver::supports($this->io, $this->config, $this->url, true)) {
$driver = new $driver($this->repoConfig, $this->io, $this->config); $driver = new $driver($this->repoConfig, $this->io, $this->config);
/** @var VcsDriverInterface $driver */
$driver->initialize(); $driver->initialize();
return $driver; return $driver;

View File

@ -244,6 +244,7 @@ class Perforce
return $value; return $value;
} }
} }
return null;
} else { } else {
$command = 'echo $' . $name; $command = 'echo $' . $name;
$this->executeCommand($command); $this->executeCommand($command);
@ -516,18 +517,22 @@ class Perforce
return false; return false;
} }
/**
* @param $reference
* @return mixed|null
*/
protected function getChangeList($reference) protected function getChangeList($reference)
{ {
$index = strpos($reference, '@'); $index = strpos($reference, '@');
if ($index === false) { if ($index === false) {
return; return null;
} }
$label = substr($reference, $index); $label = substr($reference, $index);
$command = $this->generateP4Command(' changes -m1 ' . $label); $command = $this->generateP4Command(' changes -m1 ' . $label);
$this->executeCommand($command); $this->executeCommand($command);
$changes = $this->commandResult; $changes = $this->commandResult;
if (strpos($changes, 'Change') !== 0) { if (strpos($changes, 'Change') !== 0) {
return; return null;
} }
$fields = explode(' ', $changes); $fields = explode(' ', $changes);
$changeList = $fields[1]; $changeList = $fields[1];
@ -535,15 +540,20 @@ class Perforce
return $changeList; return $changeList;
} }
/**
* @param $fromReference
* @param $toReference
* @return mixed|null
*/
public function getCommitLogs($fromReference, $toReference) public function getCommitLogs($fromReference, $toReference)
{ {
$fromChangeList = $this->getChangeList($fromReference); $fromChangeList = $this->getChangeList($fromReference);
if ($fromChangeList == null) { if ($fromChangeList == null) {
return; return null;
} }
$toChangeList = $this->getChangeList($toReference); $toChangeList = $this->getChangeList($toReference);
if ($toChangeList == null) { if ($toChangeList == null) {
return; return null;
} }
$index = strpos($fromReference, '@'); $index = strpos($fromReference, '@');
$main = substr($fromReference, 0, $index) . '/...'; $main = substr($fromReference, 0, $index) . '/...';

View File

@ -25,6 +25,7 @@ class RemoteFilesystem
{ {
private $io; private $io;
private $config; private $config;
private $scheme;
private $bytesMax; private $bytesMax;
private $originUrl; private $originUrl;
private $fileUrl; private $fileUrl;

View File

@ -247,7 +247,7 @@ EOT;
/** /**
* Convert certificate name into matching function. * Convert certificate name into matching function.
* *
* @param $certName CN/SAN * @param string $certName CN/SAN
* *
* @return callable|null * @return callable|null
*/ */