Ver Fonte

Merge branch 'master' into 2.0

Jordi Boggiano há 6 anos atrás
pai
commit
0317199507
34 ficheiros alterados com 105 adições e 30 exclusões
  1. 1 1
      composer.json
  2. 18 17
      composer.lock
  3. 3 3
      doc/00-intro.md
  4. 2 1
      src/Composer/Cache.php
  5. 1 0
      src/Composer/Command/ArchiveCommand.php
  6. 2 0
      src/Composer/Command/ClearCacheCommand.php
  7. 2 0
      src/Composer/Command/ConfigCommand.php
  8. 1 0
      src/Composer/Command/CreateProjectCommand.php
  9. 1 0
      src/Composer/Command/DependsCommand.php
  10. 1 0
      src/Composer/Command/DiagnoseCommand.php
  11. 2 0
      src/Composer/Command/DumpAutoloadCommand.php
  12. 7 0
      src/Composer/Command/ExecCommand.php
  13. 1 0
      src/Composer/Command/GlobalCommand.php
  14. 2 0
      src/Composer/Command/HomeCommand.php
  15. 12 4
      src/Composer/Command/InitCommand.php
  16. 1 0
      src/Composer/Command/InstallCommand.php
  17. 1 0
      src/Composer/Command/LicensesCommand.php
  18. 1 1
      src/Composer/Command/OutdatedCommand.php
  19. 1 0
      src/Composer/Command/ProhibitsCommand.php
  20. 1 0
      src/Composer/Command/RemoveCommand.php
  21. 1 0
      src/Composer/Command/RequireCommand.php
  22. 2 0
      src/Composer/Command/RunScriptCommand.php
  23. 2 0
      src/Composer/Command/ScriptAliasCommand.php
  24. 1 0
      src/Composer/Command/SearchCommand.php
  25. 1 0
      src/Composer/Command/SelfUpdateCommand.php
  26. 1 0
      src/Composer/Command/ShowCommand.php
  27. 1 0
      src/Composer/Command/StatusCommand.php
  28. 1 0
      src/Composer/Command/SuggestsCommand.php
  29. 1 0
      src/Composer/Command/UpdateCommand.php
  30. 1 0
      src/Composer/Command/ValidateCommand.php
  31. 0 1
      src/Composer/DependencyResolver/Problem.php
  32. 30 0
      src/Composer/Repository/VcsRepository.php
  33. 1 1
      src/Composer/Repository/VersionCacheInterface.php
  34. 1 1
      src/Composer/Util/Filesystem.php

+ 1 - 1
composer.json

@@ -1,7 +1,7 @@
 {
     "name": "composer/composer",
     "type": "library",
-    "description": "Composer helps you declare, manage and install dependencies of PHP projects, ensuring you have the right stack everywhere.",
+    "description": "Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.",
     "keywords": [
         "package",
         "dependency",

+ 18 - 17
composer.lock

@@ -64,16 +64,16 @@
         },
         {
             "name": "composer/semver",
-            "version": "1.4.2",
+            "version": "1.5.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/composer/semver.git",
-                "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573"
+                "reference": "46d9139568ccb8d9e7cdd4539cab7347568a5e2e"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/composer/semver/zipball/c7cb9a2095a074d131b65a8a0cd294479d785573",
-                "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573",
+                "url": "https://api.github.com/repos/composer/semver/zipball/46d9139568ccb8d9e7cdd4539cab7347568a5e2e",
+                "reference": "46d9139568ccb8d9e7cdd4539cab7347568a5e2e",
                 "shasum": ""
             },
             "require": {
@@ -122,7 +122,7 @@
                 "validation",
                 "versioning"
             ],
-            "time": "2016-08-30T16:08:34+00:00"
+            "time": "2019-03-19T17:25:45+00:00"
         },
         {
             "name": "composer/spdx-licenses",
@@ -231,23 +231,23 @@
         },
         {
             "name": "justinrainbow/json-schema",
-            "version": "5.2.7",
+            "version": "5.2.8",
             "source": {
                 "type": "git",
                 "url": "https://github.com/justinrainbow/json-schema.git",
-                "reference": "8560d4314577199ba51bf2032f02cd1315587c23"
+                "reference": "dcb6e1006bb5fd1e392b4daa68932880f37550d4"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/8560d4314577199ba51bf2032f02cd1315587c23",
-                "reference": "8560d4314577199ba51bf2032f02cd1315587c23",
+                "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/dcb6e1006bb5fd1e392b4daa68932880f37550d4",
+                "reference": "dcb6e1006bb5fd1e392b4daa68932880f37550d4",
                 "shasum": ""
             },
             "require": {
                 "php": ">=5.3.3"
             },
             "require-dev": {
-                "friendsofphp/php-cs-fixer": "^2.1",
+                "friendsofphp/php-cs-fixer": "~2.2.20",
                 "json-schema/json-schema-test-suite": "1.2.0",
                 "phpunit/phpunit": "^4.8.35"
             },
@@ -293,7 +293,7 @@
                 "json",
                 "schema"
             ],
