Augmentation vers version 3.3.0
This commit is contained in:
120
vendor/ocramius/package-versions/CHANGELOG.md
vendored
Normal file
120
vendor/ocramius/package-versions/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 1.1.3 - 2017-09-06
|
||||
|
||||
This release fixes a bug that caused PackageVersions to prevent
|
||||
the `composer remove` and `composer update` commands to fail when
|
||||
this package is removed.
|
||||
|
||||
In addition to that, mutation testing has been added to the suite,
|
||||
ensuring that the package is accurately and extensively tested.
|
||||
|
||||
Total issues resolved: **3**
|
||||
|
||||
- [40: Mutation testing, PHP 7.1 testing](https://github.com/Ocramius/PackageVersions/pull/40) thanks to @Ocramius
|
||||
- [41: Removing this package on install results in file access error](https://github.com/Ocramius/PackageVersions/issues/41) thanks to @Xerkus
|
||||
- [46: #41 Avoid issues when the package is scheduled for removal](https://github.com/Ocramius/PackageVersions/pull/46) thanks to @Jean85
|
||||
|
||||
## 1.1.2 - 2016-12-30
|
||||
|
||||
This release fixes a bug that caused PackageVersions to be enabled
|
||||
even when it was part of a globally installed package.
|
||||
|
||||
Total issues resolved: **3**
|
||||
|
||||
- [35: remove all temp directories](https://github.com/Ocramius/PackageVersions/pull/35)
|
||||
- [38: Interferes with other projects when installed globally](https://github.com/Ocramius/PackageVersions/issues/38)
|
||||
- [39: Ignore the global plugin when updating local projects](https://github.com/Ocramius/PackageVersions/pull/39)
|
||||
|
||||
## 1.1.1 - 2016-07-25
|
||||
|
||||
This release removes the [`"files"`](https://getcomposer.org/doc/04-schema.md#files) directive from
|
||||
[`composer.json`](https://github.com/Ocramius/PackageVersions/commit/86f2636f7c5e7b56fa035fa3826d5fcf80b6dc72),
|
||||
as it is no longer needed for `composer install --classmap-authoritative`.
|
||||
Also, that directive was causing issues with HHVM installations, since
|
||||
PackageVersions is not compatible with it.
|
||||
|
||||
Total issues resolved: **1**
|
||||
|
||||
- [34: Fatal error during travis build after update to 1.1.0](https://github.com/Ocramius/PackageVersions/issues/34)
|
||||
|
||||
## 1.1.0 - 2016-07-22
|
||||
|
||||
This release introduces support for running `composer install --classmap-authoritative`
|
||||
and `composer install --no-scripts`. Please note that performance
|
||||
while using these modes may be degraded, but the package will
|
||||
still work.
|
||||
|
||||
Additionally, the package was tuned to prevent the plugin from
|
||||
running twice at installation.
|
||||
|
||||
Total issues resolved: **10**
|
||||
|
||||
- [18: Fails when using composer install --no-scripts](https://github.com/Ocramius/PackageVersions/issues/18)
|
||||
- [20: CS (spacing)](https://github.com/Ocramius/PackageVersions/pull/20)
|
||||
- [22: Document the way the require-dev section is treated](https://github.com/Ocramius/PackageVersions/issues/22)
|
||||
- [23: Underline that composer.lock is used as source of information](https://github.com/Ocramius/PackageVersions/pull/23)
|
||||
- [27: Fix incompatibility with --classmap-authoritative](https://github.com/Ocramius/PackageVersions/pull/27)
|
||||
- [29: mention optimize-autoloader composer.json config option in README](https://github.com/Ocramius/PackageVersions/pull/29)
|
||||
- [30: The version class is generated twice during composer update](https://github.com/Ocramius/PackageVersions/issues/30)
|
||||
- [31: Remove double registration of the event listeners](https://github.com/Ocramius/PackageVersions/pull/31)
|
||||
- [32: Update the usage of mock APIs to use the new API](https://github.com/Ocramius/PackageVersions/pull/32)
|
||||
- [33: Fix for #18 - support running with --no-scripts flag](https://github.com/Ocramius/PackageVersions/pull/33)
|
||||
|
||||
## 1.0.4 - 2016-04-23
|
||||
|
||||
This release includes a fix/workaround for composer/composer#5237,
|
||||
which causes `ocramius/package-versions` to sometimes generate a
|
||||
`Versions` class with malformed name (something like
|
||||
`Versions_composer_tmp0`) when running `composer require <package-name>`.
|
||||
|
||||
Total issues resolved: **2**
|
||||
|
||||
- [16: Workaround for composer/composer#5237 - class parsing](https://github.com/Ocramius/PackageVersions/pull/16)
|
||||
- [17: Weird Class name being generated](https://github.com/Ocramius/PackageVersions/issues/17)
|
||||
|
||||
## 1.0.3 - 2016-02-26
|
||||
|
||||
This release fixes an issue related to concurrent autoloader
|
||||
re-generation caused by multiple composer plugins being installed.
|
||||
The issue was solved by removing autoloader re-generation from this
|
||||
package, but it may still affect other packages.
|
||||
|
||||
It is now recommended that you run `composer dump-autoload --optimize`
|
||||
after installation when using this particular package.
|
||||
Please note that `composer (install|update) -o` is not sufficient
|
||||
to avoid autoload overhead when using this particular package.
|
||||
|
||||
Total issues resolved: **1**
|
||||
|
||||
- [15: Remove autoload re-dump optimization](https://github.com/Ocramius/PackageVersions/pull/15)
|
||||
|
||||
## 1.0.2 - 2016-02-24
|
||||
|
||||
This release fixes issues related to installing the component without
|
||||
any dev dependencies or with packages that don't have a source or dist
|
||||
reference, which is usual with packages defined directly in the
|
||||
`composer.json`.
|
||||
|
||||
Total issues resolved: **3**
|
||||
|
||||
- [11: fix composer install --no-dev PHP7](https://github.com/Ocramius/PackageVersions/pull/11)
|
||||
- [12: Packages don't always have a source/reference](https://github.com/Ocramius/PackageVersions/issues/12)
|
||||
- [13: Fix #12 - support dist and missing package version references](https://github.com/Ocramius/PackageVersions/pull/13)
|
||||
|
||||
## 1.0.1 - 2016-02-01
|
||||
|
||||
This release fixes an issue related with composer updates to
|
||||
already installed versions.
|
||||
Using `composer require` within a package that already used
|
||||
`ocramius/package-versions` caused the installation to be unable
|
||||
to write the `PackageVersions\Versions` class to a file.
|
||||
|
||||
Total issues resolved: **6**
|
||||
|
||||
- [2: remove unused use statement](https://github.com/Ocramius/PackageVersions/pull/2)
|
||||
- [3: Remove useless files from dist package](https://github.com/Ocramius/PackageVersions/pull/3)
|
||||
- [5: failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly](https://github.com/Ocramius/PackageVersions/issues/5)
|
||||
- [6: Fix/#5 use composer vendor dir](https://github.com/Ocramius/PackageVersions/pull/6)
|
||||
- [7: Hotfix - #5 generate package versions also when in phar context](https://github.com/Ocramius/PackageVersions/pull/7)
|
||||
- [8: Versions class should be ignored by VCS, as it is an install-time artifact](https://github.com/Ocramius/PackageVersions/pull/8)
|
||||
39
vendor/ocramius/package-versions/CONTRIBUTING.md
vendored
Normal file
39
vendor/ocramius/package-versions/CONTRIBUTING.md
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
title: Contributing
|
||||
---
|
||||
|
||||
# Contributing
|
||||
|
||||
* Coding standard for the project is [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)
|
||||
* The project will follow strict [object calisthenics](http://www.slideshare.net/guilhermeblanco/object-calisthenics-applied-to-php)
|
||||
* Any contribution must provide tests for additional introduced conditions
|
||||
* Any un-confirmed issue needs a failing test case before being accepted
|
||||
* Pull requests must be sent from a new hotfix/feature branch, not from `master`.
|
||||
|
||||
## Installation
|
||||
|
||||
To install the project and run the tests, you need to clone it first:
|
||||
|
||||
```sh
|
||||
$ git clone git://github.com/Ocramius/PackageVersions.git
|
||||
```
|
||||
|
||||
You will then need to run a composer installation:
|
||||
|
||||
```sh
|
||||
$ cd PackageVersions
|
||||
$ curl -s https://getcomposer.org/installer | php
|
||||
$ php composer.phar update
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
The PHPUnit version to be used is the one installed as a dev- dependency via composer:
|
||||
|
||||
```sh
|
||||
$ ./vendor/bin/phpunit
|
||||
```
|
||||
|
||||
Accepted coverage for new contributions is 80%. Any contribution not satisfying this requirement
|
||||
won't be merged.
|
||||
|
||||
19
vendor/ocramius/package-versions/LICENSE
vendored
Normal file
19
vendor/ocramius/package-versions/LICENSE
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2016 Marco Pivetta
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
60
vendor/ocramius/package-versions/README.md
vendored
Normal file
60
vendor/ocramius/package-versions/README.md
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
# Package Versions
|
||||
|
||||
This utility provides quick and easy access to version information of composer dependencies.
|
||||
|
||||
This information is derived from the ```composer.lock``` file which is (re)generated during ```composer install``` or ```composer update```.
|
||||
|
||||
```php
|
||||
$version = \PackageVersions\Versions::getVersion('ocramius/package-versions');
|
||||
|
||||
var_dump($version); // 1.0.0@0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33
|
||||
```
|
||||
|
||||
[](https://travis-ci.org/Ocramius/PackageVersions)
|
||||
[](https://scrutinizer-ci.com/g/Ocramius/PackageVersions/?branch=master)
|
||||
[](https://scrutinizer-ci.com/g/Ocramius/PackageVersions/?branch=master)
|
||||
[](https://packagist.org/packages/ocramius/package-versions)
|
||||
[](https://packagist.org/packages/ocramius/package-versions)
|
||||
[](https://tidelift.com/subscription/pkg/packagist-ocramius%2Fpackage-versions?utm_source=packagist-ocramius%2Fpackage-versions&utm_medium=readme)
|
||||
|
||||
### Installation
|
||||
|
||||
```sh
|
||||
composer require ocramius/package-versions
|
||||
```
|
||||
|
||||
It is suggested that you use a optimized composer autoloader in order to prevent
|
||||
autoload I/O when accessing the `PackageVersions\Versions` API:
|
||||
|
||||
Therefore you should use `optimize-autoloader: true` in your composer.json:
|
||||
```
|
||||
...
|
||||
"config": {
|
||||
"optimize-autoloader": true
|
||||
},
|
||||
...
|
||||
```
|
||||
see https://getcomposer.org/doc/06-config.md#optimize-autoloader
|
||||
|
||||
In case you manually generate your autoloader via the CLI use the `--optimize` flag:
|
||||
|
||||
```sh
|
||||
composer dump-autoload --optimize
|
||||
```
|
||||
|
||||
### Use-cases
|
||||
|
||||
This repository implements `PackageVersions\Versions::getVersion()` in such a way that no IO
|
||||
happens when calling it, because the list of package versions is compiled during composer
|
||||
installation.
|
||||
|
||||
This is especially useful when you want to generate assets/code/artifacts that are computed from
|
||||
the current version of a certain dependency. Doing so at runtime by checking the installed
|
||||
version of a package would be too expensive, and this package mitigates that.
|
||||
|
||||
## Professional Support
|
||||
|
||||
[Professionally supported `ocramius/package-versions` is available through Tidelift](https://tidelift.com/subscription/pkg/packagist-ocramius-package-versions?utm_source=packagist-ocramius-package-versions&utm_medium=referral&utm_campaign=readme).
|
||||
|
||||
You can also contact the maintainer at ocramius@gmail.com for looking into issues related to this package
|
||||
in your private projects.
|
||||
43
vendor/ocramius/package-versions/composer.json
vendored
Normal file
43
vendor/ocramius/package-versions/composer.json
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "ocramius/package-versions",
|
||||
"description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)",
|
||||
"type": "composer-plugin",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Marco Pivetta",
|
||||
"email": "ocramius@gmail.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.1.0",
|
||||
"composer-plugin-api": "^1.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^7.5.17",
|
||||
"infection/infection": "^0.7.1",
|
||||
"composer/composer": "^1.6.3",
|
||||
"ext-zip": "*",
|
||||
"doctrine/coding-standard": "^5.0.1"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PackageVersions\\": "src/PackageVersions"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"PackageVersionsTest\\": "test/PackageVersionsTest"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"class": "PackageVersions\\Installer",
|
||||
"branch-alias": {
|
||||
"dev-master": "2.0.x-dev"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"post-update-cmd": "PackageVersions\\Installer::dumpVersionsClass",
|
||||
"post-install-cmd": "PackageVersions\\Installer::dumpVersionsClass"
|
||||
}
|
||||
}
|
||||
2869
vendor/ocramius/package-versions/composer.lock
generated
vendored
Normal file
2869
vendor/ocramius/package-versions/composer.lock
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
11
vendor/ocramius/package-versions/infection.json.dist
vendored
Normal file
11
vendor/ocramius/package-versions/infection.json.dist
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"timeout": 10,
|
||||
"source": {
|
||||
"directories": [
|
||||
"src"
|
||||
]
|
||||
},
|
||||
"logs": {
|
||||
"text": "infection-log.txt"
|
||||
}
|
||||
}
|
||||
21
vendor/ocramius/package-versions/phpcs.xml.dist
vendored
Normal file
21
vendor/ocramius/package-versions/phpcs.xml.dist
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0"?>
|
||||
<ruleset>
|
||||
<arg name="basepath" value="."/>
|
||||
<arg name="extensions" value="php"/>
|
||||
<arg name="parallel" value="80"/>
|
||||
<arg name="cache" value=".phpcs-cache"/>
|
||||
<arg name="colors"/>
|
||||
|
||||
<arg value="nps"/>
|
||||
|
||||
<file>src</file>
|
||||
<file>test</file>
|
||||
|
||||
<rule ref="Doctrine">
|
||||
<exclude-pattern>src/PackageVersions/Versions.php</exclude-pattern>
|
||||
</rule>
|
||||
|
||||
<rule ref="Generic.Strings.UnnecessaryStringConcat.Found">
|
||||
<exclude-pattern>src/PackageVersions/Installer.php</exclude-pattern>
|
||||
</rule>
|
||||
</ruleset>
|
||||
121
vendor/ocramius/package-versions/src/PackageVersions/FallbackVersions.php
vendored
Normal file
121
vendor/ocramius/package-versions/src/PackageVersions/FallbackVersions.php
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PackageVersions;
|
||||
|
||||
use Generator;
|
||||
use OutOfBoundsException;
|
||||
use UnexpectedValueException;
|
||||
use function array_key_exists;
|
||||
use function array_merge;
|
||||
use function basename;
|
||||
use function file_exists;
|
||||
use function file_get_contents;
|
||||
use function getcwd;
|
||||
use function iterator_to_array;
|
||||
use function json_decode;
|
||||
use function json_encode;
|
||||
use function sprintf;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* This is a fallback for {@see \PackageVersions\Versions::getVersion()}
|
||||
* Do not use this class directly: it is intended to be only used when
|
||||
* {@see \PackageVersions\Versions} fails to be generated, which typically
|
||||
* happens when running composer with `--no-scripts` flag)
|
||||
*/
|
||||
final class FallbackVersions
|
||||
{
|
||||
public const ROOT_PACKAGE_NAME = 'unknown/root-package@UNKNOWN';
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws OutOfBoundsException If a version cannot be located.
|
||||
* @throws UnexpectedValueException If the composer.lock file could not be located.
|
||||
*/
|
||||
public static function getVersion(string $packageName) : string
|
||||
{
|
||||
$versions = iterator_to_array(self::getVersions(self::getPackageData()));
|
||||
|
||||
if (! array_key_exists($packageName, $versions)) {
|
||||
throw new OutOfBoundsException(
|
||||
'Required package "' . $packageName . '" is not installed: check your ./vendor/composer/installed.json and/or ./composer.lock files'
|
||||
);
|
||||
}
|
||||
|
||||
return $versions[$packageName];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed[]
|
||||
*
|
||||
* @throws UnexpectedValueException
|
||||
*/
|
||||
private static function getPackageData() : array
|
||||
{
|
||||
$checkedPaths = [
|
||||
// The top-level project's ./vendor/composer/installed.json
|
||||
getcwd() . '/vendor/composer/installed.json',
|
||||
__DIR__ . '/../../../../composer/installed.json',
|
||||
// The top-level project's ./composer.lock
|
||||
getcwd() . '/composer.lock',
|
||||
__DIR__ . '/../../../../../composer.lock',
|
||||
// This package's composer.lock
|
||||
__DIR__ . '/../../composer.lock',
|
||||
];
|
||||
|
||||
$packageData = [];
|
||||
foreach ($checkedPaths as $path) {
|
||||
if (! file_exists($path)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$data = json_decode(file_get_contents($path), true);
|
||||
switch (basename($path)) {
|
||||
case 'installed.json':
|
||||
$packageData[] = $data;
|
||||
break;
|
||||
case 'composer.lock':
|
||||
$packageData[] = $data['packages'] + ($data['packages-dev'] ?? []);
|
||||
break;
|
||||
default:
|
||||
// intentionally left blank
|
||||
}
|
||||
}
|
||||
|
||||
if ($packageData !== []) {
|
||||
return array_merge(...$packageData);
|
||||
}
|
||||
|
||||
throw new UnexpectedValueException(sprintf(
|
||||
'PackageVersions could not locate the `vendor/composer/installed.json` or your `composer.lock` '
|
||||
. 'location. This is assumed to be in %s. If you customized your composer vendor directory and ran composer '
|
||||
. 'installation with --no-scripts or if you deployed without the required composer files, then you are on '
|
||||
. 'your own, and we can\'t really help you. Fix your shit and cut the tooling some slack.',
|
||||
json_encode($checkedPaths)
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed[] $packageData
|
||||
*
|
||||
* @return Generator&string[]
|
||||
*
|
||||
* @psalm-return Generator<string, string>
|
||||
*/
|
||||
private static function getVersions(array $packageData) : Generator
|
||||
{
|
||||
foreach ($packageData as $package) {
|
||||
yield $package['name'] => $package['version'] . '@' . (
|
||||
$package['source']['reference'] ?? $package['dist']['reference'] ?? ''
|
||||
);
|
||||
}
|
||||
|
||||
yield self::ROOT_PACKAGE_NAME => self::ROOT_PACKAGE_NAME;
|
||||
}
|
||||
}
|
||||
201
vendor/ocramius/package-versions/src/PackageVersions/Installer.php
vendored
Normal file
201
vendor/ocramius/package-versions/src/PackageVersions/Installer.php
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PackageVersions;
|
||||
|
||||
use Composer\Composer;
|
||||
use Composer\Config;
|
||||
use Composer\EventDispatcher\EventSubscriberInterface;
|
||||
use Composer\IO\IOInterface;
|
||||
use Composer\Package\AliasPackage;
|
||||
use Composer\Package\Locker;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Package\RootPackageInterface;
|
||||
use Composer\Plugin\PluginInterface;
|
||||
use Composer\Script\Event;
|
||||
use Composer\Script\ScriptEvents;
|
||||
use Generator;
|
||||
use RuntimeException;
|
||||
use function array_key_exists;
|
||||
use function array_merge;
|
||||
use function chmod;
|
||||
use function dirname;
|
||||
use function file_exists;
|
||||
use function file_put_contents;
|
||||
use function iterator_to_array;
|
||||
use function rename;
|
||||
use function sprintf;
|
||||
use function uniqid;
|
||||
use function var_export;
|
||||
|
||||
final class Installer implements PluginInterface, EventSubscriberInterface
|
||||
{
|
||||
/** @var string */
|
||||
private static $generatedClassTemplate = <<<'PHP'
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PackageVersions;
|
||||
|
||||
/**
|
||||
* This class is generated by ocramius/package-versions, specifically by
|
||||
* @see \PackageVersions\Installer
|
||||
*
|
||||
* This file is overwritten at every run of `composer install` or `composer update`.
|
||||
*/
|
||||
%s
|
||||
{
|
||||
public const ROOT_PACKAGE_NAME = '%s';
|
||||
public const VERSIONS = %s;
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \OutOfBoundsException If a version cannot be located.
|
||||
*/
|
||||
public static function getVersion(string $packageName) : string
|
||||
{
|
||||
if (isset(self::VERSIONS[$packageName])) {
|
||||
return self::VERSIONS[$packageName];
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException(
|
||||
'Required package "' . $packageName . '" is not installed: check your ./vendor/composer/installed.json and/or ./composer.lock files'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
PHP;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function activate(Composer $composer, IOInterface $io) : void
|
||||
{
|
||||
// Nothing to do here, as all features are provided through event listeners
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public static function getSubscribedEvents() : array
|
||||
{
|
||||
return [
|
||||
ScriptEvents::POST_INSTALL_CMD => 'dumpVersionsClass',
|
||||
ScriptEvents::POST_UPDATE_CMD => 'dumpVersionsClass',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public static function dumpVersionsClass(Event $composerEvent) : void
|
||||
{
|
||||
$composer = $composerEvent->getComposer();
|
||||
$rootPackage = $composer->getPackage();
|
||||
$versions = iterator_to_array(self::getVersions($composer->getLocker(), $rootPackage));
|
||||
|
||||
if (! array_key_exists('ocramius/package-versions', $versions)) {
|
||||
//plugin must be globally installed - we only want to generate versions for projects which specifically
|
||||
//require ocramius/package-versions
|
||||
return;
|
||||
}
|
||||
|
||||
$versionClass = self::generateVersionsClass($rootPackage->getName(), $versions);
|
||||
|
||||
self::writeVersionClassToFile($versionClass, $composer, $composerEvent->getIO());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] $versions
|
||||
*/
|
||||
private static function generateVersionsClass(string $rootPackageName, array $versions) : string
|
||||
{
|
||||
return sprintf(
|
||||
self::$generatedClassTemplate,
|
||||
'fin' . 'al ' . 'cla' . 'ss ' . 'Versions', // note: workaround for regex-based code parsers :-(
|
||||
$rootPackageName,
|
||||
var_export($versions, true)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
private static function writeVersionClassToFile(string $versionClassSource, Composer $composer, IOInterface $io) : void
|
||||
{
|
||||
$installPath = self::locateRootPackageInstallPath($composer->getConfig(), $composer->getPackage())
|
||||
. '/src/PackageVersions/Versions.php';
|
||||
|
||||
if (! file_exists(dirname($installPath))) {
|
||||
$io->write('<info>ocramius/package-versions:</info> Package not found (probably scheduled for removal); generation of version class skipped.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$io->write('<info>ocramius/package-versions:</info> Generating version class...');
|
||||
|
||||
$installPathTmp = $installPath . '_' . uniqid('tmp', true);
|
||||
file_put_contents($installPathTmp, $versionClassSource);
|
||||
chmod($installPathTmp, 0664);
|
||||
rename($installPathTmp, $installPath);
|
||||
|
||||
$io->write('<info>ocramius/package-versions:</info> ...done generating version class');
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
private static function locateRootPackageInstallPath(
|
||||
Config $composerConfig,
|
||||
RootPackageInterface $rootPackage
|
||||
) : string {
|
||||
if (self::getRootPackageAlias($rootPackage)->getName() === 'ocramius/package-versions') {
|
||||
return dirname($composerConfig->get('vendor-dir'));
|
||||
}
|
||||
|
||||
return $composerConfig->get('vendor-dir') . '/ocramius/package-versions';
|
||||
}
|
||||
|
||||
private static function getRootPackageAlias(RootPackageInterface $rootPackage) : PackageInterface
|
||||
{
|
||||
$package = $rootPackage;
|
||||
|
||||
while ($package instanceof AliasPackage) {
|
||||
$package = $package->getAliasOf();
|
||||
}
|
||||
|
||||
return $package;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Generator|string[]
|
||||
*/
|
||||
private static function getVersions(Locker $locker, RootPackageInterface $rootPackage) : Generator
|
||||
{
|
||||
$lockData = $locker->getLockData();
|
||||
|
||||
$lockData['packages-dev'] = $lockData['packages-dev'] ?? [];
|
||||
|
||||
foreach (array_merge($lockData['packages'], $lockData['packages-dev']) as $package) {
|
||||
yield $package['name'] => $package['version'] . '@' . (
|
||||
$package['source']['reference']?? $package['dist']['reference'] ?? ''
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($rootPackage->getReplaces() as $replace) {
|
||||
$version = $replace->getPrettyConstraint();
|
||||
if ($version === 'self.version') {
|
||||
$version = $rootPackage->getPrettyVersion();
|
||||
}
|
||||
|
||||
yield $replace->getTarget() => $version . '@' . $rootPackage->getSourceReference();
|
||||
}
|
||||
|
||||
yield $rootPackage->getName() => $rootPackage->getPrettyVersion() . '@' . $rootPackage->getSourceReference();
|
||||
}
|
||||
}
|
||||
116
vendor/ocramius/package-versions/src/PackageVersions/Versions.php
vendored
Normal file
116
vendor/ocramius/package-versions/src/PackageVersions/Versions.php
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PackageVersions;
|
||||
|
||||
/**
|
||||
* This class is generated by ocramius/package-versions, specifically by
|
||||
* @see \PackageVersions\Installer
|
||||
*
|
||||
* This file is overwritten at every run of `composer install` or `composer update`.
|
||||
*/
|
||||
final class Versions
|
||||
{
|
||||
public const ROOT_PACKAGE_NAME = 'phpbb/phpbb';
|
||||
public const VERSIONS = array (
|
||||
'bantu/ini-get-wrapper' => 'v1.0.1@4770c7feab370c62e23db4f31c112b7c6d90aee2',
|
||||
'google/recaptcha' => '1.2.3@98c4a6573b27e8b0990ea8789c74ea378795134c',
|
||||
'guzzlehttp/guzzle' => '6.5.2@43ece0e75098b7ecd8d13918293029e555a50f82',
|
||||
'guzzlehttp/promises' => 'v1.3.1@a59da6cf61d80060647ff4d3eb2c03a2bc694646',
|
||||
'guzzlehttp/psr7' => '1.6.1@239400de7a173fe9901b9ac7c06497751f00727a',
|
||||
'lusitanian/oauth' => 'v0.8.11@fc11a53db4b66da555a6a11fce294f574a8374f9',
|
||||
'marc1706/fast-image-size' => 'v1.1.6@3a3a2b036be20f43fa06ce00dfa754df503e6684',
|
||||
'ocramius/package-versions' => '1.4.2@44af6f3a2e2e04f2af46bcb302ad9600cba41c7d',
|
||||
'ocramius/proxy-manager' => '2.1.1@e18ac876b2e4819c76349de8f78ccc8ef1554cd7',
|
||||
'paragonie/random_compat' => 'v9.99.99@84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95',
|
||||
'patchwork/utf8' => 'v1.3.2@d296e0026e7ce10b2a9fe594feca9628ef00e9e8',
|
||||
'psr/container' => '1.0.0@b7ce3b176482dbbc1245ebf52b181af44c2cf55f',
|
||||
'psr/http-message' => '1.0.1@f6561bf28d520154e4b0ec72be95418abe6d9363',
|
||||
'psr/log' => '1.1.2@446d54b4cb6bf489fc9d75f55843658e6f25d801',
|
||||
'ralouphie/getallheaders' => '3.0.3@120b605dfeb996808c31b6477290a714d356e822',
|
||||
's9e/regexp-builder' => '1.4.3@59d0167a909659d718f53964f7653d2c83a5f8fe',
|
||||
's9e/text-formatter' => '2.3.1@65a0605f163b8ffcf7145357f167b153f31cd168',
|
||||
'symfony/config' => 'v3.4.36@a599a867d0e4a07c342b5f1e656b3915a540ddbe',
|
||||
'symfony/console' => 'v3.4.36@1ee23b3b659b06c622f2bd2492a229e416eb4586',
|
||||
'symfony/debug' => 'v3.4.36@f72e33fdb1170b326e72c3157f0cd456351dd086',
|
||||
'symfony/dependency-injection' => 'v3.4.36@0d201916bfb3af939fec3c0c8815ea16c60ac1a2',
|
||||
'symfony/event-dispatcher' => 'v3.4.36@f9031c22ec127d4a2450760f81a8677fe8a10177',
|
||||
'symfony/filesystem' => 'v3.4.36@00cdad0936d06fab136944bc2342b762b1c3a4a2',
|
||||
'symfony/finder' => 'v3.4.36@290ae21279b37bfd287cdcce640d51204e84afdf',
|
||||
'symfony/http-foundation' => 'v3.4.36@d2d0cfe8e319d9df44c4cca570710fcf221d4593',
|
||||
'symfony/http-kernel' => 'v3.4.36@c42c8339acb28cfff0fb1786948db4d23d609ff7',
|
||||
'symfony/polyfill-ctype' => 'v1.13.1@f8f0b461be3385e56d6de3dbb5a0df24c0c275e3',
|
||||
'symfony/polyfill-mbstring' => 'v1.13.1@7b4aab9743c30be783b73de055d24a39cf4b954f',
|
||||
'symfony/polyfill-php56' => 'v1.13.1@53dd1cdf3cb986893ccf2b96665b25b3abb384f4',
|
||||
'symfony/polyfill-php70' => 'v1.13.1@af23c7bb26a73b850840823662dda371484926c4',
|
||||
'symfony/polyfill-util' => 'v1.13.1@964a67f293b66b95883a5ed918a65354fcd2258f',
|
||||
'symfony/process' => 'v3.4.36@9a4545c01e1e4f473492bd52b71e574dcc401ca2',
|
||||
'symfony/proxy-manager-bridge' => 'v3.4.36@3c185a0e45ea13334aaf7b0fa9726922816ebec6',
|
||||
'symfony/routing' => 'v3.4.36@b689ccd48e234ea404806d94b07eeb45f9f6f06a',
|
||||
'symfony/twig-bridge' => 'v3.4.36@49b824ddc7f2d250a1f172349cd9a111d63287c0',
|
||||
'symfony/yaml' => 'v3.4.36@dab657db15207879217fc81df4f875947bf68804',
|
||||
'twig/twig' => 'v2.12.2@d761fd1f1c6b867ae09a7d8119a6d95d06dc44ed',
|
||||
'zendframework/zend-code' => '3.4.1@268040548f92c2bfcba164421c1add2ba43abaaa',
|
||||
'zendframework/zend-eventmanager' => '3.2.1@a5e2583a211f73604691586b8406ff7296a946dd',
|
||||
'blackfire/php-sdk' => 'v1.21.0@1aa41771641ac268c5a2a0fc520e0da0e1f6698a',
|
||||
'composer/ca-bundle' => '1.2.5@62e8fc2dc550e5d6d8c9360c7721662670f58149',
|
||||
'doctrine/instantiator' => '1.3.0@ae466f726242e637cebdd526a7d991b9433bacf1',
|
||||
'fabpot/goutte' => 'v3.2.3@3f0eaf0a40181359470651f1565b3e07e3dd31b8',
|
||||
'facebook/webdriver' => '1.7.1@e43de70f3c7166169d0f14a374505392734160e5',
|
||||
'laravel/homestead' => 'v7.20.0@cae38adcfdde1de1c4581e7a33872adaf9fbf926',
|
||||
'michelf/php-markdown' => '1.9.0@c83178d49e372ca967d1a8c77ae4e051b3a3c75c',
|
||||
'myclabs/deep-copy' => '1.9.4@579bb7356d91f9456ccd505f24ca8b667966a0a7',
|
||||
'nikic/php-parser' => 'v3.1.5@bb87e28e7d7b8d9a7fda231d37457c9210faf6ce',
|
||||
'phar-io/manifest' => '1.0.3@7761fcacf03b4d4f16e7ccb606d4879ca431fcf4',
|
||||
'phar-io/version' => '2.0.1@45a2ec53a73c70ce41d55cedef9063630abaf1b6',
|
||||
'phing/phing' => '2.16.1@cbe0f969e434e269af91b4160b86fe899c6e07c7',
|
||||
'phpdocumentor/reflection-docblock' => '2.0.5@e6a969a640b00d8daa3c66518b0405fb41ae0c4b',
|
||||
'phpspec/prophecy' => '1.10.1@cbe1df668b3fe136bcc909126a0f529a78d4cbbc',
|
||||
'phpunit/dbunit' => '4.0.0@e77b469c3962b5a563f09a2a989f1c9bd38b8615',
|
||||
'phpunit/php-code-coverage' => '6.1.4@807e6013b00af69b6c5d9ceb4282d0393dbb9d8d',
|
||||
'phpunit/php-file-iterator' => '2.0.2@050bedf145a257b1ff02746c31894800e5122946',
|
||||
'phpunit/php-text-template' => '1.2.1@31f8b717e51d9a2afca6c9f046f5d69fc27c8686',
|
||||
'phpunit/php-timer' => '2.1.2@1038454804406b0b5f5f520358e78c1c2f71501e',
|
||||
'phpunit/php-token-stream' => '3.1.1@995192df77f63a59e47f025390d2d1fdf8f425ff',
|
||||
'phpunit/phpunit' => '7.5.18@fcf6c4bfafaadc07785528b06385cce88935474d',
|
||||
'pimple/pimple' => 'v3.2.3@9e403941ef9d65d20cba7d54e29fe906db42cf32',
|
||||
'sami/sami' => 'v4.1.2@19b8a82b858bd31544c468317c8307188ccb4022',
|
||||
'sebastian/code-unit-reverse-lookup' => '1.0.1@4419fcdb5eabb9caa61a27c7a1db532a6b55dd18',
|
||||
'sebastian/comparator' => '3.0.2@5de4fc177adf9bce8df98d8d141a7559d7ccf6da',
|
||||
'sebastian/diff' => '3.0.2@720fcc7e9b5cf384ea68d9d930d480907a0c1a29',
|
||||
'sebastian/environment' => '4.2.3@464c90d7bdf5ad4e8a6aea15c091fec0603d4368',
|
||||
'sebastian/exporter' => '3.1.2@68609e1261d215ea5b21b7987539cbfbe156ec3e',
|
||||
'sebastian/global-state' => '2.0.0@e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4',
|
||||
'sebastian/object-enumerator' => '3.0.3@7cfd9e65d11ffb5af41198476395774d4c8a84c5',
|
||||
'sebastian/object-reflector' => '1.1.1@773f97c67f28de00d397be301821b06708fca0be',
|
||||
'sebastian/recursion-context' => '3.0.0@5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8',
|
||||
'sebastian/resource-operations' => '2.0.1@4d7a795d35b889bf80a0cc04e08d77cedfa917a9',
|
||||
'sebastian/version' => '2.0.1@99732be0ddb3361e16ad77b68ba41efc8e979019',
|
||||
'squizlabs/php_codesniffer' => '3.5.3@557a1fc7ac702c66b0bbfe16ab3d55839ef724cb',
|
||||
'symfony/browser-kit' => 'v3.4.36@2e4c991e27a97a8c27745720b030ff85a5cebdf6',
|
||||
'symfony/css-selector' => 'v3.4.36@f819f71ae3ba6f396b4c015bd5895de7d2f1f85f',
|
||||
'symfony/dom-crawler' => 'v3.4.36@6bcffd2eabc4ca087faaaf54e26c8ff3a40284f3',
|
||||
'theseer/tokenizer' => '1.1.3@11336f6f84e16a720dae9d8e6ed5019efa85a0f9',
|
||||
'phpbb/phpbb-core' => '3.3.x-dev@8d00784dfe2c8bcb10843ff70b4cfa998d703285',
|
||||
'phpbb/phpbb' => '3.3.x-dev@8d00784dfe2c8bcb10843ff70b4cfa998d703285',
|
||||
);
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \OutOfBoundsException If a version cannot be located.
|
||||
*/
|
||||
public static function getVersion(string $packageName) : string
|
||||
{
|
||||
if (isset(self::VERSIONS[$packageName])) {
|
||||
return self::VERSIONS[$packageName];
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException(
|
||||
'Required package "' . $packageName . '" is not installed: check your ./vendor/composer/installed.json and/or ./composer.lock files'
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user