From 1c4f7ab3b838b23afb2ee4dab14acbf75956e952 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 22 Mar 2022 12:24:31 +0300 Subject: * add phpunit as a dev dependency * add some basic tests for UrlHelper::rewrite_relative() * fix UrlHelper::rewrite_relative() to work better on non-absolute relative URL paths --- .../type-resolver/src/Types/AbstractList.php | 83 ++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 vendor/phpdocumentor/type-resolver/src/Types/AbstractList.php (limited to 'vendor/phpdocumentor/type-resolver/src/Types/AbstractList.php') diff --git a/vendor/phpdocumentor/type-resolver/src/Types/AbstractList.php b/vendor/phpdocumentor/type-resolver/src/Types/AbstractList.php new file mode 100644 index 000000000..b674862af --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/AbstractList.php @@ -0,0 +1,83 @@ +valueType = $valueType; + $this->defaultKeyType = new Compound([new String_(), new Integer()]); + $this->keyType = $keyType; + } + + /** + * Returns the type for the keys of this array. + */ + public function getKeyType(): Type + { + return $this->keyType ?? $this->defaultKeyType; + } + + /** + * Returns the value for the keys of this array. + */ + public function getValueType(): Type + { + return $this->valueType; + } + + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + */ + public function __toString(): string + { + if ($this->keyType) { + return 'array<' . $this->keyType . ',' . $this->valueType . '>'; + } + + if ($this->valueType instanceof Mixed_) { + return 'array'; + } + + if ($this->valueType instanceof Compound) { + return '(' . $this->valueType . ')[]'; + } + + return $this->valueType . '[]'; + } +} -- cgit v1.2.3