-            "time": "2018-02-14T22:26:30+00:00"
+            "time": "2019-01-14T23:55:14+00:00"
         },
         {
             "name": "psr/log",
@@ -481,7 +481,7 @@
         },
         {
             "name": "symfony/console",
-            "version": "v2.8.48",
+            "version": "v2.8.49",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/console.git",
@@ -542,7 +542,7 @@
         },
         {
             "name": "symfony/debug",
-            "version": "v2.8.48",
+            "version": "v2.8.49",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/debug.git",
@@ -599,7 +599,7 @@
         },
         {
             "name": "symfony/filesystem",
-            "version": "v2.8.48",
+            "version": "v2.8.49",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/filesystem.git",
@@ -649,7 +649,7 @@
         },
         {
             "name": "symfony/finder",
-            "version": "v2.8.48",
+            "version": "v2.8.49",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/finder.git",
@@ -815,7 +815,7 @@
         },
         {
             "name": "symfony/process",
-            "version": "v2.8.48",
+            "version": "v2.8.49",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/process.git",
@@ -1404,6 +1404,7 @@
                 "mock",
                 "xunit"
             ],
+            "abandoned": true,
             "time": "2015-10-02T06:51:40+00:00"
         },
         {
@@ -1780,7 +1781,7 @@
         },
         {
             "name": "symfony/yaml",
-            "version": "v2.8.48",
+            "version": "v2.8.49",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/yaml.git",

+ 3 - 3
doc/00-intro.md

@@ -10,7 +10,7 @@ Composer is **not** a package manager in the same sense as Yum or Apt are. Yes,
 it deals with "packages" or libraries, but it manages them on a per-project
 basis, installing them in a directory (e.g. `vendor`) inside your project. By
 default it does not install anything globally. Thus, it is a dependency
-manager. It does however support a "global" project for convenience via the
+manager. It does however support a "global" project for convenience via the 
 [global](03-cli.md#global) command.
 
 This idea is not new and Composer is strongly inspired by node's
@@ -47,7 +47,7 @@ Linux and macOS.
 ### Downloading the Composer Executable
 
 Composer offers a convenient installer that you can execute directly from the
-commandline. Feel free to [download this file](https://getcomposer.org/installer)
+command line. Feel free to [download this file](https://getcomposer.org/installer)
 or review it on [GitHub](https://github.com/composer/getcomposer.org/blob/master/web/installer)
 if you wish to know more about the inner workings of the installer. The source
 is plain PHP.
@@ -82,7 +82,7 @@ Now run `php bin/composer` in order to run Composer.
 #### Globally
 
 You can place the Composer PHAR anywhere you wish. If you put it in a directory
-that is part of your `PATH`, you can access it globally. On unixy systems you
+that is part of your `PATH`, you can access it globally. On Unix systems you
 can even make it executable and invoke it without directly using the `php`
 interpreter.
 

+ 2 - 1
src/Composer/Cache.php

@@ -189,7 +189,8 @@ class Cache
     public function clear()
     {
         if ($this->enabled) {
-            return $this->filesystem->removeDirectory($this->root);
+            $this->filesystem->emptyDirectory($this->root);
+            return true;
         }
 
         return false;

+ 1 - 0
src/Composer/Command/ArchiveCommand.php

@@ -57,6 +57,7 @@ package in the specified version and writes it to the specified directory.
 
 <info>php composer.phar archive [--format=zip] [--dir=/foo] [package [version]]</info>
 
+Read more at https://getcomposer.org/doc/03-cli.md#archive
 EOT
             )
         ;

+ 2 - 0
src/Composer/Command/ClearCacheCommand.php

@@ -32,6 +32,8 @@ class ClearCacheCommand extends BaseCommand
                 <<<EOT
 The <info>clear-cache</info> deletes all cached packages from composer's
 cache directory.
+
+Read more at https://getcomposer.org/doc/03-cli.md#clear-cache-clearcache-
 EOT
             )
         ;

+ 2 - 0
src/Composer/Command/ConfigCommand.php

@@ -125,6 +125,8 @@ You can always pass more than one option. As an example, if you want to edit the
 global config.json file.
 
     <comment>%command.full_name% --editor --global</comment>
+
+Read more at https://getcomposer.org/doc/03-cli.md#config
 EOT
             )
         ;

+ 1 - 0
src/Composer/Command/CreateProjectCommand.php

@@ -105,6 +105,7 @@ controlled code by appending the <info>'--prefer-source'</info> flag.
 To install a package from another repository than the default one you
 can pass the <info>'--repository=https://myrepository.org'</info> flag.
 
+Read more at https://getcomposer.org/doc/03-cli.md#create-project
 EOT
             )
         ;

+ 1 - 0
src/Composer/Command/DependsCommand.php

@@ -37,6 +37,7 @@ Displays detailed information about where a package is referenced.
 
 <info>php composer.phar depends composer/composer</info>
 
+Read more at https://getcomposer.org/doc/03-cli.md#depends-why-
 EOT
             )
         ;

+ 1 - 0
src/Composer/Command/DiagnoseCommand.php

@@ -55,6 +55,7 @@ The <info>diagnose</info> command checks common errors to help debugging problem
 
 The process exit code will be 1 in case of warnings and 2 for errors.
 
+Read more at https://getcomposer.org/doc/03-cli.md#diagnose
 EOT
             )
         ;

