1
0
Fork 0

Merge branch '1.10'

pull/9330/head
Jordi Boggiano 2020-10-24 09:59:46 +02:00
commit 0d236858ec
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
19 changed files with 57 additions and 42 deletions

View File

@ -83,6 +83,12 @@
* Fixed suggest output being very spammy, it now is only one line long and shows more rarely * Fixed suggest output being very spammy, it now is only one line long and shows more rarely
* Fixed conflict rules like e.g. >=5 from matching dev-master, as it is not normalized to 9999999-dev internally anymore * Fixed conflict rules like e.g. >=5 from matching dev-master, as it is not normalized to 9999999-dev internally anymore
### [1.10.16] 2020-10-24
* Added warning to `validate` command for cases where packages provide/replace a package that they also require
* Fixed JSON schema validation issue with PHPStorm
* Fixed symlink handling in `archive` command
### [1.10.15] 2020-10-13 ### [1.10.15] 2020-10-13
* Fixed path repo version guessing issue * Fixed path repo version guessing issue
@ -995,6 +1001,7 @@
[2.0.0-alpha3]: https://github.com/composer/composer/compare/2.0.0-alpha2...2.0.0-alpha3 [2.0.0-alpha3]: https://github.com/composer/composer/compare/2.0.0-alpha2...2.0.0-alpha3
[2.0.0-alpha2]: https://github.com/composer/composer/compare/2.0.0-alpha1...2.0.0-alpha2 [2.0.0-alpha2]: https://github.com/composer/composer/compare/2.0.0-alpha1...2.0.0-alpha2
[2.0.0-alpha1]: https://github.com/composer/composer/compare/1.10.7...2.0.0-alpha1 [2.0.0-alpha1]: https://github.com/composer/composer/compare/1.10.7...2.0.0-alpha1
[1.10.16]: https://github.com/composer/composer/compare/1.10.15...1.10.16
[1.10.15]: https://github.com/composer/composer/compare/1.10.14...1.10.15 [1.10.15]: https://github.com/composer/composer/compare/1.10.14...1.10.15
[1.10.14]: https://github.com/composer/composer/compare/1.10.13...1.10.14 [1.10.14]: https://github.com/composer/composer/compare/1.10.13...1.10.14
[1.10.13]: https://github.com/composer/composer/compare/1.10.12...1.10.13 [1.10.13]: https://github.com/composer/composer/compare/1.10.12...1.10.13

View File

@ -37,7 +37,7 @@ Composer requires PHP 5.3.2+ to run. A few sensitive php settings and compile
flags are also required, but when using the installer you will be warned about flags are also required, but when using the installer you will be warned about
any incompatibilities. any incompatibilities.
To install packages from sources instead of simple zip archives, you will need To install packages from sources instead of plain zip archives, you will need
git, svn, fossil or hg depending on how the package is version-controlled. git, svn, fossil or hg depending on how the package is version-controlled.
Composer is multi-platform and we strive to make it run equally well on Windows, Composer is multi-platform and we strive to make it run equally well on Windows,
@ -161,6 +161,6 @@ Composer version 1.0.0 2016-01-10 20:34:53
## Using Composer ## Using Composer
Now that you've installed Composer, you are ready to use it! Head on over to the Now that you've installed Composer, you are ready to use it! Head on over to the
next chapter for a short and simple demonstration. next chapter for a short demonstration.
[Basic usage](01-basic-usage.md) → [Basic usage](01-basic-usage.md) →

View File

