mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 15:22:17 +02:00
N°8910 - Upgrade Symfony packages (#811)
This commit is contained in:
@@ -21,6 +21,7 @@ use phpDocumentor\Reflection\Types\Compound;
|
||||
use phpDocumentor\Reflection\Types\Integer;
|
||||
use phpDocumentor\Reflection\Types\Null_;
|
||||
use phpDocumentor\Reflection\Types\Nullable;
|
||||
use phpDocumentor\Reflection\Types\Scalar;
|
||||
use phpDocumentor\Reflection\Types\String_;
|
||||
use Symfony\Component\PropertyInfo\Type;
|
||||
|
||||
@@ -56,6 +57,15 @@ final class PhpDocTypeHelper
|
||||
$varType = $varType->getActualType();
|
||||
}
|
||||
|
||||
if ($varType instanceof Scalar) {
|
||||
return [
|
||||
new Type(Type::BUILTIN_TYPE_BOOL),
|
||||
new Type(Type::BUILTIN_TYPE_FLOAT),
|
||||
new Type(Type::BUILTIN_TYPE_INT),
|
||||
new Type(Type::BUILTIN_TYPE_STRING),
|
||||
];
|
||||
}
|
||||
|
||||
if (!$varType instanceof Compound) {
|
||||
if ($varType instanceof Null_) {
|
||||
$nullable = true;
|
||||
@@ -109,6 +119,10 @@ final class PhpDocTypeHelper
|
||||
{
|
||||
$docType = (string) $type;
|
||||
|
||||
if ('mixed[]' === $docType) {
|
||||
$docType = 'array';
|
||||
}
|
||||
|
||||
if ($type instanceof Collection) {
|
||||
$fqsen = $type->getFqsen();
|
||||
if ($fqsen && 'list' === $fqsen->getName() && !class_exists(List_::class, false) && !class_exists((string) $fqsen)) {
|
||||
@@ -152,14 +166,6 @@ final class PhpDocTypeHelper
|
||||
return new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true, $collectionKeyTypes, $collectionValueTypes);
|
||||
}
|
||||
|
||||
if ($type instanceof PseudoType) {
|
||||
if ($type->underlyingType() instanceof Integer) {
|
||||
return new Type(Type::BUILTIN_TYPE_INT, $nullable, null);
|
||||
} elseif ($type->underlyingType() instanceof String_) {
|
||||
return new Type(Type::BUILTIN_TYPE_STRING, $nullable, null);
|
||||
}
|
||||
}
|
||||
|
||||
$docType = $this->normalizeType($docType);
|
||||
[$phpType, $class] = $this->getPhpTypeAndClass($docType);
|
||||
|
||||
@@ -167,6 +173,21 @@ final class PhpDocTypeHelper
|
||||
return new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true, null, null);
|
||||
}
|
||||
|
||||
if (null === $class) {
|
||||
return new Type($phpType, $nullable, $class);
|
||||
}
|
||||
|
||||
if ($type instanceof PseudoType) {
|
||||
if ($type->underlyingType() instanceof Integer) {
|
||||
return new Type(Type::BUILTIN_TYPE_INT, $nullable, null);
|
||||
} elseif ($type->underlyingType() instanceof String_) {
|
||||
return new Type(Type::BUILTIN_TYPE_STRING, $nullable, null);
|
||||
} else {
|
||||
// It's safer to fall back to other extractors here, as resolving pseudo types correctly is not easy at the moment
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return new Type($phpType, $nullable, $class);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user