+ 2 - 0
src/Composer/Command/DumpAutoloadCommand.php

@@ -39,6 +39,8 @@ class DumpAutoloadCommand extends BaseCommand
             ->setHelp(
                 <<<EOT
 <info>php composer.phar dump-autoload</info>
+
+Read more at https://getcomposer.org/doc/03-cli.md#dump-autoload-dumpautoload-
 EOT
             )
         ;

+ 7 - 0
src/Composer/Command/ExecCommand.php

@@ -36,6 +36,13 @@ class ExecCommand extends BaseCommand
                     'Arguments to pass to the binary. Use <info>--</info> to separate from composer arguments'
                 ),
             ))
+            ->setHelp(
+                <<<EOT
+Executes a vendored binary/script.
+                
+Read more at https://getcomposer.org/doc/03-cli.md#exec
+EOT
+            )
         ;
     }
 

+ 1 - 0
src/Composer/Command/GlobalCommand.php

@@ -50,6 +50,7 @@ XDG_CONFIG_HOME or default to /home/<user>/.config/composer
 Note: This path may vary depending on customizations to bin-dir in
 composer.json or the environmental variable COMPOSER_BIN_DIR.
 
+Read more at https://getcomposer.org/doc/03-cli.md#global
 EOT
             )
         ;

+ 2 - 0
src/Composer/Command/HomeCommand.php

@@ -49,6 +49,8 @@ homepage in your default browser.
 
 To open the homepage by default, use -H or --homepage.
 To show instead of open the repository or homepage URL, use -s or --show.
+
+Read more at https://getcomposer.org/doc/03-cli.md#browse-home
 EOT
             );
     }

+ 12 - 4
src/Composer/Command/InitCommand.php

@@ -72,6 +72,7 @@ in the current directory.
 
 <info>php composer.phar init</info>
 
+Read more at https://getcomposer.org/doc/03-cli.md#init
 EOT
             )
         ;
