mirror of
https://github.com/danog/psalm-plugin.git
synced 2024-11-26 12:25:05 +01:00
Fixup
This commit is contained in:
parent
b36ca5eed0
commit
678f519620
@ -11,7 +11,7 @@
|
|||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^8.1",
|
"php": "^8.1",
|
||||||
"vimeo/psalm": "^5.0"
|
"vimeo/psalm": ">=5.16"
|
||||||
},
|
},
|
||||||
"conflict": {
|
"conflict": {
|
||||||
"azjezz/psl": "<2.0"
|
"azjezz/psl": "<2.0"
|
||||||
|
@ -28,80 +28,28 @@ final class FunctionReturnTypeProvider implements FunctionReturnTypeProviderInte
|
|||||||
if (null === $argument_type) {
|
if (null === $argument_type) {
|
||||||
// [unknown] -> list<string>
|
// [unknown] -> list<string>
|
||||||
$value = new Type\Union([new Type\Atomic\TString()], ['possibly_undefined' => true]);
|
$value = new Type\Union([new Type\Atomic\TString()], ['possibly_undefined' => true]);
|
||||||
return new Type\Union([new Type\Atomic\TKeyedArray(
|
return Type::getList($value);
|
||||||
[
|
|
||||||
0 => $value
|
|
||||||
],
|
|
||||||
null,
|
|
||||||
[
|
|
||||||
Type::getListKey(),
|
|
||||||
$value
|
|
||||||
],
|
|
||||||
true
|
|
||||||
)]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$string_argument_type = $argument_type->getAtomicTypes()['string'] ?? null;
|
$string_argument_type = $argument_type->getAtomicTypes()['string'] ?? null;
|
||||||
if (null === $string_argument_type) {
|
if (null === $string_argument_type) {
|
||||||
// [unknown] -> list<string>
|
// [unknown] -> list<string>
|
||||||
$value = new Type\Union([new Type\Atomic\TString()], ['possibly_undefined' => true]);
|
$value = new Type\Union([new Type\Atomic\TString()], ['possibly_undefined' => true]);
|
||||||
return new Type\Union([new Type\Atomic\TKeyedArray(
|
return Type::getList($value);
|
||||||
[
|
|
||||||
0 => $value
|
|
||||||
],
|
|
||||||
null,
|
|
||||||
[
|
|
||||||
Type::getListKey(),
|
|
||||||
$value
|
|
||||||
],
|
|
||||||
true
|
|
||||||
)]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($string_argument_type instanceof Type\Atomic\TNonEmptyString) {
|
if ($string_argument_type instanceof Type\Atomic\TNonEmptyString) {
|
||||||
// non-empty-lowercase-string => non-empty-list<non-empty-lowercase-string>
|
// non-empty-lowercase-string => non-empty-list<non-empty-lowercase-string>
|
||||||
if ($string_argument_type instanceof Type\Atomic\TNonEmptyLowercaseString) {
|
if ($string_argument_type instanceof Type\Atomic\TNonEmptyLowercaseString) {
|
||||||
$value = new Type\Union([new Type\Atomic\TNonEmptyLowercaseString()]);
|
return Type::getNonEmptyList(Type::getNonEmptyLowercaseString());
|
||||||
return new Type\Union([new Type\Atomic\TKeyedArray(
|
|
||||||
[
|
|
||||||
0 => $value
|
|
||||||
],
|
|
||||||
null,
|
|
||||||
[
|
|
||||||
Type::getListKey(),
|
|
||||||
$value
|
|
||||||
],
|
|
||||||
true
|
|
||||||
)]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// non-empty-string => non-empty-list<non-empty-string>
|
// non-empty-string => non-empty-list<non-empty-string>
|
||||||
$value = new Type\Union([new Type\Atomic\TNonEmptyString()]);
|
return Type::getNonEmptyList(Type::getNonEmptyString());
|
||||||
return new Type\Union([new Type\Atomic\TKeyedArray(
|
|
||||||
[
|
|
||||||
0 => $value
|
|
||||||
],
|
|
||||||
null,
|
|
||||||
[
|
|
||||||
Type::getListKey(),
|
|
||||||
$value
|
|
||||||
],
|
|
||||||
true
|
|
||||||
)]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// string -> list<string>
|
// string -> list<string>
|
||||||
$value = new Type\Union([new Type\Atomic\TString()], ['possibly_undefined' => true]);
|
$value = new Type\Union([new Type\Atomic\TString()], ['possibly_undefined' => true]);
|
||||||
return new Type\Union([new Type\Atomic\TKeyedArray(
|
return Type::getList($value);
|
||||||
[
|
|
||||||
0 => $value
|
|
||||||
],
|
|
||||||
null,
|
|
||||||
[
|
|
||||||
Type::getListKey(),
|
|
||||||
$value
|
|
||||||
],
|
|
||||||
true
|
|
||||||
)]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user