@ -21,7 +21,7 @@ to find the file at the top of your VCS repository.
### The `require` key ### The `require` key
The first (and often only) thing you specify in `composer.json` is the The first (and often only) thing you specify in `composer.json` is the
[`require`](04-schema.md#require) key. You are simply telling Composer which [`require`](04-schema.md#require) key. You are telling Composer which
packages your project depends on. packages your project depends on.
```json ```json
@ -101,7 +101,7 @@ When you run this command, one of two things may happen:
### Installing without `composer.lock` ### Installing without `composer.lock`
If you have never run the command before and there is also no `composer.lock` file present, If you have never run the command before and there is also no `composer.lock` file present,
Composer simply resolves all dependencies listed in your `composer.json` file and downloads Composer resolves all dependencies listed in your `composer.json` file and downloads
the latest version of their files into the `vendor` directory in your project. (The `vendor` the latest version of their files into the `vendor` directory in your project. (The `vendor`
directory is the conventional location for all third-party code in a project). In our directory is the conventional location for all third-party code in a project). In our
example from above, you would end up with the Monolog source files in example from above, you would end up with the Monolog source files in
@ -214,7 +214,7 @@ available platform packages.
## Autoloading ## Autoloading
For libraries that specify autoload information, Composer generates a For libraries that specify autoload information, Composer generates a
`vendor/autoload.php` file. You can simply include this file and start `vendor/autoload.php` file. You can include this file and start
using the classes that those libraries provide without any extra work: using the classes that those libraries provide without any extra work:
```php ```php

View File

@ -142,9 +142,9 @@ Packagist is available automatically through Composer. Since
can depend on it without having to specify any additional repositories. can depend on it without having to specify any additional repositories.
If we wanted to share `hello-world` with the world, we would publish it on If we wanted to share `hello-world` with the world, we would publish it on
Packagist as well. Doing so is really easy. Packagist as well.
You simply visit [Packagist](https://packagist.org) and hit the "Submit" You visit [Packagist](https://packagist.org) and hit the "Submit"
button. This will prompt you to sign up if you haven't already, and then button. This will prompt you to sign up if you haven't already, and then
allows you to submit the URL to your VCS repository, at which point Packagist allows you to submit the URL to your VCS repository, at which point Packagist
will start crawling it. Once it is done, your package will be available to will start crawling it. Once it is done, your package will be available to

View File

@ -3,7 +3,7 @@
You've already learned how to use the command-line interface to do some You've already learned how to use the command-line interface to do some
things. This chapter documents all the available commands. things. This chapter documents all the available commands.
To get help from the command-line, simply call `composer` or `composer list` To get help from the command-line, call `composer` or `composer list`
to see the complete list of commands, then `--help` combined with any of those to see the complete list of commands, then `--help` combined with any of those
can give you more information. can give you more information.
@ -39,8 +39,7 @@ The following options are available with every command:
## init ## init
In the [Libraries](02-libraries.md) chapter we looked at how to create a In the [Libraries](02-libraries.md) chapter we looked at how to create a
`composer.json` by hand. There is also an `init` command available that makes `composer.json` by hand. There is also an `init` command available to do this.
it a bit easier to do this.
When you run the command it will interactively ask you to fill in the fields, When you run the command it will interactively ask you to fill in the fields,
while using some smart defaults. while using some smart defaults.
@ -347,8 +346,8 @@ php composer.phar global update
## search ## search
The search command allows you to search through the current project's package The search command allows you to search through the current project's package
repositories. Usually this will be packagist. You simply pass it the repositories. Usually this will be packagist. You pass it the terms you want
terms you want to search for. to search for.
```sh ```sh
php composer.phar search monolog php composer.phar search monolog
@ -595,7 +594,7 @@ command. It will replace your `composer.phar` with the latest version.
php composer.phar self-update php composer.phar self-update
``` ```
If you would like to instead update to a specific release simply specify it: If you would like to instead update to a specific release specify it:
```sh ```sh
php composer.phar self-update 1.0.0-alpha7 php composer.phar self-update 1.0.0-alpha7
@ -993,7 +992,7 @@ directory other than `vendor`.
### http_proxy or HTTP_PROXY ### http_proxy or HTTP_PROXY
If you are using Composer from behind an HTTP proxy, you can use the standard If you are using Composer from behind an HTTP proxy, you can use the standard
`http_proxy` or `HTTP_PROXY` env vars. Simply set it to the URL of your proxy. `http_proxy` or `HTTP_PROXY` env vars. Set it to the URL of your proxy.
Many operating systems already set this variable for you. Many operating systems already set this variable for you.
Using `http_proxy` (lowercased) or even defining both might be preferable since Using `http_proxy` (lowercased) or even defining both might be preferable since
@ -1025,7 +1024,7 @@ If set, makes the self-update command write the new Composer phar file into that
### no_proxy or NO_PROXY ### no_proxy or NO_PROXY
If you are behind a proxy and would like to disable it for certain domains, you If you are behind a proxy and would like to disable it for certain domains, you
can use the `no_proxy` or `NO_PROXY` env var. Simply set it to a comma separated list of can use the `no_proxy` or `NO_PROXY` env var. Set it to a comma separated list of
domains the proxy should *not* be used for. domains the proxy should *not* be used for.
The env var accepts domains, IP addresses, and IP address blocks in CIDR The env var accepts domains, IP addresses, and IP address blocks in CIDR

View File

@ -88,7 +88,7 @@ installer capable of installing packages of that type.
Out of the box, Composer supports four types: Out of the box, Composer supports four types:
- **library:** This is the default. It will simply copy the files to `vendor`. - **library:** This is the default. It will copy the files to `vendor`.
- **project:** This denotes a project rather than a library. For example - **project:** This denotes a project rather than a library. For example
application shells like the [Symfony standard edition](https://github.com/symfony/symfony-standard), application shells like the [Symfony standard edition](https://github.com/symfony/symfony-standard),
CMSs like the [SilverStripe installer](https://github.com/silverstripe/silverstripe-installer) CMSs like the [SilverStripe installer](https://github.com/silverstripe/silverstripe-installer)
@ -444,7 +444,7 @@ that exact version, and not any other version, which would be incorrect.
List of other packages that are provided by this package. This is mostly List of other packages that are provided by this package. This is mostly
useful for implementations of common interfaces. A package could depend on useful for implementations of common interfaces. A package could depend on
some virtual `logger-implementation` package, any library that implements some virtual `logger-implementation` package, any library that implements
this logger interface would simply list it in `provide`. this logger interface would list it in `provide`.
Using `provide` with the name of an actual package rather than a virtual one Using `provide` with the name of an actual package rather than a virtual one
implies that the code of that package is also shipped, in which case `replace` implies that the code of that package is also shipped, in which case `replace`
is generally a better choice. A common convention for packages providing an is generally a better choice. A common convention for packages providing an
@ -781,7 +781,7 @@ ignored.
The following repository types are supported: The following repository types are supported:
* **composer:** A Composer repository is simply a `packages.json` file served * **composer:** A Composer repository is a `packages.json` file served
via the network (HTTP, FTP, SSH), that contains a list of `composer.json` via the network (HTTP, FTP, SSH), that contains a list of `composer.json`
objects with additional `dist` and/or `source` information. The `packages.json` objects with additional `dist` and/or `source` information. The `packages.json`
file is loaded using a PHP stream. You can set extra options on that stream file is loaded using a PHP stream. You can set extra options on that stream

View File

@ -219,7 +219,7 @@ There are a few use cases for this. The most common one is maintaining your
own fork of a third party library. If you are using a certain library for your own fork of a third party library. If you are using a certain library for your
project, and you decide to change something in the library, you will want your project, and you decide to change something in the library, you will want your
project to use the patched version. If the library is on GitHub (this is the project to use the patched version. If the library is on GitHub (this is the
case most of the time), you can simply fork it there and push your changes to case most of the time), you can fork it there and push your changes to
your fork. After that you update the project's `composer.json`. All you have your fork. After that you update the project's `composer.json`. All you have
to do is add your fork as a repository and update the version constraint to to do is add your fork as a repository and update the version constraint to
point to your custom branch. In `composer.json`, you should prefix your custom point to your custom branch. In `composer.json`, you should prefix your custom
@ -500,11 +500,11 @@ information.
### Artifact ### Artifact
There are some cases, when there is no ability to have one of the previously There are some cases, when there is no ability to have one of the previously
mentioned repository types online, even the VCS one. Typical example could be mentioned repository types online, even the VCS one. A typical example could be
cross-organisation library exchange through built artifacts. Of course, most cross-organisation library exchange through build artifacts. Of course, most
of the times they are private. To simplify maintenance, one can simply use a of the time these are private. To use these archives as-is, one can use a
repository of type `artifact` with a folder containing ZIP or TAR archives of those repository of type `artifact` with a folder containing ZIP or TAR archives of
private packages: those private packages:
```json ```json
{ {

View File

@ -287,14 +287,12 @@ scripts if you tend to have modified vendors.
## archive-format ## archive-format
Defaults to `tar`. Composer allows you to add a default archive format when the Defaults to `tar`. Overrides the default format used by the archive command.
workflow needs to create a dedicated archiving format.
## archive-dir ## archive-dir
Defaults to `.`. Composer allows you to add a default archive directory when the Defaults to `.`. Default destination for archives created by the archive
workflow needs to create a dedicated archiving format. Or for easier development command.
between modules.
Example: Example:

View File

@ -12,7 +12,7 @@ it can immediately be discovered/used without having to rebuild the autoloader
configuration. configuration.
The problem however is in production you generally want things to happen as fast The problem however is in production you generally want things to happen as fast
as possible, as you can simply rebuild the configuration every time you deploy and as possible, as you can rebuild the configuration every time you deploy and
new classes do not appear at random between deploys. new classes do not appear at random between deploys.
For this reason, Composer offers a few strategies to optimize the autoloader. For this reason, Composer offers a few strategies to optimize the autoloader.
@ -67,7 +67,7 @@ There are a few options to enable this:
Enabling this automatically enables Level 1 class map optimizations. Enabling this automatically enables Level 1 class map optimizations.
This option is very simple, it says that if something is not found in the classmap, This option says that if something is not found in the classmap,
then it does not exist and the autoloader should not attempt to look on the then it does not exist and the autoloader should not attempt to look on the
filesystem according to PSR-4 rules. filesystem according to PSR-4 rules.

View File

@ -189,7 +189,7 @@ class TemplateInstaller extends LibraryInstaller
} }
``` ```
The example demonstrates that it is quite simple to extend the The example demonstrates that it is possible to extend the
[`Composer\Installer\LibraryInstaller`][5] class to strip a prefix [`Composer\Installer\LibraryInstaller`][5] class to strip a prefix
(`phpdocumentor/template-`) and use the remaining part to assemble a completely (`phpdocumentor/template-`) and use the remaining part to assemble a completely
different installation path. different installation path.

View File

@ -13,7 +13,7 @@ files which makes installs faster and independent from third party systems - e.g
you can deploy even if GitHub is down because your zip files are mirrored. you can deploy even if GitHub is down because your zip files are mirrored.
Private Packagist is available as a hosted SaaS solution or as an on-premise self-hosted Private Packagist is available as a hosted SaaS solution or as an on-premise self-hosted
package, providing an easy interactive set up experience. package, providing an interactive set up experience.
Some of Private Packagist's revenue is used to pay for Composer and Packagist.org Some of Private Packagist's revenue is used to pay for Composer and Packagist.org
development and hosting so using it is a good way to support the maintenance of development and hosting so using it is a good way to support the maintenance of

View File

@ -208,7 +208,7 @@ and can be retrieved as an array via `$event->getArguments()` by PHP handlers.
If you add custom scripts that do not fit one of the predefined event name If you add custom scripts that do not fit one of the predefined event name
above, you can either run them with run-script or also run them as native above, you can either run them with run-script or also run them as native
Composer commands. For example the handler defined below is executable by Composer commands. For example the handler defined below is executable by
simply running `composer test`: running `composer test`:
```json ```json
{ {
@ -224,7 +224,7 @@ to the `phpunit` script.
> **Note:** Before executing scripts, Composer's bin-dir is temporarily pushed > **Note:** Before executing scripts, Composer's bin-dir is temporarily pushed
> on top of the PATH environment variable so that binaries of dependencies > on top of the PATH environment variable so that binaries of dependencies
> are easily accessible. In this example no matter if the `phpunit` binary is > are directly accessible. In this example no matter if the `phpunit` binary is
> actually in `vendor/bin/phpunit` or `bin/phpunit` it will be found and executed. > actually in `vendor/bin/phpunit` or `bin/phpunit` it will be found and executed.
Although Composer is not intended to manage long-running processes and other Although Composer is not intended to manage long-running processes and other

View File

@ -18,7 +18,7 @@ In Composer, what's often referred to casually as a version -- that is,
the string that follows the package name in a require line (e.g., `~1.1` or the string that follows the package name in a require line (e.g., `~1.1` or
`1.2.*`) -- is actually more specifically a version constraint. Composer `1.2.*`) -- is actually more specifically a version constraint. Composer
uses version constraints to figure out which refs in a VCS it should be uses version constraints to figure out which refs in a VCS it should be
checking out (or simply to verify that a given library is acceptable in checking out (or to verify that a given library is acceptable in
the case of a statically-maintained library with a `version` specification the case of a statically-maintained library with a `version` specification
in `composer.json`). in `composer.json`).

View File

@ -6,7 +6,7 @@ the default `vendor` folder by using
[composer/installers](https://github.com/composer/installers). [composer/installers](https://github.com/composer/installers).
If you are a **package author** and want your package installed to a custom If you are a **package author** and want your package installed to a custom
directory, simply require `composer/installers` and set the appropriate `type`. directory, require `composer/installers` and set the appropriate `type`.
Specifying the package type, will override the default installer path. Specifying the package type, will override the default installer path.
This is common if your package is intended for a specific framework such as This is common if your package is intended for a specific framework such as
CakePHP, Drupal or WordPress. Here is an example composer.json file for a CakePHP, Drupal or WordPress. Here is an example composer.json file for a

View File

@ -16,6 +16,6 @@ For example instead of using `>=3.4` you should use `~3.4` which allows all
versions up to `3.999` but does not include `4.0` and above. The `^` operator versions up to `3.999` but does not include `4.0` and above. The `^` operator
works very well with libraries following [semantic versioning](https://semver.org). works very well with libraries following [semantic versioning](https://semver.org).
**Note:** As a package maintainer, you can make the life of your users easier **Note:** As a package maintainer, you can make the help your users
by providing an [alias version](../articles/aliases.md) for your development by providing an [alias version](../articles/aliases.md) for your development
branch to allow it to match bound constraints. branch to allow it to match bound constraints.

View File

@ -17,5 +17,5 @@ of a package in version 3.0.0 or not. Should it match because you asked for
`>=2` or should it not match because you asked for a `2.*`? `>=2` or should it not match because you asked for a `2.*`?
For this reason, Composer throws an error and says that this is invalid. For this reason, Composer throws an error and says that this is invalid.
The easy way to fix it is to think about what you really mean, and use only The way to fix it is to think about what you really mean, and use only
one of those rules. one of those rules.

View File

@ -4,7 +4,7 @@ This directory contains some examples of what `composer` type repositories can
look like. They serve as illustrating examples accompanying the docs, but can look like. They serve as illustrating examples accompanying the docs, but can
also be used as (initial) fixtures for tests. also be used as (initial) fixtures for tests.
* `repo-composer-plain` is a simple, plain `packages.json` file * `repo-composer-plain` is a basic, plain `packages.json` file
* `repo-composer-with-includes` uses the `includes` mechanism * `repo-composer-with-includes` uses the `includes` mechanism
* `repo-composer-with-providers` uses the `providers` mechanism * `repo-composer-with-providers` uses the `providers` mechanism

View File

@ -159,7 +159,7 @@ EOT
$latestVersion = $latest['version']; $latestVersion = $latest['version'];
$updateVersion = $latestVersion; $updateVersion = $latestVersion;
$io->writeError('<warning>A new stable major version of Composer is available ('.$skippedVersion.'), run "composer self-update --'.$updateMajorVersion.'" to update to it. See also https://github.com/composer/composer/releases for changelogs.</warning>'); $io->writeError('<warning>A new stable major version of Composer is available ('.$skippedVersion.'), run "composer self-update --'.$updateMajorVersion.'" to update to it. See also https://getcomposer.org/'.$updateMajorVersion.'</warning>');
} elseif ($currentMajorVersion < $previewMajorVersion) { } elseif ($currentMajorVersion < $previewMajorVersion) {
// promote next major version if available in preview // promote next major version if available in preview
$io->writeError('<warning>A preview release of the next major version of Composer is available ('.$latestPreview['version'].'), run "composer self-update --preview" to give it a try. See also https://github.com/composer/composer/releases for changelogs.</warning>'); $io->writeError('<warning>A preview release of the next major version of Composer is available ('.$latestPreview['version'].'), run "composer self-update --preview" to give it a try. See also https://github.com/composer/composer/releases for changelogs.</warning>');

View File

@ -188,6 +188,16 @@ class InstalledRepository extends CompositeRepository
} }
$version = new Constraint('=', $pkg->getVersion()); $version = new Constraint('=', $pkg->getVersion());
if ($link->getTarget() !== $pkg->getName()) {
foreach (array_merge($pkg->getReplaces(), $pkg->getProvides()) as $prov) {
if ($link->getTarget() === $prov->getTarget()) {
$version = $prov->getConstraint();
break;
}
}
}
if (!$link->getConstraint()->matches($version)) { if (!$link->getConstraint()->matches($version)) {
// if we have a root package (we should but can not guarantee..) we show // if we have a root package (we should but can not guarantee..) we show
// the root requires as well to perhaps allow to find an issue there // the root requires as well to perhaps allow to find an issue there
@ -199,6 +209,7 @@ class InstalledRepository extends CompositeRepository
continue 3; continue 3;
} }
} }
$results[] = array($package, $link, false); $results[] = array($package, $link, false);
$results[] = array($rootPackage, new Link($rootPackage->getName(), $link->getTarget(), new MatchAllConstraint, 'does not require', 'but ' . $pkg->getPrettyVersion() . ' is installed'), false); $results[] = array($rootPackage, new Link($rootPackage->getName(), $link->getTarget(), new MatchAllConstraint, 'does not require', 'but ' . $pkg->getPrettyVersion() . ' is installed'), false);
} else { } else {