TimeTrex Community Edition v16.2.0
This commit is contained in:
76
vendor/jean85/pretty-package-versions/.github/workflows/tests.yaml
vendored
Normal file
76
vendor/jean85/pretty-package-versions/.github/workflows/tests.yaml
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
pull_request: null
|
||||
push:
|
||||
branches:
|
||||
- 2.x
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
php:
|
||||
- '7.1'
|
||||
- '7.2'
|
||||
- '7.3'
|
||||
- '7.4'
|
||||
- '8.0'
|
||||
- '8.1'
|
||||
composer_version: ['v2']
|
||||
include:
|
||||
- description: '(prefer lowest)'
|
||||
php: '7.1'
|
||||
composer_version: '2.0.0'
|
||||
dependencies: 'lowest'
|
||||
|
||||
name: PHP ${{ matrix.php }} tests ${{ matrix.description }}
|
||||
steps:
|
||||
# checkout git
|
||||
- uses: actions/checkout@v2
|
||||
# setup PHP
|
||||
- uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php }}
|
||||
tools: composer:${{ matrix.composer_version }}
|
||||
coverage: xdebug
|
||||
- uses: "ramsey/composer-install@v1"
|
||||
with:
|
||||
dependency-versions: ${{ matrix.dependencies }}
|
||||
- run: vendor/bin/phpunit --coverage-clover=coverage.xml
|
||||
- uses: codecov/codecov-action@v1
|
||||
with:
|
||||
file: './coverage.xml'
|
||||
fail_ci_if_error: true
|
||||
PHP-CS-Fixer:
|
||||
runs-on: ubuntu-latest
|
||||
name: Code style
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
coverage: none
|
||||
- uses: "ramsey/composer-install@v1"
|
||||
- run: vendor/bin/php-cs-fixer fix --ansi --verbose --dry-run
|
||||
PHPStan:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
coverage: none
|
||||
- uses: "ramsey/composer-install@v1"
|
||||
- run: vendor/bin/phpstan analyse
|
||||
Psalm:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
coverage: none
|
||||
- uses: "ramsey/composer-install@v1"
|
||||
- run: vendor/bin/psalm
|
118
vendor/jean85/pretty-package-versions/.php_cs.dist
vendored
Normal file
118
vendor/jean85/pretty-package-versions/.php_cs.dist
vendored
Normal file
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
$config = new PhpCsFixer\Config('default');
|
||||
$config->setRiskyAllowed(true);
|
||||
$config->setRules([
|
||||
'@PSR2' => true,
|
||||
'align_multiline_comment' => true,
|
||||
'array_indentation' => true,
|
||||
'array_syntax' => [
|
||||
'syntax' => 'short',
|
||||
],
|
||||
'binary_operator_spaces' => [
|
||||
'align_double_arrow' => false,
|
||||
'align_equals' => false,
|
||||
],
|
||||
'blank_line_after_namespace' => true,
|
||||
'blank_line_after_opening_tag' => true,
|
||||
'blank_line_before_statement' => [
|
||||
'statements' => [
|
||||
'return',
|
||||
],
|
||||
],
|
||||
'cast_spaces' => [
|
||||
'space' => 'single',
|
||||
],
|
||||
'class_attributes_separation' => [
|
||||
'elements' => [
|
||||
'method' => 'one',
|
||||
'property' => 'one',
|
||||
],
|
||||
],
|
||||
'compact_nullable_typehint' => true,
|
||||
'concat_space' => [
|
||||
'spacing' => 'one',
|
||||
],
|
||||
'declare_equal_normalize' => true,
|
||||
'declare_strict_types' => true,
|
||||
'function_typehint_space' => true,
|
||||
'include' => true,
|
||||
'indentation_type' => true,
|
||||
'lowercase_cast' => true,
|
||||
'method_chaining_indentation' => true,
|
||||
'method_separation' => true,
|
||||
'multiline_comment_opening_closing' => true,
|
||||
'native_function_casing' => true,
|
||||
'new_with_braces' => true,
|
||||
'no_blank_lines_after_phpdoc' => true,
|
||||
'no_empty_comment' => true,
|
||||
'no_empty_phpdoc' => true,
|
||||
'no_empty_statement' => true,
|
||||
'no_extra_consecutive_blank_lines' => [
|
||||
'tokens' => [
|
||||
'curly_brace_block',
|
||||
'extra',
|
||||
'parenthesis_brace_block',
|
||||
'square_brace_block',
|
||||
'throw',
|
||||
'use',
|
||||
],
|
||||
],
|
||||
'no_leading_import_slash' => true,
|
||||
'no_leading_namespace_whitespace' => true,
|
||||
'no_mixed_echo_print' => [
|
||||
'use' => 'echo',
|
||||
],
|
||||
'no_multiline_whitespace_around_double_arrow' => true,
|
||||
'no_short_bool_cast' => true,
|
||||
'no_singleline_whitespace_before_semicolons' => true,
|
||||
'no_spaces_around_offset' => true,
|
||||
'no_superfluous_phpdoc_tags' => [
|
||||
'allow_mixed' => true,
|
||||
],
|
||||
'no_trailing_comma_in_list_call' => true,
|
||||
'no_trailing_comma_in_singleline_array' => true,
|
||||
'no_unneeded_control_parentheses' => true,
|
||||
'no_unused_imports' => true,
|
||||
'no_whitespace_before_comma_in_array' => true,
|
||||
'no_whitespace_in_blank_line' => true,
|
||||
'not_operator_with_successor_space' => true,
|
||||
'normalize_index_brace' => true,
|
||||
'object_operator_without_whitespace' => true,
|
||||
'ordered_imports' => true,
|
||||
'phpdoc_align' => false,
|
||||
'phpdoc_annotation_without_dot' => true,
|
||||
'phpdoc_indent' => true,
|
||||
'phpdoc_no_package' => true,
|
||||
'phpdoc_no_useless_inheritdoc' => true,
|
||||
'phpdoc_order' => true,
|
||||
'phpdoc_scalar' => true,
|
||||
'phpdoc_separation' => true,
|
||||
'phpdoc_single_line_var_spacing' => true,
|
||||
'phpdoc_to_comment' => true,
|
||||
'phpdoc_trim' => true,
|
||||
'phpdoc_trim_consecutive_blank_line_separation' => true,
|
||||
'phpdoc_types' => true,
|
||||
'phpdoc_var_without_name' => true,
|
||||
'pre_increment' => true,
|
||||
'psr4' => true,
|
||||
'return_type_declaration' => true,
|
||||
'short_scalar_cast' => true,
|
||||
'single_blank_line_before_namespace' => true,
|
||||
'single_class_element_per_statement' => true,
|
||||
'single_quote' => true,
|
||||
'space_after_semicolon' => true,
|
||||
'standardize_not_equals' => true,
|
||||
'ternary_operator_spaces' => true,
|
||||
'ternary_to_null_coalescing' => true,
|
||||
'trailing_comma_in_multiline_array' => true,
|
||||
'trim_array_spaces' => true,
|
||||
'unary_operator_spaces' => true,
|
||||
'whitespace_after_comma_in_array' => true,
|
||||
]);
|
||||
|
||||
$finder = PhpCsFixer\Finder::create();
|
||||
$finder->in(__DIR__);
|
||||
$config->setFinder($finder);
|
||||
|
||||
return $config;
|
21
vendor/jean85/pretty-package-versions/LICENSE
vendored
Normal file
21
vendor/jean85/pretty-package-versions/LICENSE
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 Alessandro Lai
|
||||
|
||||
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.
|
19
vendor/jean85/pretty-package-versions/Makefile
vendored
Normal file
19
vendor/jean85/pretty-package-versions/Makefile
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
pre-commit-check: composer cs phpstan psalm test
|
||||
|
||||
composer:
|
||||
composer install
|
||||
|
||||
cs:
|
||||
vendor/bin/php-cs-fixer fix --verbose
|
||||
|
||||
cs-dry-run:
|
||||
vendor/bin/php-cs-fixer fix --verbose --dry-run
|
||||
|
||||
phpstan:
|
||||
vendor/bin/phpstan analyze
|
||||
|
||||
psalm:
|
||||
vendor/bin/psalm
|
||||
|
||||
test:
|
||||
vendor/bin/phpunit
|
1
vendor/jean85/pretty-package-versions/codecov.yml
vendored
Normal file
1
vendor/jean85/pretty-package-versions/codecov.yml
vendored
Normal file
@ -0,0 +1 @@
|
||||
comment: false
|
50
vendor/jean85/pretty-package-versions/composer.json
vendored
Normal file
50
vendor/jean85/pretty-package-versions/composer.json
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "jean85/pretty-package-versions",
|
||||
"description": "A library to get pretty versions strings of installed dependencies",
|
||||
"type": "library",
|
||||
"require": {
|
||||
"php": "^7.1|^8.0",
|
||||
"composer-runtime-api": "^2.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "^2.17",
|
||||
"jean85/composer-provided-replaced-stub-package": "^1.0",
|
||||
"phpstan/phpstan": "^0.12.66",
|
||||
"phpunit/phpunit": "^7.5|^8.5|^9.4",
|
||||
"vimeo/psalm": "^4.3"
|
||||
},
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Alessandro Lai",
|
||||
"email": "alessandro.lai85@gmail.com"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/Jean85/pretty-package-versions/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"package",
|
||||
"versions",
|
||||
"composer",
|
||||
"release"
|
||||
],
|
||||
"config": {
|
||||
"sort-packages": true
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Jean85\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\": "tests"
|
||||
}
|
||||
}
|
||||
}
|
5
vendor/jean85/pretty-package-versions/phpstan.neon
vendored
Normal file
5
vendor/jean85/pretty-package-versions/phpstan.neon
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
parameters:
|
||||
level: 8
|
||||
paths:
|
||||
- src/
|
||||
- tests/
|
16
vendor/jean85/pretty-package-versions/psalm.xml
vendored
Normal file
16
vendor/jean85/pretty-package-versions/psalm.xml
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0"?>
|
||||
<psalm
|
||||
errorLevel="4"
|
||||
resolveFromConfigFile="true"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="https://getpsalm.org/schema/config"
|
||||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
||||
>
|
||||
<projectFiles>
|
||||
<directory name="src" />
|
||||
<directory name="tests" />
|
||||
<ignoreFiles>
|
||||
<directory name="vendor" />
|
||||
</ignoreFiles>
|
||||
</projectFiles>
|
||||
</psalm>
|
13
vendor/jean85/pretty-package-versions/src/Exception/ProvidedPackageException.php
vendored
Normal file
13
vendor/jean85/pretty-package-versions/src/Exception/ProvidedPackageException.php
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Jean85\Exception;
|
||||
|
||||
class ProvidedPackageException extends \Exception implements VersionMissingExceptionInterface
|
||||
{
|
||||
public static function create(string $packageName): VersionMissingExceptionInterface
|
||||
{
|
||||
return new self('Cannot retrieve a version for package ' . $packageName . ' since it is provided, probably a metapackage');
|
||||
}
|
||||
}
|
13
vendor/jean85/pretty-package-versions/src/Exception/ReplacedPackageException.php
vendored
Normal file
13
vendor/jean85/pretty-package-versions/src/Exception/ReplacedPackageException.php
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Jean85\Exception;
|
||||
|
||||
class ReplacedPackageException extends \Exception implements VersionMissingExceptionInterface
|
||||
{
|
||||
public static function create(string $packageName): VersionMissingExceptionInterface
|
||||
{
|
||||
return new self('Cannot retrieve a version for package ' . $packageName . ' since it is replaced by some other package');
|
||||
}
|
||||
}
|
10
vendor/jean85/pretty-package-versions/src/Exception/VersionMissingExceptionInterface.php
vendored
Normal file
10
vendor/jean85/pretty-package-versions/src/Exception/VersionMissingExceptionInterface.php
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Jean85\Exception;
|
||||
|
||||
interface VersionMissingExceptionInterface extends \Throwable
|
||||
{
|
||||
public static function create(string $packageName): self;
|
||||
}
|
77
vendor/jean85/pretty-package-versions/src/PrettyVersions.php
vendored
Normal file
77
vendor/jean85/pretty-package-versions/src/PrettyVersions.php
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Jean85;
|
||||
|
||||
use Composer\InstalledVersions;
|
||||
use Jean85\Exception\ProvidedPackageException;
|
||||
use Jean85\Exception\ReplacedPackageException;
|
||||
use Jean85\Exception\VersionMissingExceptionInterface;
|
||||
|
||||
class PrettyVersions
|
||||
{
|
||||
/**
|
||||
* @throws VersionMissingExceptionInterface When a package is provided ({@see ProvidedPackageException}) or replaced ({@see ReplacedPackageException})
|
||||
*/
|
||||
public static function getVersion(string $packageName): Version
|
||||
{
|
||||
self::checkProvidedPackages($packageName);
|
||||
|
||||
self::checkReplacedPackages($packageName);
|
||||
|
||||
return new Version(
|
||||
$packageName,
|
||||
InstalledVersions::getPrettyVersion($packageName),
|
||||
InstalledVersions::getReference($packageName)
|
||||
);
|
||||
}
|
||||
|
||||
public static function getRootPackageName(): string
|
||||
{
|
||||
return InstalledVersions::getRootPackage()['name'];
|
||||
}
|
||||
|
||||
public static function getRootPackageVersion(): Version
|
||||
{
|
||||
return new Version(
|
||||
self::getRootPackageName(),
|
||||
InstalledVersions::getRootPackage()['pretty_version'],
|
||||
InstalledVersions::getRootPackage()['reference']
|
||||
);
|
||||
}
|
||||
|
||||
protected static function checkProvidedPackages(string $packageName): void
|
||||
{
|
||||
if (! method_exists(InstalledVersions::class, 'getAllRawData')) {
|
||||
if (isset(InstalledVersions::getRawData()['versions'][$packageName]['provided'])) {
|
||||
throw ProvidedPackageException::create($packageName);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (InstalledVersions::getAllRawData() as $installed) {
|
||||
if (isset($installed['versions'][$packageName]['provided'])) {
|
||||
throw ProvidedPackageException::create($packageName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected static function checkReplacedPackages(string $packageName): void
|
||||
{
|
||||
if (! method_exists(InstalledVersions::class, 'getAllRawData')) {
|
||||
if (isset(InstalledVersions::getRawData()['versions'][$packageName]['replaced'])) {
|
||||
throw ReplacedPackageException::create($packageName);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (InstalledVersions::getAllRawData() as $installed) {
|
||||
if (isset($installed['versions'][$packageName]['replaced'])) {
|
||||
throw ReplacedPackageException::create($packageName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
101
vendor/jean85/pretty-package-versions/src/Version.php
vendored
Normal file
101
vendor/jean85/pretty-package-versions/src/Version.php
vendored
Normal file
@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Jean85;
|
||||
|
||||
class Version
|
||||
{
|
||||
private const SHORT_COMMIT_LENGTH = 7;
|
||||
|
||||
/** @var string */
|
||||
private $packageName;
|
||||
|
||||
/** @var string */
|
||||
private $prettyVersion;
|
||||
|
||||
/** @var string */
|
||||
private $reference;
|
||||
|
||||
/** @var bool */
|
||||
private $versionIsTagged;
|
||||
|
||||
public const NO_VERSION_TEXT = '{no version}';
|
||||
public const NO_REFERENCE_TEXT = '{no reference}';
|
||||
|
||||
public function __construct(string $packageName, ?string $prettyVersion = null, ?string $reference = null)
|
||||
{
|
||||
$this->packageName = $packageName;
|
||||
$this->prettyVersion = $prettyVersion ?? self::NO_VERSION_TEXT;
|
||||
$this->reference = $reference ?? self::NO_REFERENCE_TEXT;
|
||||
$this->versionIsTagged = preg_match('/[^v\d.]/', $this->getShortVersion()) === 0;
|
||||
}
|
||||
|
||||
public function getPrettyVersion(): string
|
||||
{
|
||||
if ($this->versionIsTagged) {
|
||||
return $this->prettyVersion;
|
||||
}
|
||||
|
||||
return $this->getVersionWithShortReference();
|
||||
}
|
||||
|
||||
public function getFullVersion(): string
|
||||
{
|
||||
return $this->prettyVersion . '@' . $this->getReference();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public function getVersionWithShortCommit(): string
|
||||
{
|
||||
return $this->getVersionWithShortReference();
|
||||
}
|
||||
|
||||
public function getVersionWithShortReference(): string
|
||||
{
|
||||
return $this->prettyVersion . '@' . $this->getShortReference();
|
||||
}
|
||||
|
||||
public function getPackageName(): string
|
||||
{
|
||||
return $this->packageName;
|
||||
}
|
||||
|
||||
public function getShortVersion(): string
|
||||
{
|
||||
return $this->prettyVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public function getCommitHash(): string
|
||||
{
|
||||
return $this->getReference();
|
||||
}
|
||||
|
||||
public function getReference(): string
|
||||
{
|
||||
return $this->reference;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public function getShortCommitHash(): string
|
||||
{
|
||||
return $this->getShortReference();
|
||||
}
|
||||
|
||||
public function getShortReference(): string
|
||||
{
|
||||
return substr($this->reference, 0, self::SHORT_COMMIT_LENGTH);
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->getPrettyVersion();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user