mirror of
https://github.com/danog/psalm-plugin.git
synced 2024-11-26 12:25:05 +01:00
chore: add compatibility with psalm 5
Signed-off-by: azjezz <azjezz@protonmail.com>
This commit is contained in:
parent
51f37a1c07
commit
dff80efbbf
@ -11,7 +11,7 @@
|
||||
],
|
||||
"require": {
|
||||
"php": "^8.1",
|
||||
"vimeo/psalm": "^4.6"
|
||||
"vimeo/psalm": "^4.20 || ^5.0"
|
||||
},
|
||||
"conflict": {
|
||||
"azjezz/psl": "<2.0"
|
||||
@ -47,12 +47,15 @@
|
||||
},
|
||||
"config": {
|
||||
"process-timeout": 1200,
|
||||
"sort-packages": true
|
||||
"sort-packages": true,
|
||||
"allow-plugins": {
|
||||
"composer/package-versions-deprecated": false
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"psalm": {
|
||||
"pluginClass": "Psl\\Psalm\\Plugin"
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev"
|
||||
"minimum-stability": "alpha"
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<psalm totallyTyped="true" resolveFromConfigFile="true" forbidEcho="true" strictBinaryOperands="true" phpVersion="8.1" allowStringToStandInForClass="true" rememberPropertyAssignmentsAfterCall="false" skipChecksOnUnresolvableIncludes="false" checkForThrowsDocblock="true" checkForThrowsInGlobalScope="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd">
|
||||
<psalm totallyTyped="true" resolveFromConfigFile="true" strictBinaryOperands="true" phpVersion="8.1" allowStringToStandInForClass="true" rememberPropertyAssignmentsAfterCall="false" skipChecksOnUnresolvableIncludes="false" checkForThrowsDocblock="true" checkForThrowsInGlobalScope="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd">
|
||||
<projectFiles>
|
||||
<directory name="src" />
|
||||
<ignoreFiles>
|
||||
|
@ -39,7 +39,7 @@ final class FunctionReturnTypeProvider implements FunctionReturnTypeProviderInte
|
||||
if ($array_argument_type instanceof Type\Atomic\TNonEmptyList) {
|
||||
$count = $array_argument_type->count;
|
||||
if (null === $count) {
|
||||
return Type::getPositiveInt();
|
||||
return new Type\Union([new Type\Atomic\TIntRange(1, null)]);
|
||||
}
|
||||
|
||||
return Type::getInt(false, $count);
|
||||
@ -48,7 +48,7 @@ final class FunctionReturnTypeProvider implements FunctionReturnTypeProviderInte
|
||||
if ($array_argument_type instanceof Type\Atomic\TNonEmptyArray) {
|
||||
$count = $array_argument_type->count;
|
||||
if (null === $count) {
|
||||
return Type::getPositiveInt();
|
||||
return new Type\Union([new Type\Atomic\TIntRange(1, null)]);
|
||||
}
|
||||
|
||||
return Type::getInt(false, $count);
|
||||
@ -62,17 +62,15 @@ final class FunctionReturnTypeProvider implements FunctionReturnTypeProviderInte
|
||||
// return Type::getInt(false, count($array_argument_type->properties));
|
||||
|
||||
if (count($array_argument_type->properties) >= 1) {
|
||||
return Type::getPositiveInt();
|
||||
return new Type\Union([new Type\Atomic\TIntRange(1, null)]);
|
||||
}
|
||||
|
||||
return Type::getInt();
|
||||
}
|
||||
|
||||
if ($array_argument_type instanceof Type\Atomic\TArray) {
|
||||
if ($array_argument_type->type_params[0]->isEmpty() && $array_argument_type->type_params[1]->isEmpty()) {
|
||||
if (($array_argument_type instanceof Type\Atomic\TArray) && $array_argument_type->type_params[0]->isNever() && $array_argument_type->type_params[1]->isNever()) {
|
||||
return Type::getInt(false, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return Type::getInt();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user