Composer update
This commit is contained in:
41
www/vendor/sebastian/comparator/ChangeLog.md
vendored
41
www/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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
14
www/vendor/sebastian/exporter/ChangeLog.md
vendored
14
www/vendor/sebastian/exporter/ChangeLog.md
vendored
@@ -2,6 +2,12 @@
|
||||
|
||||
All notable changes are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
|
||||
|
||||
## [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 +38,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 +66,13 @@ 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.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
|
||||
|
||||
20
www/vendor/sebastian/exporter/src/Exporter.php
vendored
20
www/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;
|
||||
@@ -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)') {
|
||||
|
||||
10
www/vendor/sebastian/type/ChangeLog.md
vendored
10
www/vendor/sebastian/type/ChangeLog.md
vendored
@@ -2,6 +2,15 @@
|
||||
|
||||
All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
|
||||
|
||||
## [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
|
||||
@@ -130,6 +139,7 @@ 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)
|
||||
|
||||
[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
www/vendor/sebastian/type/composer.json
vendored
2
www/vendor/sebastian/type/composer.json
vendored
@@ -44,7 +44,7 @@
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.1-dev"
|
||||
"dev-master": "3.2-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
42
www/vendor/sebastian/type/src/Parameter.php
vendored
Normal file
42
www/vendor/sebastian/type/src/Parameter.php
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php declare(strict_types=1);
|
||||
/*
|
||||
* This file is part of sebastian/type.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
namespace SebastianBergmann\Type;
|
||||
|
||||
final class Parameter
|
||||
{
|
||||
/**
|
||||
* @psalm-var non-empty-string
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var Type
|
||||
*/
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* @psalm-param non-empty-string $name
|
||||
*/
|
||||
public function __construct(string $name, Type $type)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
public function name(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function type(): Type
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
}
|
||||
163
www/vendor/sebastian/type/src/ReflectionMapper.php
vendored
163
www/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);
|
||||
|
||||
@@ -84,6 +84,9 @@ final class CallableType extends Type
|
||||
return $this->allowsNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true CallableType $this
|
||||
*/
|
||||
public function isCallable(): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -18,7 +18,7 @@ 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
|
||||
*/
|
||||
|
||||
@@ -74,6 +74,9 @@ final class IterableType extends Type
|
||||
return $this->allowsNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true IterableType $this
|
||||
*/
|
||||
public function isIterable(): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -31,6 +31,9 @@ final class MixedType extends Type
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true MixedType $this
|
||||
*/
|
||||
public function isMixed(): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -26,6 +26,9 @@ final class NeverType extends Type
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true NeverType $this
|
||||
*/
|
||||
public function isNever(): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -71,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;
|
||||
|
||||
@@ -32,6 +32,9 @@ final class TrueType extends Type
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true TrueType $this
|
||||
*/
|
||||
public function isTrue(): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
45
www/vendor/sebastian/type/src/type/Type.php
vendored
45
www/vendor/sebastian/type/src/type/Type.php
vendored
@@ -98,76 +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
www/vendor/sebastian/type/src/type/UnionType.php
vendored
30
www/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;
|
||||
|
||||
@@ -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