Browse Source

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

Niels Keurentjes 9 years ago
parent
commit
f794ee7870

+ 1 - 0
src/Composer/Downloader/FileDownloader.php

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

+ 3 - 2
src/Composer/Downloader/PerforceDownloader.php

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

+ 2 - 1
src/Composer/Package/AliasPackage.php

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

+ 4 - 0
src/Composer/Repository/VcsRepository.php

@@ -38,6 +38,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
     protected $loader;
     protected $repoConfig;
     protected $branchErrorOccurred = false;
+    private $drivers;
 
     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])) {
             $class = $this->drivers[$this->type];
             $driver = new $class($this->repoConfig, $this->io, $this->config);
+            /** @var VcsDriverInterface $driver */
             $driver->initialize();
 
             return $driver;
@@ -85,6 +87,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
         foreach ($this->drivers as $driver) {
             if ($driver::supports($this->io, $this->config, $this->url)) {
                 $driver = new $driver($this->repoConfig, $this->io, $this->config);
+                /** @var VcsDriverInterface $driver */
                 $driver->initialize();
 
                 return $driver;
@@ -94,6 +97,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
         foreach ($this->drivers as $driver) {
             if ($driver::supports($this->io, $this->config, $this->url, true)) {
                 $driver = new $driver($this->repoConfig, $this->io, $this->config);
+                /** @var VcsDriverInterface $driver */
                 $driver->initialize();
 
                 return $driver;

+ 14 - 4
src/Composer/Util/Perforce.php

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

+ 1 - 0
src/Composer/Util/RemoteFilesystem.php

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

+ 1 - 1
src/Composer/Util/TlsHelper.php

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