@@ -694,15 +695,22 @@ EOT
     {
         // find the latest version allowed in this repo set
         $versionSelector = new VersionSelector($this->getRepositorySet($input, $minimumStability));
-        $package = $versionSelector->findBestCandidate($name, $requiredVersion, $phpVersion, $preferredStability);
+        $ignorePlatformReqs = $input->hasOption('ignore-platform-reqs') && $input->getOption('ignore-platform-reqs');
 
-        // retry without phpVersion if platform requirements are ignored in case nothing was found
-        if ($input->hasOption('ignore-platform-reqs') && $input->getOption('ignore-platform-reqs')) {
+        // ignore phpVersion if platform requirements are ignored
+        if ($ignorePlatformReqs) {
             $phpVersion = null;
-            $package = $versionSelector->findBestCandidate($name, $requiredVersion, $phpVersion, $preferredStability);
         }
 
+        $package = $versionSelector->findBestCandidate($name, $requiredVersion, $phpVersion, $preferredStability);
+
         if (!$package) {
+            // platform packages can not be found in the pool in versions other than the local platform's has
+            // so if platform reqs are ignored we just take the user's word for it
+            if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
+                return array($name, $requiredVersion ?: '*');
+            }
+
             // Check whether the PHP version was the problem
             if ($phpVersion && $versionSelector->findBestCandidate($name, $requiredVersion, null, $preferredStability)) {
                 throw new \InvalidArgumentException(sprintf(

+ 1 - 0
src/Composer/Command/InstallCommand.php

@@ -61,6 +61,7 @@ exist it will look for composer.json and do the same.
 
 <info>php composer.phar install</info>
 
+Read more at https://getcomposer.org/doc/03-cli.md#install-i
 EOT
             )
         ;

+ 1 - 0
src/Composer/Command/LicensesCommand.php

@@ -41,6 +41,7 @@ class LicensesCommand extends BaseCommand
 The license command displays detailed information about the licenses of
 the installed dependencies.
 
+Read more at https://getcomposer.org/doc/03-cli.md#licenses
 EOT
             )
         ;

+ 1 - 1
src/Composer/Command/OutdatedCommand.php

@@ -50,7 +50,7 @@ The color coding (or signage if you have ANSI colors disabled) for dependency ve
   may involve work.
 - <highlight>red</highlight> (!): Dependency has a new version that is semver-compatible and you should upgrade it.
 
-
+Read more at https://getcomposer.org/doc/03-cli.md#outdated
 EOT
             )
         ;

+ 1 - 0
src/Composer/Command/ProhibitsCommand.php

@@ -37,6 +37,7 @@ Displays detailed information about why a package cannot be installed.
 
 <info>php composer.phar prohibits composer/composer</info>
 
+Read more at https://getcomposer.org/doc/03-cli.md#prohibits-why-not-
 EOT
             )
         ;

+ 1 - 0
src/Composer/Command/RemoveCommand.php

@@ -56,6 +56,7 @@ list of installed packages
 
 <info>php composer.phar remove</info>
 
+Read more at https://getcomposer.org/doc/03-cli.md#remove
 EOT
             )
         ;

+ 1 - 0
src/Composer/Command/RequireCommand.php

@@ -73,6 +73,7 @@ If you do not specify a version constraint, composer will choose a suitable one
 
 If you do not want to install the new dependencies immediately you can call it with --no-update
 
+Read more at https://getcomposer.org/doc/03-cli.md#require
 EOT
             )
         ;

+ 2 - 0
src/Composer/Command/RunScriptCommand.php

@@ -63,6 +63,8 @@ class RunScriptCommand extends BaseCommand
 The <info>run-script</info> command runs scripts defined in composer.json:
 
 <info>php composer.phar run-script post-update-cmd</info>
+
+Read more at https://getcomposer.org/doc/03-cli.md#run-script
 EOT
             )
         ;

+ 2 - 0
src/Composer/Command/ScriptAliasCommand.php

@@ -48,6 +48,8 @@ class ScriptAliasCommand extends BaseCommand
 The <info>run-script</info> command runs scripts defined in composer.json:
 
 <info>php composer.phar run-script post-update-cmd</info>
+
+Read more at https://getcomposer.org/doc/03-cli.md#run-script
 EOT
             )
         ;

+ 1 - 0
src/Composer/Command/SearchCommand.php

@@ -49,6 +49,7 @@ class SearchCommand extends BaseCommand
 The search command searches for packages by its name
 <info>php composer.phar search symfony composer</info>
 
+Read more at https://getcomposer.org/doc/03-cli.md#search
 EOT
             )
         ;

+ 1 - 0
src/Composer/Command/SelfUpdateCommand.php

@@ -60,6 +60,7 @@ versions of composer and if found, installs the latest.
 
 <info>php composer.phar self-update</info>
 
+Read more at https://getcomposer.org/doc/03-cli.md#self-update-selfupdate-
 EOT
             )
         ;

+ 1 - 0
src/Composer/Command/ShowCommand.php

@@ -85,6 +85,7 @@ class ShowCommand extends BaseCommand
 The show command displays detailed information about a package, or
 lists all packages available.
 
+Read more at https://getcomposer.org/doc/03-cli.md#show
 EOT
             )
         ;

+ 1 - 0
src/Composer/Command/StatusCommand.php

@@ -52,6 +52,7 @@ class StatusCommand extends BaseCommand
 The status command displays a list of dependencies that have
 been modified locally.
 
+Read more at https://getcomposer.org/doc/03-cli.md#status
 EOT
             )
         ;

+ 1 - 0
src/Composer/Command/SuggestsCommand.php

@@ -38,6 +38,7 @@ The <info>%command.name%</info> command shows a sorted list of suggested package
 
 Enabling <info>-v</info> implies <info>--by-package --by-suggestion</info>, showing both lists.
 
