Aggiornato Composer
This commit is contained in:
8
vendor/sebastian/cli-parser/ChangeLog.md
vendored
8
vendor/sebastian/cli-parser/ChangeLog.md
vendored
@@ -2,6 +2,12 @@
|
||||
|
||||
All notable changes are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
|
||||
|
||||
## [1.0.2] - 2024-03-02
|
||||
|
||||
### Changed
|
||||
|
||||
* Do not use implicitly nullable parameters
|
||||
|
||||
## [1.0.1] - 2020-09-28
|
||||
|
||||
### Changed
|
||||
@@ -12,4 +18,6 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
|
||||
|
||||
* Initial release
|
||||
|
||||
[1.0.2]: https://github.com/sebastianbergmann/cli-parser/compare/1.0.1...1.0.2
|
||||
[1.0.1]: https://github.com/sebastianbergmann/cli-parser/compare/1.0.0...1.0.1
|
||||
[1.0.0]: https://github.com/sebastianbergmann/cli-parser/compare/bb7bb3297957927962b0a3335befe7b66f7462e9...1.0.0
|
||||
|
||||
2
vendor/sebastian/cli-parser/src/Parser.php
vendored
2
vendor/sebastian/cli-parser/src/Parser.php
vendored
@@ -41,7 +41,7 @@ final class Parser
|
||||
* @throws OptionDoesNotAllowArgumentException
|
||||
* @throws UnknownOptionException
|
||||
*/
|
||||
public function parse(array $argv, string $shortOptions, array $longOptions = null): array
|
||||
public function parse(array $argv, string $shortOptions, ?array $longOptions = null): array
|
||||
{
|
||||
if (empty($argv)) {
|
||||
return [[], []];
|
||||
|
||||
41
vendor/sebastian/comparator/ChangeLog.md
vendored
41
vendor/sebastian/comparator/ChangeLog.md
vendored
@@ -2,6 +2,18 @@
|
||||
|
||||
All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
|
||||
|
||||
## [4.0.8] - 2022-09-14
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#102](https://github.com/sebastianbergmann/comparator/pull/102): Fix `float` comparison precision
|
||||
|
||||
## [4.0.7] - 2022-09-14
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#99](https://github.com/sebastianbergmann/comparator/pull/99): Fix weak comparison between `'0'` and `false`
|
||||
|
||||
## [4.0.6] - 2020-10-26
|
||||
|
||||
### Fixed
|
||||
@@ -44,6 +56,24 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
|
||||
|
||||
* Removed support for PHP 7.1 and PHP 7.2
|
||||
|
||||
## [3.0.5] - 2022-09-14
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#102](https://github.com/sebastianbergmann/comparator/pull/102): Fix `float` comparison precision
|
||||
|
||||
## [3.0.4] - 2022-09-14
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#99](https://github.com/sebastianbergmann/comparator/pull/99): Fix weak comparison between `'0'` and `false`
|
||||
|
||||
## [3.0.3] - 2020-11-30
|
||||
|
||||
### Changed
|
||||
|
||||
* Changed PHP version constraint in `composer.json` from `^7.1` to `>=7.1`
|
||||
|
||||
## [3.0.2] - 2018-07-12
|
||||
|
||||
### Changed
|
||||
@@ -61,7 +91,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#48](https://github.com/sebastianbergmann/comparator/issues/48): `DateTimeComparator` does not support fractional second deltas
|
||||
* [#48](https://github.com/sebastianbergmann/comparator/issues/48): `DateTimeComparator` does not support fractional second deltas
|
||||
|
||||
### Removed
|
||||
|
||||
@@ -83,7 +113,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [phpunit/#2923](https://github.com/sebastianbergmann/phpunit/issues/2923): Unexpected failed date matching
|
||||
* [phpunit/#2923](https://github.com/sebastianbergmann/phpunit/issues/2923): Unexpected failed date matching
|
||||
|
||||
## [2.1.0] - 2017-11-03
|
||||
|
||||
@@ -92,13 +122,18 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
|
||||
* Added `SebastianBergmann\Comparator\Factory::reset()` to unregister all non-default comparators
|
||||
* Added support for `phpunit/phpunit-mock-objects` version `^5.0`
|
||||
|
||||
[4.0.8]: https://github.com/sebastianbergmann/comparator/compare/4.0.7...4.0.8
|
||||
[4.0.7]: https://github.com/sebastianbergmann/comparator/compare/4.0.6...4.0.7
|
||||
[4.0.6]: https://github.com/sebastianbergmann/comparator/compare/4.0.5...4.0.6
|
||||
[4.0.5]: https://github.com/sebastianbergmann/comparator/compare/4.0.4...4.0.5
|
||||
[4.0.4]: https://github.com/sebastianbergmann/comparator/compare/4.0.3...4.0.4
|
||||
[4.0.3]: https://github.com/sebastianbergmann/comparator/compare/4.0.2...4.0.3
|
||||
[4.0.2]: https://github.com/sebastianbergmann/comparator/compare/4.0.1...4.0.2
|
||||
[4.0.1]: https://github.com/sebastianbergmann/comparator/compare/4.0.0...4.0.1
|
||||
[4.0.0]: https://github.com/sebastianbergmann/comparator/compare/3.0.2...4.0.0
|
||||
[4.0.0]: https://github.com/sebastianbergmann/comparator/compare/3.0.5...4.0.0
|
||||
[3.0.5]: https://github.com/sebastianbergmann/comparator/compare/3.0.4...3.0.5
|
||||
[3.0.4]: https://github.com/sebastianbergmann/comparator/compare/3.0.3...3.0.4
|
||||
[3.0.3]: https://github.com/sebastianbergmann/comparator/compare/3.0.2...3.0.3
|
||||
[3.0.2]: https://github.com/sebastianbergmann/comparator/compare/3.0.1...3.0.2
|
||||
[3.0.1]: https://github.com/sebastianbergmann/comparator/compare/3.0.0...3.0.1
|
||||
[3.0.0]: https://github.com/sebastianbergmann/comparator/compare/2.1.3...3.0.0
|
||||
|
||||
@@ -14,6 +14,8 @@ use function is_numeric;
|
||||
|
||||
/**
|
||||
* Compares doubles for equality.
|
||||
*
|
||||
* @deprecated since v3.0.5 and v4.0.8
|
||||
*/
|
||||
class DoubleComparator extends NumericComparator
|
||||
{
|
||||
|
||||
1
vendor/sebastian/comparator/src/Factory.php
vendored
1
vendor/sebastian/comparator/src/Factory.php
vendored
@@ -127,7 +127,6 @@ class Factory
|
||||
$this->registerDefaultComparator(new ObjectComparator);
|
||||
$this->registerDefaultComparator(new ResourceComparator);
|
||||
$this->registerDefaultComparator(new ArrayComparator);
|
||||
$this->registerDefaultComparator(new DoubleComparator);
|
||||
$this->registerDefaultComparator(new NumericComparator);
|
||||
$this->registerDefaultComparator(new ScalarComparator);
|
||||
$this->registerDefaultComparator(new TypeComparator);
|
||||
|
||||
@@ -32,10 +32,8 @@ class NumericComparator extends ScalarComparator
|
||||
*/
|
||||
public function accepts($expected, $actual)
|
||||
{
|
||||
// all numerical values, but not if one of them is a double
|
||||
// or both of them are strings
|
||||
// all numerical values, but not if both of them are strings
|
||||
return is_numeric($expected) && is_numeric($actual) &&
|
||||
!(is_float($expected) || is_float($actual)) &&
|
||||
!(is_string($expected) && is_string($actual));
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
namespace SebastianBergmann\Comparator;
|
||||
|
||||
use function is_bool;
|
||||
use function is_object;
|
||||
use function is_scalar;
|
||||
use function is_string;
|
||||
@@ -58,7 +59,7 @@ class ScalarComparator extends Comparator
|
||||
|
||||
// always compare as strings to avoid strange behaviour
|
||||
// otherwise 0 == 'Foobar'
|
||||
if (is_string($expected) || is_string($actual)) {
|
||||
if ((is_string($expected) && !is_bool($actual)) || (is_string($actual) && !is_bool($expected))) {
|
||||
$expectedToCompare = (string) $expectedToCompare;
|
||||
$actualToCompare = (string) $actualToCompare;
|
||||
|
||||
|
||||
7
vendor/sebastian/complexity/ChangeLog.md
vendored
7
vendor/sebastian/complexity/ChangeLog.md
vendored
@@ -2,6 +2,12 @@
|
||||
|
||||
All notable changes are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
|
||||
|
||||
## [2.0.3] - 2023-12-22
|
||||
|
||||
### Changed
|
||||
|
||||
* This component is now compatible with `nikic/php-parser` 5.0
|
||||
|
||||
## [2.0.2] - 2020-10-26
|
||||
|
||||
### Fixed
|
||||
@@ -24,6 +30,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
|
||||
|
||||
* Initial release
|
||||
|
||||
[2.0.3]: https://github.com/sebastianbergmann/complexity/compare/2.0.2...2.0.3
|
||||
[2.0.2]: https://github.com/sebastianbergmann/complexity/compare/2.0.1...2.0.2
|
||||
[2.0.1]: https://github.com/sebastianbergmann/complexity/compare/2.0.0...2.0.1
|
||||
[2.0.0]: https://github.com/sebastianbergmann/complexity/compare/1.0.0...2.0.0
|
||||
|
||||
3
vendor/sebastian/complexity/composer.json
vendored
3
vendor/sebastian/complexity/composer.json
vendored
@@ -14,9 +14,10 @@
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/complexity/issues"
|
||||
},
|
||||
"prefer-stable": true,
|
||||
"require": {
|
||||
"php": ">=7.3",
|
||||
"nikic/php-parser": "^4.7"
|
||||
"nikic/php-parser": "^4.18 || ^5.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.3"
|
||||
|
||||
@@ -10,12 +10,10 @@
|
||||
namespace SebastianBergmann\Complexity;
|
||||
|
||||
use PhpParser\Error;
|
||||
use PhpParser\Lexer;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\NodeTraverser;
|
||||
use PhpParser\NodeVisitor\NameResolver;
|
||||
use PhpParser\NodeVisitor\ParentConnectingVisitor;
|
||||
use PhpParser\Parser;
|
||||
use PhpParser\ParserFactory;
|
||||
|
||||
final class Calculator
|
||||
@@ -34,7 +32,7 @@ final class Calculator
|
||||
public function calculateForSourceString(string $source): ComplexityCollection
|
||||
{
|
||||
try {
|
||||
$nodes = $this->parser()->parse($source);
|
||||
$nodes = (new ParserFactory)->createForHostVersion()->parse($source);
|
||||
|
||||
assert($nodes !== null);
|
||||
|
||||
@@ -80,9 +78,4 @@ final class Calculator
|
||||
|
||||
return $complexityCalculatingVisitor->result();
|
||||
}
|
||||
|
||||
private function parser(): Parser
|
||||
{
|
||||
return (new ParserFactory)->create(ParserFactory::PREFER_PHP7, new Lexer);
|
||||
}
|
||||
}
|
||||
|
||||
15
vendor/sebastian/diff/ChangeLog.md
vendored
15
vendor/sebastian/diff/ChangeLog.md
vendored
@@ -2,6 +2,19 @@
|
||||
|
||||
All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
|
||||
|
||||
## [4.0.6] - 2024-03-02
|
||||
|
||||
### Changed
|
||||
|
||||
* Do not use implicitly nullable parameters
|
||||
|
||||
## [4.0.5] - 2023-05-07
|
||||
|
||||
### Changed
|
||||
|
||||
* [#118](https://github.com/sebastianbergmann/diff/pull/118): Improve performance of `MemoryEfficientLongestCommonSubsequenceCalculator`
|
||||
* [#119](https://github.com/sebastianbergmann/diff/pull/119): Improve performance of `TimeEfficientLongestCommonSubsequenceCalculator`
|
||||
|
||||
## [4.0.4] - 2020-10-26
|
||||
|
||||
### Fixed
|
||||
@@ -76,6 +89,8 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
|
||||
|
||||
* This component is no longer supported on PHP 5.6
|
||||
|
||||
[4.0.6]: https://github.com/sebastianbergmann/diff/compare/4.0.5...4.0.6
|
||||
[4.0.5]: https://github.com/sebastianbergmann/diff/compare/4.0.4...4.0.5
|
||||
[4.0.4]: https://github.com/sebastianbergmann/diff/compare/4.0.3...4.0.4
|
||||
[4.0.3]: https://github.com/sebastianbergmann/diff/compare/4.0.2...4.0.3
|
||||
[4.0.2]: https://github.com/sebastianbergmann/diff/compare/4.0.1...4.0.2
|
||||
|
||||
4
vendor/sebastian/diff/src/Differ.php
vendored
4
vendor/sebastian/diff/src/Differ.php
vendored
@@ -82,7 +82,7 @@ final class Differ
|
||||
* @param array|string $from
|
||||
* @param array|string $to
|
||||
*/
|
||||
public function diff($from, $to, LongestCommonSubsequenceCalculator $lcs = null): string
|
||||
public function diff($from, $to, ?LongestCommonSubsequenceCalculator $lcs = null): string
|
||||
{
|
||||
$diff = $this->diffToArray(
|
||||
$this->normalizeDiffInput($from),
|
||||
@@ -108,7 +108,7 @@ final class Differ
|
||||
* @param array|string $to
|
||||
* @param LongestCommonSubsequenceCalculator $lcs
|
||||
*/
|
||||
public function diffToArray($from, $to, LongestCommonSubsequenceCalculator $lcs = null): array
|
||||
public function diffToArray($from, $to, ?LongestCommonSubsequenceCalculator $lcs = null): array
|
||||
{
|
||||
if (is_string($from)) {
|
||||
$from = $this->splitStringByLines($from);
|
||||
|
||||
@@ -22,7 +22,7 @@ final class ConfigurationException extends InvalidArgumentException
|
||||
string $expected,
|
||||
$value,
|
||||
int $code = 0,
|
||||
Exception $previous = null
|
||||
?Exception $previous = null
|
||||
) {
|
||||
parent::__construct(
|
||||
sprintf(
|
||||
|
||||
@@ -78,7 +78,12 @@ final class MemoryEfficientLongestCommonSubsequenceCalculator implements Longest
|
||||
if ($from[$i] === $to[$j]) {
|
||||
$current[$j + 1] = $prev[$j] + 1;
|
||||
} else {
|
||||
$current[$j + 1] = max($current[$j], $prev[$j + 1]);
|
||||
// don't use max() to avoid function call overhead
|
||||
if ($current[$j] > $prev[$j + 1]) {
|
||||
$current[$j + 1] = $current[$j];
|
||||
} else {
|
||||
$current[$j + 1] = $prev[$j + 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,12 +37,24 @@ final class TimeEfficientLongestCommonSubsequenceCalculator implements LongestCo
|
||||
|
||||
for ($i = 1; $i <= $fromLength; ++$i) {
|
||||
for ($j = 1; $j <= $toLength; ++$j) {
|
||||
$o = ($j * $width) + $i;
|
||||
$matrix[$o] = max(
|
||||
$matrix[$o - 1],
|
||||
$matrix[$o - $width],
|
||||
$from[$i - 1] === $to[$j - 1] ? $matrix[$o - $width - 1] + 1 : 0
|
||||
);
|
||||
$o = ($j * $width) + $i;
|
||||
|
||||
// don't use max() to avoid function call overhead
|
||||
$firstOrLast = $from[$i - 1] === $to[$j - 1] ? $matrix[$o - $width - 1] + 1 : 0;
|
||||
|
||||
if ($matrix[$o - 1] > $matrix[$o - $width]) {
|
||||
if ($firstOrLast > $matrix[$o - 1]) {
|
||||
$matrix[$o] = $firstOrLast;
|
||||
} else {
|
||||
$matrix[$o] = $matrix[$o - 1];
|
||||
}
|
||||
} else {
|
||||
if ($firstOrLast > $matrix[$o - $width]) {
|
||||
$matrix[$o] = $firstOrLast;
|
||||
} else {
|
||||
$matrix[$o] = $matrix[$o - $width];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
7
vendor/sebastian/environment/ChangeLog.md
vendored
7
vendor/sebastian/environment/ChangeLog.md
vendored
@@ -2,6 +2,12 @@
|
||||
|
||||
All notable changes in `sebastianbergmann/environment` are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
|
||||
|
||||
## [5.1.5] - 2023-02-03
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#59](https://github.com/sebastianbergmann/environment/issues/59): Wrong usage of `stream_isatty()`, `fstat()` used without checking whether the function is available
|
||||
|
||||
## [5.1.4] - 2022-04-03
|
||||
|
||||
### Fixed
|
||||
@@ -151,6 +157,7 @@ All notable changes in `sebastianbergmann/environment` are documented in this fi
|
||||
|
||||
* This component is no longer supported on PHP 5.6
|
||||
|
||||
[5.1.5]: https://github.com/sebastianbergmann/environment/compare/5.1.4...5.1.5
|
||||
[5.1.4]: https://github.com/sebastianbergmann/environment/compare/5.1.3...5.1.4
|
||||
[5.1.3]: https://github.com/sebastianbergmann/environment/compare/5.1.2...5.1.3
|
||||
[5.1.2]: https://github.com/sebastianbergmann/environment/compare/5.1.1...5.1.2
|
||||
|
||||
6
vendor/sebastian/environment/src/Console.php
vendored
6
vendor/sebastian/environment/src/Console.php
vendored
@@ -105,16 +105,14 @@ final class Console
|
||||
public function isInteractive($fileDescriptor = self::STDOUT): bool
|
||||
{
|
||||
if (is_resource($fileDescriptor)) {
|
||||
// These functions require a descriptor that is a real resource, not a numeric ID of it
|
||||
if (function_exists('stream_isatty') && @stream_isatty($fileDescriptor)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if formatted mode is S_IFCHR
|
||||
if (function_exists('fstat') && @stream_isatty($fileDescriptor)) {
|
||||
if (function_exists('fstat')) {
|
||||
$stat = @fstat(STDOUT);
|
||||
|
||||
return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
|
||||
return $stat && 0020000 === ($stat['mode'] & 0170000);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
21
vendor/sebastian/exporter/ChangeLog.md
vendored
21
vendor/sebastian/exporter/ChangeLog.md
vendored
@@ -2,6 +2,18 @@
|
||||
|
||||
All notable changes are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
|
||||
|
||||
## [4.0.6] - 2024-03-02
|
||||
|
||||
### Changed
|
||||
|
||||
* Do not use implicitly nullable parameters
|
||||
|
||||
## [4.0.5] - 2022-09-14
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#47](https://github.com/sebastianbergmann/exporter/pull/47): Fix `float` export precision
|
||||
|
||||
## [4.0.4] - 2021-11-11
|
||||
|
||||
### Changed
|
||||
@@ -32,6 +44,12 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
|
||||
|
||||
* This component is no longer supported on PHP 7.0, PHP 7.1, and PHP 7.2
|
||||
|
||||
## [3.1.5] - 2022-09-14
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#47](https://github.com/sebastianbergmann/exporter/pull/47): Fix `float` export precision
|
||||
|
||||
## [3.1.4] - 2021-11-11
|
||||
|
||||
### Changed
|
||||
@@ -54,11 +72,14 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
|
||||
|
||||
* Remove HHVM-specific code that is no longer needed
|
||||
|
||||
[4.0.6]: https://github.com/sebastianbergmann/exporter/compare/4.0.5...4.0.6
|
||||
[4.0.5]: https://github.com/sebastianbergmann/exporter/compare/4.0.4...4.0.5
|
||||
[4.0.4]: https://github.com/sebastianbergmann/exporter/compare/4.0.3...4.0.4
|
||||
[4.0.3]: https://github.com/sebastianbergmann/exporter/compare/4.0.2...4.0.3
|
||||
[4.0.2]: https://github.com/sebastianbergmann/exporter/compare/4.0.1...4.0.2
|
||||
[4.0.1]: https://github.com/sebastianbergmann/exporter/compare/4.0.0...4.0.1
|
||||
[4.0.0]: https://github.com/sebastianbergmann/exporter/compare/3.1.2...4.0.0
|
||||
[3.1.5]: https://github.com/sebastianbergmann/exporter/compare/3.1.4...3.1.5
|
||||
[3.1.4]: https://github.com/sebastianbergmann/exporter/compare/3.1.3...3.1.4
|
||||
[3.1.3]: https://github.com/sebastianbergmann/exporter/compare/3.1.2...3.1.3
|
||||
[3.1.2]: https://github.com/sebastianbergmann/exporter/compare/3.1.1...3.1.2
|
||||
|
||||
22
vendor/sebastian/exporter/src/Exporter.php
vendored
22
vendor/sebastian/exporter/src/Exporter.php
vendored
@@ -16,6 +16,8 @@ use function get_class;
|
||||
use function get_resource_type;
|
||||
use function gettype;
|
||||
use function implode;
|
||||
use function ini_get;
|
||||
use function ini_set;
|
||||
use function is_array;
|
||||
use function is_float;
|
||||
use function is_object;
|
||||
@@ -75,7 +77,7 @@ class Exporter
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function shortenedRecursiveExport(&$data, Context $context = null)
|
||||
public function shortenedRecursiveExport(&$data, ?Context $context = null)
|
||||
{
|
||||
$result = [];
|
||||
$exporter = new self();
|
||||
@@ -232,8 +234,22 @@ class Exporter
|
||||
return 'false';
|
||||
}
|
||||
|
||||
if (is_float($value) && (float) ((int) $value) === $value) {
|
||||
return "{$value}.0";
|
||||
if (is_float($value)) {
|
||||
$precisionBackup = ini_get('precision');
|
||||
|
||||
ini_set('precision', '-1');
|
||||
|
||||
try {
|
||||
$valueStr = (string) $value;
|
||||
|
||||
if ((string) (int) $value === $valueStr) {
|
||||
return $valueStr . '.0';
|
||||
}
|
||||
|
||||
return $valueStr;
|
||||
} finally {
|
||||
ini_set('precision', $precisionBackup);
|
||||
}
|
||||
}
|
||||
|
||||
if (gettype($value) === 'resource (closed)') {
|
||||
|
||||
14
vendor/sebastian/global-state/ChangeLog.md
vendored
14
vendor/sebastian/global-state/ChangeLog.md
vendored
@@ -2,6 +2,18 @@
|
||||
|
||||
All notable changes in `sebastian/global-state` are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
|
||||
|
||||
## [5.0.7] - 2024-03-02
|
||||
|
||||
### Changed
|
||||
|
||||
* Do not use implicitly nullable parameters
|
||||
|
||||
## [5.0.6] - 2023-08-02
|
||||
|
||||
### Changed
|
||||
|
||||
* Changed usage of `ReflectionProperty::setValue()` to be compatible with PHP 8.3
|
||||
|
||||
## [5.0.5] - 2022-02-14
|
||||
|
||||
### Fixed
|
||||
@@ -66,6 +78,8 @@ All notable changes in `sebastian/global-state` are documented in this file usin
|
||||
|
||||
* This component is no longer supported on PHP 7.0 and PHP 7.1
|
||||
|
||||
[5.0.7]: https://github.com/sebastianbergmann/global-state/compare/5.0.6...5.0.7
|
||||
[5.0.6]: https://github.com/sebastianbergmann/global-state/compare/5.0.5...5.0.6
|
||||
[5.0.5]: https://github.com/sebastianbergmann/global-state/compare/5.0.4...5.0.5
|
||||
[5.0.4]: https://github.com/sebastianbergmann/global-state/compare/5.0.3...5.0.4
|
||||
[5.0.3]: https://github.com/sebastianbergmann/global-state/compare/5.0.2...5.0.3
|
||||
|
||||
@@ -85,7 +85,7 @@ class Restorer
|
||||
foreach ($staticAttributes as $name => $value) {
|
||||
$reflector = new ReflectionProperty($className, $name);
|
||||
$reflector->setAccessible(true);
|
||||
$reflector->setValue($value);
|
||||
$reflector->setValue(null, $value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ class Restorer
|
||||
}
|
||||
|
||||
$attribute->setAccessible(true);
|
||||
$attribute->setValue($defaults[$name]);
|
||||
$attribute->setValue(null, $defaults[$name]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ class Snapshot
|
||||
/**
|
||||
* Creates a snapshot of the current global state.
|
||||
*/
|
||||
public function __construct(ExcludeList $excludeList = null, bool $includeGlobalVariables = true, bool $includeStaticAttributes = true, bool $includeConstants = true, bool $includeFunctions = true, bool $includeClasses = true, bool $includeInterfaces = true, bool $includeTraits = true, bool $includeIniSettings = true, bool $includeIncludedFiles = true)
|
||||
public function __construct(?ExcludeList $excludeList = null, bool $includeGlobalVariables = true, bool $includeStaticAttributes = true, bool $includeConstants = true, bool $includeFunctions = true, bool $includeClasses = true, bool $includeInterfaces = true, bool $includeTraits = true, bool $includeIniSettings = true, bool $includeIncludedFiles = true)
|
||||
{
|
||||
$this->excludeList = $excludeList ?: new ExcludeList;
|
||||
|
||||
|
||||
7
vendor/sebastian/lines-of-code/ChangeLog.md
vendored
7
vendor/sebastian/lines-of-code/ChangeLog.md
vendored
@@ -2,6 +2,12 @@
|
||||
|
||||
All notable changes are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
|
||||
|
||||
## [1.0.4] - 2023-12-22
|
||||
|
||||
### Changed
|
||||
|
||||
* This component is now compatible with `nikic/php-parser` 5.0
|
||||
|
||||
## [1.0.3] - 2020-11-28
|
||||
|
||||
### Fixed
|
||||
@@ -28,6 +34,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
|
||||
|
||||
* Initial release
|
||||
|
||||
[1.0.4]: https://github.com/sebastianbergmann/lines-of-code/compare/1.0.3...1.0.4
|
||||
[1.0.3]: https://github.com/sebastianbergmann/lines-of-code/compare/1.0.2...1.0.3
|
||||
[1.0.2]: https://github.com/sebastianbergmann/lines-of-code/compare/1.0.1...1.0.2
|
||||
[1.0.1]: https://github.com/sebastianbergmann/lines-of-code/compare/1.0.0...1.0.1
|
||||
|
||||
2
vendor/sebastian/lines-of-code/composer.json
vendored
2
vendor/sebastian/lines-of-code/composer.json
vendored
@@ -17,7 +17,7 @@
|
||||
"prefer-stable": true,
|
||||
"require": {
|
||||
"php": ">=7.3",
|
||||
"nikic/php-parser": "^4.6"
|
||||
"nikic/php-parser": "^4.18 || ^5.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.3"
|
||||
|
||||
@@ -11,10 +11,8 @@ namespace SebastianBergmann\LinesOfCode;
|
||||
|
||||
use function substr_count;
|
||||
use PhpParser\Error;
|
||||
use PhpParser\Lexer;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\NodeTraverser;
|
||||
use PhpParser\Parser;
|
||||
use PhpParser\ParserFactory;
|
||||
|
||||
final class Counter
|
||||
@@ -39,7 +37,7 @@ final class Counter
|
||||
}
|
||||
|
||||
try {
|
||||
$nodes = $this->parser()->parse($source);
|
||||
$nodes = (new ParserFactory)->createForHostVersion()->parse($source);
|
||||
|
||||
assert($nodes !== null);
|
||||
|
||||
@@ -83,9 +81,4 @@ final class Counter
|
||||
|
||||
return $visitor->result();
|
||||
}
|
||||
|
||||
private function parser(): Parser
|
||||
{
|
||||
return (new ParserFactory)->create(ParserFactory::PREFER_PHP7, new Lexer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<files psalm-version="4.0.1@b1e2e30026936ef8d5bf6a354d1c3959b6231f44">
|
||||
<file src="src/Context.php">
|
||||
<RedundantConditionGivenDocblockType occurrences="1">
|
||||
<code>is_array($array)</code>
|
||||
</RedundantConditionGivenDocblockType>
|
||||
</file>
|
||||
</files>
|
||||
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<psalm
|
||||
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"
|
||||
resolveFromConfigFile="false"
|
||||
totallyTyped="false"
|
||||
errorBaseline=".psalm/baseline.xml"
|
||||
>
|
||||
<projectFiles>
|
||||
<directory name="src" />
|
||||
<ignoreFiles>
|
||||
<directory name="vendor" />
|
||||
</ignoreFiles>
|
||||
</projectFiles>
|
||||
</psalm>
|
||||
@@ -2,6 +2,12 @@
|
||||
|
||||
All notable changes are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
|
||||
|
||||
## [4.0.5] - 2023-02-03
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#26](https://github.com/sebastianbergmann/recursion-context/pull/26): Don't clobber `null` values if `array_key_exists(PHP_INT_MAX, $array)`
|
||||
|
||||
## [4.0.4] - 2020-10-26
|
||||
|
||||
### Fixed
|
||||
@@ -27,6 +33,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
|
||||
|
||||
* Tests etc. are now ignored for archive exports
|
||||
|
||||
[4.0.5]: https://github.com/sebastianbergmann/recursion-context/compare/4.0.4...4.0.5
|
||||
[4.0.4]: https://github.com/sebastianbergmann/recursion-context/compare/4.0.3...4.0.4
|
||||
[4.0.3]: https://github.com/sebastianbergmann/recursion-context/compare/4.0.2...4.0.3
|
||||
[4.0.2]: https://github.com/sebastianbergmann/recursion-context/compare/4.0.1...4.0.2
|
||||
|
||||
2
vendor/sebastian/recursion-context/LICENSE
vendored
2
vendor/sebastian/recursion-context/LICENSE
vendored
@@ -1,6 +1,6 @@
|
||||
Recursion Context
|
||||
|
||||
Copyright (c) 2002-2020, Sebastian Bergmann <sebastian@phpunit.de>.
|
||||
Copyright (c) 2002-2022, Sebastian Bergmann <sebastian@phpunit.de>.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "sebastian/recursion-context",
|
||||
"description": "Provides functionality to recursively process PHP variables",
|
||||
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
|
||||
"homepage": "https://github.com/sebastianbergmann/recursion-context",
|
||||
"license": "BSD-3-Clause",
|
||||
"authors": [
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php declare(strict_types=1);
|
||||
/*
|
||||
* This file is part of the Recursion Context package.
|
||||
* This file is part of sebastian/recursion-context.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
@@ -11,6 +11,7 @@ namespace SebastianBergmann\RecursionContext;
|
||||
|
||||
use const PHP_INT_MAX;
|
||||
use const PHP_INT_MIN;
|
||||
use function array_key_exists;
|
||||
use function array_pop;
|
||||
use function array_slice;
|
||||
use function count;
|
||||
@@ -128,19 +129,23 @@ final class Context
|
||||
$key = count($this->arrays);
|
||||
$this->arrays[] = &$array;
|
||||
|
||||
if (!isset($array[PHP_INT_MAX]) && !isset($array[PHP_INT_MAX - 1])) {
|
||||
if (!array_key_exists(PHP_INT_MAX, $array) && !array_key_exists(PHP_INT_MAX - 1, $array)) {
|
||||
$array[] = $key;
|
||||
$array[] = $this->objects;
|
||||
} else { /* cover the improbable case too */
|
||||
/* Note that array_slice (used in containsArray) will return the
|
||||
* last two values added *not necessarily* the highest integer
|
||||
* keys in the array, so the order of these writes to $array
|
||||
* is important, but the actual keys used is not. */
|
||||
do {
|
||||
$key = random_int(PHP_INT_MIN, PHP_INT_MAX);
|
||||
} while (isset($array[$key]));
|
||||
} while (array_key_exists($key, $array));
|
||||
|
||||
$array[$key] = $key;
|
||||
|
||||
do {
|
||||
$key = random_int(PHP_INT_MIN, PHP_INT_MAX);
|
||||
} while (isset($array[$key]));
|
||||
} while (array_key_exists($key, $array));
|
||||
|
||||
$array[$key] = $this->objects;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php declare(strict_types=1);
|
||||
/*
|
||||
* This file is part of the Recursion Context package.
|
||||
* This file is part of sebastian/recursion-context.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php declare(strict_types=1);
|
||||
/*
|
||||
* This file is part of the Recursion Context package.
|
||||
* This file is part of sebastian/recursion-context.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
/.github export-ignore
|
||||
/.php_cs.dist export-ignore
|
||||
/build.xml export-ignore
|
||||
/phpunit.xml export-ignore
|
||||
/tests export-ignore
|
||||
|
||||
*.php diff=php
|
||||
@@ -1,6 +0,0 @@
|
||||
/.idea
|
||||
/.php_cs.cache
|
||||
/build/FunctionSignatureMap.php
|
||||
/composer.lock
|
||||
/vendor
|
||||
/.phpunit.result.cache
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
All notable changes are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
|
||||
|
||||
## [3.0.4] - 2024-03-14
|
||||
|
||||
No functional changes.
|
||||
|
||||
## [3.0.3] - 2020-09-28
|
||||
|
||||
### Changed
|
||||
@@ -46,6 +50,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
|
||||
|
||||
* Initial release
|
||||
|
||||
[3.0.4]: https://github.com/sebastianbergmann/comparator/resource-operations/3.0.3...3.0.4
|
||||
[3.0.3]: https://github.com/sebastianbergmann/comparator/resource-operations/3.0.2...3.0.3
|
||||
[3.0.2]: https://github.com/sebastianbergmann/comparator/resource-operations/3.0.1...3.0.2
|
||||
[3.0.1]: https://github.com/sebastianbergmann/comparator/resource-operations/3.0.0...3.0.1
|
||||
|
||||
0
vendor/sebastian/resource-operations/build/generate.php
vendored
Executable file → Normal file
0
vendor/sebastian/resource-operations/build/generate.php
vendored
Executable file → Normal file
@@ -30,8 +30,9 @@
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.0-dev"
|
||||
"dev-main": "3.0-dev"
|
||||
}
|
||||
}
|
||||
},
|
||||
"abandoned": false
|
||||
}
|
||||
|
||||
|
||||
27
vendor/sebastian/type/ChangeLog.md
vendored
27
vendor/sebastian/type/ChangeLog.md
vendored
@@ -2,11 +2,26 @@
|
||||
|
||||
All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
|
||||
|
||||
## [4.0.0] - 2022-MM-DD
|
||||
## [3.2.1] - 2023-02-03
|
||||
|
||||
### Removed
|
||||
### Fixed
|
||||
|
||||
* This component is no longer supported on PHP 7.3 and PHP 7.4
|
||||
* [#28](https://github.com/sebastianbergmann/type/pull/28): Potential undefined offset warning/notice
|
||||
|
||||
## [3.2.0] - 2022-09-12
|
||||
|
||||
### Added
|
||||
|
||||
* [#25](https://github.com/sebastianbergmann/type/issues/25): Support Disjunctive Normal Form types
|
||||
* Added `ReflectionMapper::fromParameterTypes()`
|
||||
* Added `IntersectionType::types()` and `UnionType::types()`
|
||||
* Added `UnionType::containsIntersectionTypes()`
|
||||
|
||||
## [3.1.0] - 2022-08-29
|
||||
|
||||
### Added
|
||||
|
||||
* [#21](https://github.com/sebastianbergmann/type/issues/21): Support `true` as stand-alone type
|
||||
|
||||
## [3.0.0] - 2022-03-15
|
||||
|
||||
@@ -29,6 +44,8 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
|
||||
|
||||
## [2.3.4] - 2021-06-15
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed regression introduced in 2.3.3
|
||||
|
||||
## [2.3.3] - 2021-06-15 [YANKED]
|
||||
@@ -130,7 +147,9 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
|
||||
|
||||
* Initial release based on [code contributed by Michel Hartmann to PHPUnit](https://github.com/sebastianbergmann/phpunit/pull/3673)
|
||||
|
||||
[4.0.0]: https://github.com/sebastianbergmann/type/compare/3.0...master
|
||||
[3.2.1]: https://github.com/sebastianbergmann/type/compare/3.2.0...3.2.1
|
||||
[3.2.0]: https://github.com/sebastianbergmann/type/compare/3.1.0...3.2.0
|
||||
[3.1.0]: https://github.com/sebastianbergmann/type/compare/3.0.0...3.1.0
|
||||
[3.0.0]: https://github.com/sebastianbergmann/type/compare/2.3.4...3.0.0
|
||||
[2.3.4]: https://github.com/sebastianbergmann/type/compare/ca39369c41313ed12c071ed38ecda8fcdb248859...2.3.4
|
||||
[2.3.3]: https://github.com/sebastianbergmann/type/compare/2.3.2...ca39369c41313ed12c071ed38ecda8fcdb248859
|
||||
|
||||
2
vendor/sebastian/type/composer.json
vendored
2
vendor/sebastian/type/composer.json
vendored
@@ -44,7 +44,7 @@
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.0-dev"
|
||||
"dev-master": "3.2-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
163
vendor/sebastian/type/src/ReflectionMapper.php
vendored
163
vendor/sebastian/type/src/ReflectionMapper.php
vendored
@@ -19,6 +19,55 @@ use ReflectionUnionType;
|
||||
|
||||
final class ReflectionMapper
|
||||
{
|
||||
/**
|
||||
* @psalm-return list<Parameter>
|
||||
*/
|
||||
public function fromParameterTypes(ReflectionFunctionAbstract $functionOrMethod): array
|
||||
{
|
||||
$parameters = [];
|
||||
|
||||
foreach ($functionOrMethod->getParameters() as $parameter) {
|
||||
$name = $parameter->getName();
|
||||
|
||||
assert($name !== '');
|
||||
|
||||
if (!$parameter->hasType()) {
|
||||
$parameters[] = new Parameter($name, new UnknownType);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$type = $parameter->getType();
|
||||
|
||||
if ($type instanceof ReflectionNamedType) {
|
||||
$parameters[] = new Parameter(
|
||||
$name,
|
||||
$this->mapNamedType($type, $functionOrMethod)
|
||||
);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($type instanceof ReflectionUnionType) {
|
||||
$parameters[] = new Parameter(
|
||||
$name,
|
||||
$this->mapUnionType($type, $functionOrMethod)
|
||||
);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($type instanceof ReflectionIntersectionType) {
|
||||
$parameters[] = new Parameter(
|
||||
$name,
|
||||
$this->mapIntersectionType($type, $functionOrMethod)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $parameters;
|
||||
}
|
||||
|
||||
public function fromReturnType(ReflectionFunctionAbstract $functionOrMethod): Type
|
||||
{
|
||||
if (!$this->hasReturnType($functionOrMethod)) {
|
||||
@@ -30,54 +79,78 @@ final class ReflectionMapper
|
||||
assert($returnType instanceof ReflectionNamedType || $returnType instanceof ReflectionUnionType || $returnType instanceof ReflectionIntersectionType);
|
||||
|
||||
if ($returnType instanceof ReflectionNamedType) {
|
||||
if ($functionOrMethod instanceof ReflectionMethod && $returnType->getName() === 'self') {
|
||||
return ObjectType::fromName(
|
||||
$functionOrMethod->getDeclaringClass()->getName(),
|
||||
$returnType->allowsNull()
|
||||
);
|
||||
}
|
||||
|
||||
if ($functionOrMethod instanceof ReflectionMethod && $returnType->getName() === 'static') {
|
||||
return new StaticType(
|
||||
TypeName::fromReflection($functionOrMethod->getDeclaringClass()),
|
||||
$returnType->allowsNull()
|
||||
);
|
||||
}
|
||||
|
||||
if ($returnType->getName() === 'mixed') {
|
||||
return new MixedType;
|
||||
}
|
||||
|
||||
if ($functionOrMethod instanceof ReflectionMethod && $returnType->getName() === 'parent') {
|
||||
return ObjectType::fromName(
|
||||
$functionOrMethod->getDeclaringClass()->getParentClass()->getName(),
|
||||
$returnType->allowsNull()
|
||||
);
|
||||
}
|
||||
|
||||
return Type::fromName(
|
||||
$returnType->getName(),
|
||||
$returnType->allowsNull()
|
||||
);
|
||||
}
|
||||
|
||||
assert($returnType instanceof ReflectionUnionType || $returnType instanceof ReflectionIntersectionType);
|
||||
|
||||
$types = [];
|
||||
|
||||
foreach ($returnType->getTypes() as $type) {
|
||||
if ($functionOrMethod instanceof ReflectionMethod && $type->getName() === 'self') {
|
||||
$types[] = ObjectType::fromName(
|
||||
$functionOrMethod->getDeclaringClass()->getName(),
|
||||
false
|
||||
);
|
||||
} else {
|
||||
$types[] = Type::fromName($type->getName(), false);
|
||||
}
|
||||
return $this->mapNamedType($returnType, $functionOrMethod);
|
||||
}
|
||||
|
||||
if ($returnType instanceof ReflectionUnionType) {
|
||||
return new UnionType(...$types);
|
||||
return $this->mapUnionType($returnType, $functionOrMethod);
|
||||
}
|
||||
|
||||
if ($returnType instanceof ReflectionIntersectionType) {
|
||||
return $this->mapIntersectionType($returnType, $functionOrMethod);
|
||||
}
|
||||
}
|
||||
|
||||
private function mapNamedType(ReflectionNamedType $type, ReflectionFunctionAbstract $functionOrMethod): Type
|
||||
{
|
||||
if ($functionOrMethod instanceof ReflectionMethod && $type->getName() === 'self') {
|
||||
return ObjectType::fromName(
|
||||
$functionOrMethod->getDeclaringClass()->getName(),
|
||||
$type->allowsNull()
|
||||
);
|
||||
}
|
||||
|
||||
if ($functionOrMethod instanceof ReflectionMethod && $type->getName() === 'static') {
|
||||
return new StaticType(
|
||||
TypeName::fromReflection($functionOrMethod->getDeclaringClass()),
|
||||
$type->allowsNull()
|
||||
);
|
||||
}
|
||||
|
||||
if ($type->getName() === 'mixed') {
|
||||
return new MixedType;
|
||||
}
|
||||
|
||||
if ($functionOrMethod instanceof ReflectionMethod && $type->getName() === 'parent') {
|
||||
return ObjectType::fromName(
|
||||
$functionOrMethod->getDeclaringClass()->getParentClass()->getName(),
|
||||
$type->allowsNull()
|
||||
);
|
||||
}
|
||||
|
||||
return Type::fromName(
|
||||
$type->getName(),
|
||||
$type->allowsNull()
|
||||
);
|
||||
}
|
||||
|
||||
private function mapUnionType(ReflectionUnionType $type, ReflectionFunctionAbstract $functionOrMethod): Type
|
||||
{
|
||||
$types = [];
|
||||
|
||||
foreach ($type->getTypes() as $_type) {
|
||||
assert($_type instanceof ReflectionNamedType || $_type instanceof ReflectionIntersectionType);
|
||||
|
||||
if ($_type instanceof ReflectionNamedType) {
|
||||
$types[] = $this->mapNamedType($_type, $functionOrMethod);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$types[] = $this->mapIntersectionType($_type, $functionOrMethod);
|
||||
}
|
||||
|
||||
return new UnionType(...$types);
|
||||
}
|
||||
|
||||
private function mapIntersectionType(ReflectionIntersectionType $type, ReflectionFunctionAbstract $functionOrMethod): Type
|
||||
{
|
||||
$types = [];
|
||||
|
||||
foreach ($type->getTypes() as $_type) {
|
||||
assert($_type instanceof ReflectionNamedType);
|
||||
|
||||
$types[] = $this->mapNamedType($_type, $functionOrMethod);
|
||||
}
|
||||
|
||||
return new IntersectionType(...$types);
|
||||
|
||||
11
vendor/sebastian/type/src/type/CallableType.php
vendored
11
vendor/sebastian/type/src/type/CallableType.php
vendored
@@ -84,6 +84,9 @@ final class CallableType extends Type
|
||||
return $this->allowsNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true CallableType $this
|
||||
*/
|
||||
public function isCallable(): bool
|
||||
{
|
||||
return true;
|
||||
@@ -140,6 +143,10 @@ final class CallableType extends Type
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isset($type->value()[0], $type->value()[1])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!is_object($type->value()[0]) || !is_string($type->value()[1])) {
|
||||
return false;
|
||||
}
|
||||
@@ -168,6 +175,10 @@ final class CallableType extends Type
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isset($type->value()[0], $type->value()[1])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!is_string($type->value()[0]) || !is_string($type->value()[1])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
3
vendor/sebastian/type/src/type/FalseType.php
vendored
3
vendor/sebastian/type/src/type/FalseType.php
vendored
@@ -32,6 +32,9 @@ final class FalseType extends Type
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true FalseType $this
|
||||
*/
|
||||
public function isFalse(): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -44,6 +44,9 @@ final class GenericObjectType extends Type
|
||||
return $this->allowsNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true GenericObjectType $this
|
||||
*/
|
||||
public function isGenericObject(): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -9,16 +9,16 @@
|
||||
*/
|
||||
namespace SebastianBergmann\Type;
|
||||
|
||||
use function array_unique;
|
||||
use function assert;
|
||||
use function count;
|
||||
use function implode;
|
||||
use function in_array;
|
||||
use function sort;
|
||||
|
||||
final class IntersectionType extends Type
|
||||
{
|
||||
/**
|
||||
* @psalm-var list<Type>
|
||||
* @psalm-var non-empty-list<Type>
|
||||
*/
|
||||
private $types;
|
||||
|
||||
@@ -62,11 +62,22 @@ final class IntersectionType extends Type
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true IntersectionType $this
|
||||
*/
|
||||
public function isIntersection(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-return non-empty-list<Type>
|
||||
*/
|
||||
public function types(): array
|
||||
{
|
||||
return $this->types;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
@@ -103,13 +114,13 @@ final class IntersectionType extends Type
|
||||
foreach ($types as $type) {
|
||||
assert($type instanceof ObjectType);
|
||||
|
||||
$names[] = $type->className()->qualifiedName();
|
||||
}
|
||||
$classQualifiedName = $type->className()->qualifiedName();
|
||||
|
||||
if (count(array_unique($names)) < count($names)) {
|
||||
throw new RuntimeException(
|
||||
'An intersection type must not contain duplicate types'
|
||||
);
|
||||
if (in_array($classQualifiedName, $names, true)) {
|
||||
throw new RuntimeException('An intersection type must not contain duplicate types');
|
||||
}
|
||||
|
||||
$names[] = $classQualifiedName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,9 @@ final class IterableType extends Type
|
||||
return $this->allowsNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true IterableType $this
|
||||
*/
|
||||
public function isIterable(): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
3
vendor/sebastian/type/src/type/MixedType.php
vendored
3
vendor/sebastian/type/src/type/MixedType.php
vendored
@@ -31,6 +31,9 @@ final class MixedType extends Type
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true MixedType $this
|
||||
*/
|
||||
public function isMixed(): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
3
vendor/sebastian/type/src/type/NeverType.php
vendored
3
vendor/sebastian/type/src/type/NeverType.php
vendored
@@ -26,6 +26,9 @@ final class NeverType extends Type
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true NeverType $this
|
||||
*/
|
||||
public function isNever(): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
3
vendor/sebastian/type/src/type/NullType.php
vendored
3
vendor/sebastian/type/src/type/NullType.php
vendored
@@ -31,6 +31,9 @@ final class NullType extends Type
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true NullType $this
|
||||
*/
|
||||
public function isNull(): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -64,6 +64,9 @@ final class ObjectType extends Type
|
||||
return $this->className;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true ObjectType $this
|
||||
*/
|
||||
public function isObject(): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -41,6 +41,10 @@ final class SimpleType extends Type
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->name === 'bool' && $other->name() === 'true') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->name === 'bool' && $other->name() === 'false') {
|
||||
return true;
|
||||
}
|
||||
@@ -67,6 +71,9 @@ final class SimpleType extends Type
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true SimpleType $this
|
||||
*/
|
||||
public function isSimple(): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -58,6 +58,9 @@ final class StaticType extends Type
|
||||
return $this->allowsNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true StaticType $this
|
||||
*/
|
||||
public function isStatic(): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
63
vendor/sebastian/type/src/type/Type.php
vendored
63
vendor/sebastian/type/src/type/Type.php
vendored
@@ -19,8 +19,14 @@ abstract class Type
|
||||
{
|
||||
public static function fromValue($value, bool $allowsNull): self
|
||||
{
|
||||
if ($value === false) {
|
||||
return new FalseType;
|
||||
if ($allowsNull === false) {
|
||||
if ($value === true) {
|
||||
return new TrueType;
|
||||
}
|
||||
|
||||
if ($value === false) {
|
||||
return new FalseType;
|
||||
}
|
||||
}
|
||||
|
||||
$typeName = gettype($value);
|
||||
@@ -48,6 +54,9 @@ abstract class Type
|
||||
case 'callable':
|
||||
return new CallableType($allowsNull);
|
||||
|
||||
case 'true':
|
||||
return new TrueType;
|
||||
|
||||
case 'false':
|
||||
return new FalseType;
|
||||
|
||||
@@ -89,71 +98,121 @@ abstract class Type
|
||||
return ($this->allowsNull() ? '?' : '') . $this->name();
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true CallableType $this
|
||||
*/
|
||||
public function isCallable(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true TrueType $this
|
||||
*/
|
||||
public function isTrue(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true FalseType $this
|
||||
*/
|
||||
public function isFalse(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true GenericObjectType $this
|
||||
*/
|
||||
public function isGenericObject(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true IntersectionType $this
|
||||
*/
|
||||
public function isIntersection(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true IterableType $this
|
||||
*/
|
||||
public function isIterable(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true MixedType $this
|
||||
*/
|
||||
public function isMixed(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true NeverType $this
|
||||
*/
|
||||
public function isNever(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true NullType $this
|
||||
*/
|
||||
public function isNull(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true ObjectType $this
|
||||
*/
|
||||
public function isObject(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true SimpleType $this
|
||||
*/
|
||||
public function isSimple(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true StaticType $this
|
||||
*/
|
||||
public function isStatic(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true UnionType $this
|
||||
*/
|
||||
public function isUnion(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true UnknownType $this
|
||||
*/
|
||||
public function isUnknown(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true VoidType $this
|
||||
*/
|
||||
public function isVoid(): bool
|
||||
{
|
||||
return false;
|
||||
|
||||
30
vendor/sebastian/type/src/type/UnionType.php
vendored
30
vendor/sebastian/type/src/type/UnionType.php
vendored
@@ -16,7 +16,7 @@ use function sort;
|
||||
final class UnionType extends Type
|
||||
{
|
||||
/**
|
||||
* @psalm-var list<Type>
|
||||
* @psalm-var non-empty-list<Type>
|
||||
*/
|
||||
private $types;
|
||||
|
||||
@@ -52,6 +52,12 @@ final class UnionType extends Type
|
||||
$types = [];
|
||||
|
||||
foreach ($this->types as $type) {
|
||||
if ($type->isIntersection()) {
|
||||
$types[] = '(' . $type->name() . ')';
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$types[] = $type->name();
|
||||
}
|
||||
|
||||
@@ -71,11 +77,33 @@ final class UnionType extends Type
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true UnionType $this
|
||||
*/
|
||||
public function isUnion(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function containsIntersectionTypes(): bool
|
||||
{
|
||||
foreach ($this->types as $type) {
|
||||
if ($type->isIntersection()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-return non-empty-list<Type>
|
||||
*/
|
||||
public function types(): array
|
||||
{
|
||||
return $this->types;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
|
||||
@@ -31,6 +31,9 @@ final class UnknownType extends Type
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true UnknownType $this
|
||||
*/
|
||||
public function isUnknown(): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
3
vendor/sebastian/type/src/type/VoidType.php
vendored
3
vendor/sebastian/type/src/type/VoidType.php
vendored
@@ -26,6 +26,9 @@ final class VoidType extends Type
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true VoidType $this
|
||||
*/
|
||||
public function isVoid(): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user