package and depencies
This commit is contained in:
65
vendor/phpdocumentor/type-resolver/.yamllint.yaml
vendored
Normal file
65
vendor/phpdocumentor/type-resolver/.yamllint.yaml
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
extends: "default"
|
||||
|
||||
ignore: |
|
||||
.build/
|
||||
.notes/
|
||||
vendor/
|
||||
rules:
|
||||
braces:
|
||||
max-spaces-inside-empty: 0
|
||||
max-spaces-inside: 1
|
||||
min-spaces-inside-empty: 0
|
||||
min-spaces-inside: 1
|
||||
brackets:
|
||||
max-spaces-inside-empty: 0
|
||||
max-spaces-inside: 0
|
||||
min-spaces-inside-empty: 0
|
||||
min-spaces-inside: 0
|
||||
colons:
|
||||
max-spaces-after: 1
|
||||
max-spaces-before: 0
|
||||
commas:
|
||||
max-spaces-after: 1
|
||||
max-spaces-before: 0
|
||||
min-spaces-after: 1
|
||||
comments:
|
||||
ignore-shebangs: true
|
||||
min-spaces-from-content: 1
|
||||
require-starting-space: true
|
||||
comments-indentation: "enable"
|
||||
document-end:
|
||||
present: false
|
||||
document-start:
|
||||
present: false
|
||||
indentation:
|
||||
check-multi-line-strings: false
|
||||
indent-sequences: true
|
||||
spaces: 2
|
||||
empty-lines:
|
||||
max-end: 0
|
||||
max-start: 0
|
||||
max: 1
|
||||
empty-values:
|
||||
forbid-in-block-mappings: true
|
||||
forbid-in-flow-mappings: true
|
||||
hyphens:
|
||||
max-spaces-after: 2
|
||||
key-duplicates: "enable"
|
||||
key-ordering: "disable"
|
||||
line-length: "disable"
|
||||
new-line-at-end-of-file: "enable"
|
||||
new-lines:
|
||||
type: "unix"
|
||||
octal-values:
|
||||
forbid-implicit-octal: true
|
||||
quoted-strings:
|
||||
quote-type: "double"
|
||||
trailing-spaces: "enable"
|
||||
truthy:
|
||||
allowed-values:
|
||||
- "false"
|
||||
- "true"
|
||||
|
||||
yaml-files:
|
||||
- "*.yaml"
|
||||
- "*.yml"
|
16
vendor/phpdocumentor/type-resolver/composer-require-checker.json
vendored
Normal file
16
vendor/phpdocumentor/type-resolver/composer-require-checker.json
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"symbol-whitelist" : [
|
||||
"null", "true", "false",
|
||||
"static", "self", "parent",
|
||||
"array", "string", "int", "float", "bool", "iterable", "callable", "void", "object", "XSLTProcessor",
|
||||
"T_NAME_QUALIFIED", "T_NAME_FULLY_QUALIFIED"
|
||||
],
|
||||
"php-core-extensions" : [
|
||||
"Core",
|
||||
"pcre",
|
||||
"Reflection",
|
||||
"tokenizer",
|
||||
"SPL",
|
||||
"standard"
|
||||
]
|
||||
}
|
17
vendor/phpdocumentor/type-resolver/composer.json
vendored
17
vendor/phpdocumentor/type-resolver/composer.json
vendored
@@ -10,12 +10,17 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.2 || ^8.0",
|
||||
"php": "^7.4 || ^8.0",
|
||||
"phpdocumentor/reflection-common": "^2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-tokenizer": "*",
|
||||
"psalm/phar": "^4.8"
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"phpstan/phpstan": "^1.8",
|
||||
"phpstan/phpstan-phpunit": "^1.1",
|
||||
"phpstan/extension-installer": "^1.1",
|
||||
"vimeo/psalm": "^4.25",
|
||||
"rector/rector": "^0.13.9"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
@@ -31,5 +36,13 @@
|
||||
"branch-alias": {
|
||||
"dev-1.x": "1.x-dev"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"platform": {
|
||||
"php": "7.4.0"
|
||||
},
|
||||
"allow-plugins": {
|
||||
"phpstan/extension-installer": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
26
vendor/phpdocumentor/type-resolver/rector.php
vendored
Normal file
26
vendor/phpdocumentor/type-resolver/rector.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Set\ValueObject\LevelSetList;
|
||||
|
||||
return static function (RectorConfig $rectorConfig): void {
|
||||
$rectorConfig->paths([
|
||||
__DIR__ . '/src',
|
||||
__DIR__ . '/tests/unit'
|
||||
]);
|
||||
|
||||
// register a single rule
|
||||
$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);
|
||||
$rectorConfig->rule(Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector::class);
|
||||
$rectorConfig->rule(Rector\TypeDeclaration\Rector\Closure\AddClosureReturnTypeRector::class);
|
||||
$rectorConfig->rule(Rector\PHPUnit\Rector\Class_\AddProphecyTraitRector::class);
|
||||
$rectorConfig->importNames();
|
||||
|
||||
// define sets of rules
|
||||
$rectorConfig->sets([
|
||||
LevelSetList::UP_TO_PHP_74
|
||||
]);
|
||||
};
|
@@ -37,4 +37,4 @@ final class False_ extends Boolean implements PseudoType
|
||||
}
|
||||
}
|
||||
|
||||
class_alias('\phpDocumentor\Reflection\PseudoTypes\False_', 'phpDocumentor\Reflection\Types\False_', false);
|
||||
class_alias(False_::class, 'phpDocumentor\Reflection\Types\False_', false);
|
||||
|
@@ -24,11 +24,9 @@ use phpDocumentor\Reflection\Types\Integer;
|
||||
*/
|
||||
final class IntegerRange extends Integer implements PseudoType
|
||||
{
|
||||
/** @var string */
|
||||
private $minValue;
|
||||
private string $minValue;
|
||||
|
||||
/** @var string */
|
||||
private $maxValue;
|
||||
private string $maxValue;
|
||||
|
||||
public function __construct(string $minValue, string $maxValue)
|
||||
{
|
||||
|
@@ -37,4 +37,4 @@ final class True_ extends Boolean implements PseudoType
|
||||
}
|
||||
}
|
||||
|
||||
class_alias('\phpDocumentor\Reflection\PseudoTypes\True_', 'phpDocumentor\Reflection\Types\True_', false);
|
||||
class_alias(True_::class, 'phpDocumentor\Reflection\Types\True_', false);
|
||||
|
@@ -15,35 +15,60 @@ namespace phpDocumentor\Reflection;
|
||||
|
||||
use ArrayIterator;
|
||||
use InvalidArgumentException;
|
||||
use phpDocumentor\Reflection\PseudoTypes\CallableString;
|
||||
use phpDocumentor\Reflection\PseudoTypes\False_;
|
||||
use phpDocumentor\Reflection\PseudoTypes\HtmlEscapedString;
|
||||
use phpDocumentor\Reflection\PseudoTypes\IntegerRange;
|
||||
use phpDocumentor\Reflection\PseudoTypes\List_;
|
||||
use phpDocumentor\Reflection\PseudoTypes\LiteralString;
|
||||
use phpDocumentor\Reflection\PseudoTypes\LowercaseString;
|
||||
use phpDocumentor\Reflection\PseudoTypes\NegativeInteger;
|
||||
use phpDocumentor\Reflection\PseudoTypes\NonEmptyLowercaseString;
|
||||
use phpDocumentor\Reflection\PseudoTypes\NonEmptyString;
|
||||
use phpDocumentor\Reflection\PseudoTypes\Numeric_;
|
||||
use phpDocumentor\Reflection\PseudoTypes\NumericString;
|
||||
use phpDocumentor\Reflection\PseudoTypes\PositiveInteger;
|
||||
use phpDocumentor\Reflection\PseudoTypes\TraitString;
|
||||
use phpDocumentor\Reflection\PseudoTypes\True_;
|
||||
use phpDocumentor\Reflection\Types\Array_;
|
||||
use phpDocumentor\Reflection\Types\ArrayKey;
|
||||
use phpDocumentor\Reflection\Types\Boolean;
|
||||
use phpDocumentor\Reflection\Types\Callable_;
|
||||
use phpDocumentor\Reflection\Types\ClassString;
|
||||
use phpDocumentor\Reflection\Types\Collection;
|
||||
use phpDocumentor\Reflection\Types\Compound;
|
||||
use phpDocumentor\Reflection\Types\Context;
|
||||
use phpDocumentor\Reflection\Types\Expression;
|
||||
use phpDocumentor\Reflection\Types\Float_;
|
||||
use phpDocumentor\Reflection\Types\Integer;
|
||||
use phpDocumentor\Reflection\Types\InterfaceString;
|
||||
use phpDocumentor\Reflection\Types\Intersection;
|
||||
use phpDocumentor\Reflection\Types\Iterable_;
|
||||
use phpDocumentor\Reflection\Types\Mixed_;
|
||||
use phpDocumentor\Reflection\Types\Never_;
|
||||
use phpDocumentor\Reflection\Types\Null_;
|
||||
use phpDocumentor\Reflection\Types\Nullable;
|
||||
use phpDocumentor\Reflection\Types\Object_;
|
||||
use phpDocumentor\Reflection\Types\Parent_;
|
||||
use phpDocumentor\Reflection\Types\Resource_;
|
||||
use phpDocumentor\Reflection\Types\Scalar;
|
||||
use phpDocumentor\Reflection\Types\Self_;
|
||||
use phpDocumentor\Reflection\Types\Static_;
|
||||
use phpDocumentor\Reflection\Types\String_;
|
||||
use phpDocumentor\Reflection\Types\This;
|
||||
use phpDocumentor\Reflection\Types\Void_;
|
||||
use RuntimeException;
|
||||
|
||||
use function array_key_exists;
|
||||
use function array_key_last;
|
||||
use function array_pop;
|
||||
use function array_values;
|
||||
use function class_exists;
|
||||
use function class_implements;
|
||||
use function count;
|
||||
use function current;
|
||||
use function end;
|
||||
use function in_array;
|
||||
use function is_numeric;
|
||||
use function key;
|
||||
use function preg_split;
|
||||
use function strpos;
|
||||
use function strtolower;
|
||||
@@ -76,54 +101,51 @@ final class TypeResolver
|
||||
* @var array<string, string> List of recognized keywords and unto which Value Object they map
|
||||
* @psalm-var array<string, class-string<Type>>
|
||||
*/
|
||||
private $keywords = [
|
||||
'string' => Types\String_::class,
|
||||
'class-string' => Types\ClassString::class,
|
||||
'interface-string' => Types\InterfaceString::class,
|
||||
'html-escaped-string' => PseudoTypes\HtmlEscapedString::class,
|
||||
'lowercase-string' => PseudoTypes\LowercaseString::class,
|
||||
'non-empty-lowercase-string' => PseudoTypes\NonEmptyLowercaseString::class,
|
||||
'non-empty-string' => PseudoTypes\NonEmptyString::class,
|
||||
'numeric-string' => PseudoTypes\NumericString::class,
|
||||
'numeric' => PseudoTypes\Numeric_::class,
|
||||
'trait-string' => PseudoTypes\TraitString::class,
|
||||
'int' => Types\Integer::class,
|
||||
'integer' => Types\Integer::class,
|
||||
'positive-int' => PseudoTypes\PositiveInteger::class,
|
||||
'negative-int' => PseudoTypes\NegativeInteger::class,
|
||||
'bool' => Types\Boolean::class,
|
||||
'boolean' => Types\Boolean::class,
|
||||
'real' => Types\Float_::class,
|
||||
'float' => Types\Float_::class,
|
||||
'double' => Types\Float_::class,
|
||||
'object' => Types\Object_::class,
|
||||
'mixed' => Types\Mixed_::class,
|
||||
'array' => Types\Array_::class,
|
||||
'array-key' => Types\ArrayKey::class,
|
||||
'resource' => Types\Resource_::class,
|
||||
'void' => Types\Void_::class,
|
||||
'null' => Types\Null_::class,
|
||||
'scalar' => Types\Scalar::class,
|
||||
'callback' => Types\Callable_::class,
|
||||
'callable' => Types\Callable_::class,
|
||||
'callable-string' => PseudoTypes\CallableString::class,
|
||||
'false' => PseudoTypes\False_::class,
|
||||
'true' => PseudoTypes\True_::class,
|
||||
'literal-string' => PseudoTypes\LiteralString::class,
|
||||
'self' => Types\Self_::class,
|
||||
'$this' => Types\This::class,
|
||||
'static' => Types\Static_::class,
|
||||
'parent' => Types\Parent_::class,
|
||||
'iterable' => Types\Iterable_::class,
|
||||
'never' => Types\Never_::class,
|
||||
'list' => PseudoTypes\List_::class,
|
||||
private array $keywords = [
|
||||
'string' => String_::class,
|
||||
'class-string' => ClassString::class,
|
||||
'interface-string' => InterfaceString::class,
|
||||
'html-escaped-string' => HtmlEscapedString::class,
|
||||
'lowercase-string' => LowercaseString::class,
|
||||
'non-empty-lowercase-string' => NonEmptyLowercaseString::class,
|
||||
'non-empty-string' => NonEmptyString::class,
|
||||
'numeric-string' => NumericString::class,
|
||||
'numeric' => Numeric_::class,
|
||||
'trait-string' => TraitString::class,
|
||||
'int' => Integer::class,
|
||||
'integer' => Integer::class,
|
||||
'positive-int' => PositiveInteger::class,
|
||||
'negative-int' => NegativeInteger::class,
|
||||
'bool' => Boolean::class,
|
||||
'boolean' => Boolean::class,
|
||||
'real' => Float_::class,
|
||||
'float' => Float_::class,
|
||||
'double' => Float_::class,
|
||||
'object' => Object_::class,
|
||||
'mixed' => Mixed_::class,
|
||||
'array' => Array_::class,
|
||||
'array-key' => ArrayKey::class,
|
||||
'resource' => Resource_::class,
|
||||
'void' => Void_::class,
|
||||
'null' => Null_::class,
|
||||
'scalar' => Scalar::class,
|
||||
'callback' => Callable_::class,
|
||||
'callable' => Callable_::class,
|
||||
'callable-string' => CallableString::class,
|
||||
'false' => False_::class,
|
||||
'true' => True_::class,
|
||||
'literal-string' => LiteralString::class,
|
||||
'self' => Self_::class,
|
||||
'$this' => This::class,
|
||||
'static' => Static_::class,
|
||||
'parent' => Parent_::class,
|
||||
'iterable' => Iterable_::class,
|
||||
'never' => Never_::class,
|
||||
'list' => List_::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* @var FqsenResolver
|
||||
* @psalm-readonly
|
||||
*/
|
||||
private $fqsenResolver;
|
||||
/** @psalm-readonly */
|
||||
private FqsenResolver $fqsenResolver;
|
||||
|
||||
/**
|
||||
* Initializes this TypeResolver with the means to create and resolve Fqsen objects.
|
||||
@@ -210,6 +232,7 @@ final class TypeResolver
|
||||
self::PARSER_IN_COMPOUND,
|
||||
self::PARSER_IN_ARRAY_EXPRESSION,
|
||||
self::PARSER_IN_COLLECTION_EXPRESSION,
|
||||
self::PARSER_IN_NULLABLE,
|
||||
], true)
|
||||
) {
|
||||
throw new RuntimeException(
|
||||
@@ -225,6 +248,7 @@ final class TypeResolver
|
||||
self::PARSER_IN_COMPOUND,
|
||||
self::PARSER_IN_ARRAY_EXPRESSION,
|
||||
self::PARSER_IN_COLLECTION_EXPRESSION,
|
||||
self::PARSER_IN_NULLABLE,
|
||||
], true)
|
||||
) {
|
||||
throw new RuntimeException(
|
||||
@@ -278,8 +302,7 @@ final class TypeResolver
|
||||
) {
|
||||
break;
|
||||
} elseif ($token === self::OPERATOR_ARRAY) {
|
||||
end($types);
|
||||
$last = key($types);
|
||||
$last = array_key_last($types);
|
||||
if ($last === null) {
|
||||
throw new InvalidArgumentException('Unexpected array operator');
|
||||
}
|
||||
@@ -293,13 +316,8 @@ final class TypeResolver
|
||||
|
||||
$tokens->next();
|
||||
} else {
|
||||
$type = $this->resolveSingleType($token, $context);
|
||||
$types[] = $this->resolveSingleType($token, $context);
|
||||
$tokens->next();
|
||||
if ($parserContext === self::PARSER_IN_NULLABLE) {
|
||||
return $type;
|
||||
}
|
||||
|
||||
$types[] = $type;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -54,7 +54,7 @@ abstract class AbstractList implements Type
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value for the keys of this array.
|
||||
* Returns the type for the values of this array.
|
||||
*/
|
||||
public function getValueType(): Type
|
||||
{
|
||||
|
@@ -34,10 +34,9 @@ abstract class AggregatedType implements Type, IteratorAggregate
|
||||
* @psalm-allow-private-mutation
|
||||
* @var array<int, Type>
|
||||
*/
|
||||
private $types = [];
|
||||
private array $types = [];
|
||||
|
||||
/** @var string */
|
||||
private $token;
|
||||
private string $token;
|
||||
|
||||
/**
|
||||
* @param array<Type> $types
|
||||
|
@@ -24,8 +24,7 @@ use phpDocumentor\Reflection\Type;
|
||||
*/
|
||||
final class ClassString extends String_ implements PseudoType
|
||||
{
|
||||
/** @var Fqsen|null */
|
||||
private $fqsen;
|
||||
private ?Fqsen $fqsen;
|
||||
|
||||
/**
|
||||
* Initializes this representation of a class string with the given Fqsen.
|
||||
|
@@ -31,8 +31,7 @@ use phpDocumentor\Reflection\Type;
|
||||
*/
|
||||
final class Collection extends AbstractList
|
||||
{
|
||||
/** @var Fqsen|null */
|
||||
private $fqsen;
|
||||
private ?Fqsen $fqsen;
|
||||
|
||||
/**
|
||||
* Initializes this representation of an array with the given Type or Fqsen.
|
||||
|
@@ -36,13 +36,13 @@ use function trim;
|
||||
final class Context
|
||||
{
|
||||
/** @var string The current namespace. */
|
||||
private $namespace;
|
||||
private string $namespace;
|
||||
|
||||
/**
|
||||
* @var string[] List of namespace aliases => Fully Qualified Namespace.
|
||||
* @psalm-var array<string, string>
|
||||
*/
|
||||
private $namespaceAliases;
|
||||
private array $namespaceAliases;
|
||||
|
||||
/**
|
||||
* Initializes the new context and normalizes all passed namespaces to be in Qualified Namespace Name (QNN)
|
||||
|
@@ -22,8 +22,7 @@ use phpDocumentor\Reflection\Type;
|
||||
*/
|
||||
final class Expression implements Type
|
||||
{
|
||||
/** @var Type */
|
||||
protected $valueType;
|
||||
protected Type $valueType;
|
||||
|
||||
/**
|
||||
* Initializes this representation of an array with the given Type.
|
||||
|
@@ -23,8 +23,7 @@ use phpDocumentor\Reflection\Type;
|
||||
*/
|
||||
final class InterfaceString implements Type
|
||||
{
|
||||
/** @var Fqsen|null */
|
||||
private $fqsen;
|
||||
private ?Fqsen $fqsen;
|
||||
|
||||
/**
|
||||
* Initializes this representation of a class string with the given Fqsen.
|
||||
|
@@ -23,7 +23,7 @@ use phpDocumentor\Reflection\Type;
|
||||
final class Nullable implements Type
|
||||
{
|
||||
/** @var Type The actual type that is wrapped */
|
||||
private $realType;
|
||||
private Type $realType;
|
||||
|
||||
/**
|
||||
* Initialises this nullable type using the real type embedded
|
||||
|
@@ -30,8 +30,7 @@ use function strpos;
|
||||
*/
|
||||
final class Object_ implements Type
|
||||
{
|
||||
/** @var Fqsen|null */
|
||||
private $fqsen;
|
||||
private ?Fqsen $fqsen;
|
||||
|
||||
/**
|
||||
* Initializes this object with an optional FQSEN, if not provided this object is considered 'untyped'.
|
||||
|
Reference in New Issue
Block a user