+Read more at https://getcomposer.org/doc/03-cli.md#suggests
 EOT
             )
         ;

+ 1 - 0
src/Composer/Command/UpdateCommand.php

@@ -81,6 +81,7 @@ from a specific vendor:
 
 To select packages names interactively with auto-completion use <info>-i</info>.
 
+Read more at https://getcomposer.org/doc/03-cli.md#update-u
 EOT
             )
         ;

+ 1 - 0
src/Composer/Command/ValidateCommand.php

@@ -55,6 +55,7 @@ Exit codes in case of errors are:
 2 validation error(s)
 3 file unreadable or missing
 
+Read more at https://getcomposer.org/doc/03-cli.md#validate
 EOT
             );
     }

+ 0 - 1
src/Composer/DependencyResolver/Problem.php

@@ -79,7 +79,6 @@ class Problem
             reset($reasons);
             $reason = current($reasons);
 
-            $rule = $reason['rule'];
             $job = $reason['job'];
 
             if (isset($job['constraint'])) {

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

@@ -47,6 +47,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
     private $driver;
     /** @var VersionCacheInterface */
     private $versionCache;
+    private $emptyReferences = array();
 
     public function __construct(array $repoConfig, IOInterface $io, Config $config, HttpDownloader $httpDownloader, EventDispatcher $dispatcher = null, array $drivers = null, VersionCacheInterface $versionCache = null)
     {
@@ -123,6 +124,11 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
         return $this->branchErrorOccurred;
     }
 
+    public function getEmptyReferences()
+    {
+        return $this->emptyReferences;
+    }
+
     protected function initialize()
     {
         parent::initialize();
@@ -165,6 +171,10 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
             if ($cachedPackage) {
                 $this->addPackage($cachedPackage);
 
+                continue;
+            } elseif ($cachedPackage === false) {
+                $this->emptyReferences[] = $identifier;
+
                 continue;
             }
 
@@ -180,6 +190,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
                     if ($verbose) {
                         $this->io->writeError('<warning>Skipped tag '.$tag.', no composer file</warning>');
                     }
+                    $this->emptyReferences[] = $identifier;
                     continue;
                 }
 
@@ -218,6 +229,9 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
 
                 $this->addPackage($this->loader->load($this->preProcess($driver, $data, $identifier)));
             } catch (\Exception $e) {
+                if ($e instanceof TransportException && $e->getCode() === 404) {
+                    $this->emptyReferences[] = $identifier;
+                }
                 if ($verbose) {
                     $this->io->writeError('<warning>Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found' : $e->getMessage()).'</warning>');
                 }
@@ -264,6 +278,10 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
             if ($cachedPackage) {
                 $this->addPackage($cachedPackage);
 
+                continue;
+            } elseif ($cachedPackage === false) {
+                $this->emptyReferences[] = $identifier;
+
                 continue;
             }
 
@@ -272,6 +290,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
                     if ($verbose) {
                         $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file</warning>');
                     }
+                    $this->emptyReferences[] = $identifier;
                     continue;
                 }
 
@@ -290,6 +309,9 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
                 }
                 $this->addPackage($package);
             } catch (TransportException $e) {
+                if ($e->getCode() === 404) {
+                    $this->emptyReferences[] = $identifier;
+                }
                 if ($verbose) {
                     $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file was found</warning>');
                 }
@@ -358,6 +380,14 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
         }
 
         $cachedPackage = $this->versionCache->getVersionPackage($version, $identifier);
+        if ($cachedPackage === false) {
+            if ($verbose) {
+                $this->io->writeError('<warning>Skipped '.$version.', no composer file (cached from ref '.$identifier.')</warning>');
+            }
+
+            return false;
+        }
+
         if ($cachedPackage) {
             $msg = 'Found cached composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $version . '</comment>)';
             if ($verbose) {

+ 1 - 1
src/Composer/Repository/VersionCacheInterface.php

@@ -17,7 +17,7 @@ interface VersionCacheInterface
     /**
      * @param string $version
      * @param string $identifier
-     * @return array Package version data
+     * @return array|null|false Package version data if found, false to indicate the identifier is known but has no package, null for an unknown identifier
      */
     public function getVersionPackage($version, $identifier);
 }

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

@@ -442,7 +442,7 @@ class Filesystem
      */
     public function isAbsolutePath($path)
     {
-        return substr($path, 0, 1) === '/' || substr($path, 1, 1) === ':';
+        return substr($path, 0, 1) === '/' || substr($path, 1, 1) === ':' || substr($path, 0, 2) === '\\\\';
     }
 
     /**